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/15187] Inefficient if optimization with -O2 -ffast-math



------- Comment #11 from pluto at agmk dot net  2006-03-28 10:34 -------
it looks like 4.1.1 and 4.2.0 still produce unoptimal code.

#include <math.h>
double test(double x)
{
        if (x > 0.0)
                return cos(x);
        else
                return sin(x);
}

[ 4.1.1-0.20060322 / rev.112277 /x86-64 ]

$ gcc bug.c -O2 -ffast-math -m32 -march=i686 -S

test:   pushl   %ebp
        movl    %esp, %ebp
        fldl    8(%ebp)
        fldz
        fcomip  %st(1), %st
        jae     .L2
        popl    %ebp
        fcos
        ret

.L2:    popl    %ebp
        fsin
        ret

[ 4.2.0-20060323 / rev.112317 / x86-64 ]

$ ./xgcc -B. bug.c -O2 -ffast-math -m32 -march=i686 -S
bug.c: In function &#8216;test&#8217;:
bug.c:7: internal compiler error: in bsi_last, at tree-flow-inline.h:760


-- 

pluto at agmk dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


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


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