This adds options -fexceptions-fp-math and -fdenormal-fp-math, which are translated to function attributes. This is intended to be mapped on build attributes FP_exceptions and FP_denormal. Setting these build attributes allows better selection of floating point libraries.
Details
- Reviewers
rengolin jmolloy sanjoy • ddunbar - Commits
- rG0a8d4216ad52: This adds new options -fdenormal-fp-math and passes through option -ffast-math…
rC280064: This adds new options -fdenormal-fp-math and passes through option -ffast-math
rL280064: This adds new options -fdenormal-fp-math and passes through option -ffast-math
Diff Detail
- Repository
- rL LLVM
Event Timeline
Hi Sjoerd,
These make sense - we currently lack any way to inform the backend of the user's FP strictness requirements for exceptions and denormals which forces us to be conservative in the backend build attribute generation.
Your new -fno-exceptions-fp-math appears to be the same as GCC's "-ftrapping-math" which we already implement in the Driver. In fact, it looks like this code never passes -ftrapping-math through to CC1; it only uses it to determine if -menable-unsafe-fpmath should be set.
Therefore I think passing -ftrapping-math through to CC1 is the right thing here.
It seems to me that GCC doesn't have an equivalent flag to -fdenormal-fp-math, so inventing a flag sounds like the right thing to do. This patch should provide a docs patch for http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation , which is generated from docs/UsersManual.rst.
Cheers,
James
Hi James,
Thanks for the review. I got rid of that new option -fexceptions-fp-math and now use -ftrapping-math for that which indeed was not passed through to CC1.
Cheers.
Hi Sjoerd,
This still needs a docs patch. I'd also really appreciate someone else to help sign this off - While it looks fine, I don't commit enough to clang to give the go-ahead.
Cheers,
James
Hi James,
Also looks good to me, though it need docs (in the same patch).
Is there an LLVM counter part to this patch? Where is this going to be used?
From the fact that trapping-math wasn't passed down, its documentation may be missing/outdated/wrong, and probably nothing down the pipe is using it either. What are the plans for that?
cheers,
--renato
Sorry, forgot to add the doc patch, but it has been included now.
This will be used in llvm to emit and appropriately set build attributes ABI_FP_denormal and ABI_FP_exceptions. I am now trying to get a llvm patch ready for that (not uploaded yet, but it will mainly affect only ARMAsmPrinter.cpp and perhaps TargetOptions to query buildattributes).