[libc-commits] [libc] [libc][math] Qualify fdim funtions to constexpr (PR #194137)
Muhammad Bassiouni via libc-commits
libc-commits at lists.llvm.org
Sat Apr 25 13:47:21 PDT 2026
================
@@ -117,10 +126,17 @@ add_or_sub(InType x, InType y) {
// volatile prevents Clang from converting tmp to OutType and then
// immediately back to InType before negating it, resulting in double
// rounding.
- volatile InType tmp = y;
- if constexpr (IsSub)
- tmp = -tmp;
- return cast<OutType>(tmp);
+ if (__builtin_is_constant_evaluated()) {
----------------
bassiounix wrote:
```suggestion
if (cpp::is_constant_evaluated()) {
```
https://github.com/llvm/llvm-project/pull/194137
More information about the libc-commits
mailing list