[cfe-dev] -fdenormal-fp-math
Evandro Menezes via cfe-dev
cfe-dev at lists.llvm.org
Thu Mar 9 13:41:00 PST 2017
On 03/09/2017 03:20 PM, Hal Finkel wrote:
>
> On 03/09/2017 03:06 PM, Evandro Menezes via cfe-dev wrote:
>> Can you please clarify if -fdenormal-fp-math is implied by
>> -ffast-math? If not, shouldn't it be?
>
> Why should it be?
It'd make sense, since most targets hiccup when tripping at a denormal,
unless they're commanded to flush them to zero by flipping a bit in a
control register.
>
>> 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).
In GCC, though there's not equivalent option to -fdenormal-fp-math,
IIRC, on some targets using -ffast-math causes the CRT start up code to
enable flushing to zero. Effectively, on these targets, -ffast-math
implies flushing denormals to zero.
Would this GCC behavior, -ffast-math implying -fdenormal-fp-math, be
interesting to carry over to Clang, if not universally, on specific targets?
Thank you,
--
Evandro Menezes
More information about the cfe-dev
mailing list