[cfe-dev] -fdenormal-fp-math

Evandro Menezes via cfe-dev cfe-dev at lists.llvm.org
Thu Mar 16 11:42:50 PDT 2017


This is a good start.  However, I wonder how the external dependency may 
be eliminated.

Thank you,

-- 
Evandro Menezes

On 03/12/2017 08:52 AM, Hal Finkel via cfe-dev wrote:
>
> On 03/10/2017 08:41 AM, Jonathan 'Rynn' Sauer via cfe-dev wrote:
>> 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
>
> That's a good point. On some systems at least, we link in 
> crtfastmath.o (which might enable flushing denormals) if -ffast-math 
> (or friends) are provided when we're linking.
>
>  -Hal
>
>>
>>> 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
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list