This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/17886] variable rotate and long long rotate should be better optimized



------- Comment #23 from tkho at ucla dot edu  2005-11-10 22:43 -------
Created an attachment (id=10211)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10211&action=view)
Another long long rotate test case

Hi Michael,

I tried your patch in comment #16, and it didn't optimize our code. Attached is
another minimal testcase. I hope it helps and you can do something with it.

Here is a rough instruction-count comparison for f() compiled at -O2,
march=pentiumpro with icc9 and gcc head 20051108 with your patch applied:

icc: 11
gcc: 23

`icc -O2 -march=pentiumpro -S test3.c` gives:
        movl      4(%esp), %eax
        movl      8(%esp), %ecx
        movl      %eax, %edx
        shrl      $24, %edx
        shll      $8, %eax
        shll      $8, %ecx
        orl       %ecx, %edx
        movzwl    18(%esp), %ecx
        movzbl    %cl, %ecx
        orl       %ecx, %eax
        ret

`g++ -c test3.c -save-temps -O2 -march=pentiumpro -momit-leaf-frame-pointer`
gives:
        subl    $12, %esp
        movl    %edi, 8(%esp)
        movl    28(%esp), %edi
        movl    16(%esp), %eax
        movl    20(%esp), %edx
        movl    %esi, 4(%esp)
        movl    24(%esp), %esi
        movl    %edi, %esi
        xorl    %edi, %edi
        movl    8(%esp), %edi
        movl    %ebx, (%esp)
        shrl    $16, %esi
        xorl    %ebx, %ebx
        shldl   $8, %eax, %edx
        movl    %esi, %ecx
        movl    4(%esp), %esi
        orl     %ebx, %edx
        movl    (%esp), %ebx
        andl    $255, %ecx
        sall    $8, %eax
        addl    $12, %esp
        orl     %ecx, %eax
        ret


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17886


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]