[LLVMdev] Poor floating point optimizations?

Chris Lattner clattner at apple.com
Sat Nov 20 15:17:47 PST 2010


On Nov 20, 2010, at 2:41 PM, Sdadsda Sdasdaas wrote:

> And also the resulting assembly code is very poor:
> 
> 00460013  movss       xmm0,dword ptr [esp+8] 
> 00460019  movaps      xmm1,xmm0 
> 0046001C  addss       xmm1,xmm1 
> 00460020  pxor        xmm2,xmm2 
> 00460024  addss       xmm2,xmm1 
> 00460028  addss       xmm2,xmm0 
> 0046002C  movss       dword ptr [esp],xmm2 
> 00460031  fld         dword ptr [esp] 
> 
> Especially pxor&and instead of movss (which is unnecessary anyway) is just pure 
> madness.

X+0.0 isn't the same as X if X is -0.0.  Have you tried setting 'UnsafeFPMath' in TargetOptions.h?

If you're still having problems, it would be best to indicate more about your configuration, how you're using the llvm tools/libs etc.

-Chris



More information about the llvm-dev mailing list