[libc-commits] [libc] [libc] Prevent constant propagation for atanf(+-Inf) in gcc. (PR #85733)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue Mar 19 08:53:51 PDT 2024


nickdesaulniers wrote:

https://lemire.me/blog/2022/11/16/a-fast-function-to-check-your-floating-point-rounding-mode/ also recommends the use of `volatile`. So does https://www.ibm.com/docs/en/xl-c-and-cpp-linux/11.1.0?topic=rounding-matching-compile-time-runtime-modes.

Looks like Hans Boehm wrote a paper on this issue (C++26): https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2746r0.pdf

There's an old clang PR that never landed for a pragma to adjust this behavior at compile time: https://reviews.llvm.org/D125625

You might want to speak with Hans and ask him what the current state of that proposal is.

Another approach, would it be possible to have another array similar to `SIGNED_PI_OVER_2` but of floats with different values pre-rounded a certain way to avoid needing `volatile`? Or is it literally that calling `atanf` for the same input with different rounding modes is expected to produce different results?

https://github.com/llvm/llvm-project/pull/85733


More information about the libc-commits mailing list