GCC's -ffast-math behavior
xunxun
xunxun1982@gmail.com
Thu Feb 9 10:45:00 GMT 2012
äº 2012/2/9 18:35, xunxun åé:
> äº 2012/2/9 18:29, Andrew Haley åé:
>> On 02/09/2012 10:20 AM, xunxun wrote:
>>> I use the code main.c (test sin speed)
>>>
>>> On Win7 64bit, gcc 4.6.2 32bit
>>>
>>> gcc -O3 -ffast-math main.c -o main.exe
>>>
>>> run main.exe will cost 6.853s.
>>>
>>> When linking with intel libM no fastmath
>>>
>>> gcc -O3 main.c -o main.exe libmmt.lib libircmt.lib
>>>
>>> run main.exe will cost 4.367s.
>> Ah okay, I get it now, its sin, not exp. I suspect that it's the
>> argument reduction step that's slowing you down.
>>
>> Andrew.
>>
> I think so. I don't know whether I may change main.c 's sin to exp
>
> It will be also slow.
>
And I think it's related with -funsafe-math-optimizations
If I only use the option, gcc also don't generate the symbol
The fastmath other option
-fno-math-errno, -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans, and -fcx-limited-range
don't have the effect.
--
Best Regards,
xunxun
More information about the Gcc-help
mailing list