[cfe-dev] -fdenormal-fp-math
Jonathan 'Rynn' Sauer via cfe-dev
cfe-dev at lists.llvm.org
Fri Mar 10 06:41:58 PST 2017
Hello,
>> Does the start-up code, if any, perhaps in compiler-rt, enable the appropriate bits in the proper control register? How can I help?
>
> No. Right now, I believe that flag is taken as a statement about what the compiler can assume about the FP environment. It is not something we attempt to ensure at startup. I imagine we could on some systems (as you say, by using some startup code).
There is a PR related to this: https://bugs.llvm.org//show_bug.cgi?id=14024
> clang does not set DAZ flag in -ffast-math mode
>As can be seen the gcc produced binary is a lot faster than clang in -ffast-mode (besides being a little bit faster in general). This is not caused by better optimizations, but because gcc links in a small function into the resulting binary, which sets the DAZ register.
>DAZ tells the CPU to force all Denormals to zero. A Denormal is a number that is so small that FPU can't renormalize it due to limited exponent ranges. They're just like normal numbers, but they take considerably longer to process. Note that not all processors support DAZ.
CU,
Jonathan
More information about the cfe-dev
mailing list