[Bug target/17390] missing floating point compare optimization
uros at kss-loka dot si
gcc-bugzilla@gcc.gnu.org
Wed Jan 18 09:50:00 GMT 2006
------- Comment #8 from uros at kss-loka dot si 2006-01-18 09:50 -------
(In reply to comment #7)
> Hmm, I get (but that looks like different branch predictions):
It looks that your default is -mtune=pentium.
> _testf:
> fldl 4(%esp)
> ftst
> fnstsw %ax
> testb $64, %ah
> jne L10
> ftst
> fnstsw %ax
> fstp %st(0)
> testb $69, %ah
> jne L5
> fld1
> ret
> .align 2,0x90
> L10:
> fstp %st(0)
> fldz
> ret
> L5:
> flds LC2
> ret
With proposed patch, this code is compiled to (-O2 -ffast-math -mtune=pentium
-fomit-frame-pointer):
testf:
fldl 4(%esp)
ftst
fnstsw %ax
fstp %st(0)
testb $64, %ah
jne .L10
testb $69, %ah
jne .L5
fld1
ret
.p2align 4,,7
.L10:
fldz
ret
.L5:
flds .LC2
ret
and for -mtune=i686:
testf:
fldl 4(%esp)
ftst
fnstsw %ax
fstp %st(0)
sahf
je .L10
jbe .L5
fld1
ret
.p2align 4,,7
.L10:
fldz
.p2align 4,,8
ret
.L5:
flds .LC2
.p2align 4,,4
ret
BTW: I'll attach a patch, rediffed to current SVN.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17390
More information about the Gcc-bugs
mailing list