[libc-commits] [PATCH] D152280: [libc] Add platform independent floating point rounding mode checks.
Tue Ly via Phabricator via libc-commits
libc-commits at lists.llvm.org
Fri Jun 9 17:58:41 PDT 2023
lntue added inline comments.
================
Comment at: libc/src/__support/FPUtil/FEnvImpl.h:130
+// Quick free standing get rounding mode based on the above observations.
+LIBC_INLINE int quick_get_round() {
+ static volatile float x = 0x1.0p-24f;
----------------
michaelrj wrote:
> I like the idea, but I'd like to have a flag to use the old method as well for targets where we're using `-ffastmath` or other optimizations that might precompute this value unexpectedly.
For math functions, I think it is ok be not correctly rounded in all rounding modes with `-ffastmath`, but ideally, string functions should not be affected by it. On the other hand, `-ffast-math` flags break the floating point standards in many ways, such as flush denormal numbers to 0, so maybe losing the last bit of accuracy in some rounding modes with `-ffast-math` is acceptable?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152280/new/
https://reviews.llvm.org/D152280
More information about the libc-commits
mailing list