harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aleksey Shipilev (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-5887) [drlvm][jitrino] use INC operation to increment profile
Date Tue, 01 Jul 2008 17:17:45 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-5887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12609640#action_12609640
] 

Aleksey Shipilev commented on HARMONY-5887:
-------------------------------------------

On my P4 2.8 Ghz (Northwood) / Gentoo Linux and this microtest:

$ gcc -DADD test.c && time ./a.out
real    0m3.581s
user    0m3.580s
sys     0m0.001s

$ gcc -DINC test.c && time ./a.out
real    0m5.729s
user    0m5.701s
sys     0m0.011s

This one proofs the Optimization Manual's coding rule: use ADD instead of INC.

---- test.c -------------------------------------------------

static const int count = -1024;

int main(int argc, char** argv) {

        #ifdef ADD
        asm (
                "movl $count, %eax\t\n"
                "movl $count, %ebx\t\n"
                "movl $count, %ecx\t\n"
                "movl $count, %edx\t\n"
                "loop: addl $1, %eax\t\n"
                "addl $1, %ebx\t\n"
                "addl $1, %ecx\t\n"
                "addl $1, %edx\t\n"
                "addl $1, %eax\t\n"
                "addl $1, %ebx\t\n"
                "addl $1, %ecx\t\n"
                "addl $1, %edx\t\n"
                "testl %eax, %eax\t\n"
                "jne loop\t\n"
        );
        #endif

        #ifdef INC
        asm (
                "movl $count, %eax\t\n"
                "movl $count, %ebx\t\n"
                "movl $count, %ecx\t\n"
                "movl $count, %edx\t\n"
                "loop: incl %eax\t\n"
                "incl %ebx\t\n"
                "incl %ecx\t\n"
                "incl %edx\t\n"
                "incl %eax\t\n"
                "incl %ebx\t\n"
                "incl %ecx\t\n"
                "incl %edx\t\n"
                "testl %eax, %eax\t\n"
                "jne loop\t\n"
        );
        #endif

        return 0;
}

---- test.c (end) --------------------------------------------

> [drlvm][jitrino] use INC operation to increment profile 
> --------------------------------------------------------
>
>                 Key: HARMONY-5887
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5887
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Alexey Varlamov
>            Priority: Trivial
>         Attachments: inc.diff
>
>
> I've noticed "ADD counter,1" construct is used to increment dynamic profile counters.
More neat and efective INC instruction should be used instead.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message