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 rtl-optimization/13355] Suboptimal code generated with global register variables


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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |steven at gcc dot gnu.org

--- Comment #10 from Steven Bosscher <steven at gcc dot gnu.org> 2012-11-08 22:46:53 UTC ---
(In reply to comment #1)
> Created attachment 5301 [details]
> example .c file that shows behavior with
>  gcc -march=i686 -mtune=i686 -fomit-frame-pointer -O2 test.c

GCC 4.7.1 compiles the two interesting functions in the test case to:

op_cmovl_EAX_T1_T0:
        testl   %ebx, %ebx
        je      .L2
        movl    %esi, 0(%ebp)
.L2:
        ret

op_imull_EAX_T0:
        subl    $20, %esp
        movl    0(%ebp), %eax
        imull   %ebx
        movl    %eax, (%esp)
        movl    %eax, 0(%ebp)
        movl    (%esp), %eax
        movl    %edx, 4(%esp)
        movl    %edx, 8(%ebp)
        movl    %eax, %edx
        movl    %eax, 8(%esp)
        sarl    $31, %edx
        movl    4(%esp), %eax
        movl    %edx, 12(%esp)
        cmpl    %eax, 12(%esp)
        setne   %al
        movzbl  %al, %eax
        movl    %eax, 32(%ebp)
        addl    $20, %esp
        ret


Trunk r193340 produces the following:

op_cmovl_EAX_T1_T0:
        testl   %ebx, %ebx
        je      .L2
        movl    %esi, 0(%ebp)
.L2:
        ret

op_imull_EAX_T0:
        subl    $12, %esp
        movl    %ebx, %eax
        imull   0(%ebp)
        movl    %eax, 0(%ebp)
        movl    %eax, (%esp)
        sarl    $31, %eax
        movl    %eax, 4(%esp)
        xorl    %eax, %eax
        cmpl    %edx, 4(%esp)
        movl    %edx, 8(%ebp)
        setne   %al
        movl    %eax, 32(%ebp)
        addl    $12, %esp
        ret


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