GCC's -ffast-math behavior
Miles Bader
miles@gnu.org
Fri Feb 10 05:52:00 GMT 2012
xunxun <xunxun1982@gmail.com> writes:
> 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.
I presume you're compiling for i386 32-bit, which defaults to using
the legacy 387 FP unit?
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.
[If you compile for the x86_64 arch, it will default to using SSE FP.]
-miles
--
Guilt, n. The condition of one who is known to have committed an indiscretion,
as distinguished from the state of him who has covered his tracks.
More information about the Gcc-help
mailing list