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



--- Comment #2 from Uros Bizjak <ubizjak at gmail dot com> 2013-02-02 12:01:56 
UTC ---

(In reply to comment #1)

> Created attachment 29330 [details]

> testcase

> 

> This test must be compiled with the following options:

> "-O2 -ffast-math -msse2 -mfpmath=sse -m32 -march=atom -mtune=atom

> -ftree-loop-if-convert"



Compiling attached test with above flags, I got:



foo:

        movl    4(%esp), %eax

        movl    8(%esp), %edx

        testb   %al, %al

        je      .L3

        testw   %dx, %dx

        je      .L3

        shrb    %al

        shrw    %dx

        xorl    %edx, %eax

        andl    $1, %eax

        ret

.L3:

        xorl    %eax, %eax

        ret



which looks the same as your optimal assembly in Description - maybe due to the

fact that the attached test source is the same as the source in Description.



BTW: This is probably the case of missing CSE in tree optimizers. Combine pass

is not powerful enough to figure out optimal sequence, it more-or-less blindly

combines various patterns.



Please provide the test that exposes this missing optimization.

Reply via email to