fastmath generating extra fmull

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have the following lines of code in a critical
section:

  r = x->a / ( r + 1.0 );
  if ( x->lg = ( r > x->ctf ) ) {...}

I get the following asm from g++ 3.3.2 with -O3
-march=pentium4 -ftracer.

My question was on the extra fmull added by the
fast-math version below this dump.  (I added the if to
show that it generates an extra test instruction,
though that's really no biggie.)

fadd	%st(1), %st
fldl	32(%esi)
fxch	%st(1)
movl	%eax, 4(%esi)
fdivrl	16(%esi)
fucomi	%st(1), %st
fstp	%st(1)
seta	%cl
testb	%cl, %cl
movb	%cl, 1(%esi)
je	.L49


Here's the -ffast-math version.  Instead of doing the
divr directly from mem, it first divr's 1.0 and then
does a mull.  Obviously legal, but is it really
"fast-math"?  What is gained here?

fadd	%st(1), %st
fldl	32(%esi)
fxch	%st(1)
movl	%eax, 4(%esi)
fdivr	%st(2), %st
fmull	16(%esi)
fcomi	%st(1), %st
fstp	%st(1)
seta	%cl
testb	%cl, %cl
movb	%cl, 1(%esi)
je	.L49

Thanks,

Ben


	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux