[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: GCC's -ffast-math behavior Tim Prince Fri Feb 10 05:01:41 2012

On 2/10/2012 1:39 AM, Miles Bader wrote:
xunxun<[EMAIL PROTECTED]>  writes:
If you switch to using SSE floating-point, e.g. using "-mfpmath=sse",
it will still call the library functions even when using -ffast-math
(because the SSE unit doesn't have special instructions like "fsin" or
"f2xm1").  I think SSE FP is typically faster than the 387 for many
CPUs anyway.

Well, that's right.
But in my experience, -mfpmath=sse will slow my code very much.

Hmm, I've always found SSE FP to be a speedup -- sometimes a _big_
speedup -- over 387 FP, at least when one is using mostly primitive FP
operations (mul, divide, sqrt, etc) ... I think it's worth testing, at

387 code may be faster when you mix float and double, e.g. by forcing double evaluation of float expressions by removing the f suffix from constants. It has been a long time since I had 32-bit OS installed and could examine the broken mathinline.h headers which typically came with them. You would need to fix those before trying -ffast-math.

Tim Prince