int test (void)
{
double f;
int j = (f > 0.);
return j;
}Under "gcc (GCC) 4.1.0 (SUSE Linux)", with CFLAGS = -m32 -S, and under all of the optimization levels (O0 through O3), the following is produced :
flds .LC2
fldz
fxch %st(1)
fucompp
fnstsw %ax
:
The FXCH instruction is unnecessary if the FLDS and FLDZ instructions
were ordered in reverse. Why does this type of optimization not take place?
-- Krishna Myneni
