On 2011-12-20 12:48:53 +0100, Dario Saccavino wrote:
In the second program, if 0.5< f< 1 the values of a and b eventually
become the smallest representable denormal value and never change
afterwards, resulting in a large number of operations involving
denormal numbers.
Yes, I agree (I forgot about that)... except that if f is close enough
to 1, you won't have subnormals and the program will be fast (like in
the case f<= 0.5).
gcc enables FTZ when using SSE and ffast-math (I think the specific
compiler flag is -funsafe-math-optimizations).
Thanks, good to know...
Therefore the flags needed are -msse2 -mfpmath=sse -ffast-math
I would discourage the use of -ffast-math, which can affect generic
code very badly (due to -funsafe-math-optimizations). Isn't there
an option to enable FTZ?