[libc-commits] [libc] [libc][FPUtil] Make hardware helpers usable in constant expressions (PR #242283)

Muhammad Bassiouni via libc-commits libc-commits at lists.llvm.org
Sat Nov 14 10:22:51 PST 2026


================
@@ -112,14 +118,16 @@ LIBC_INLINE int set_env(const fenv_t *env) {
 // the dummy implementations below. Once a proper x86_64 darwin fenv is set up,
 // the apple condition here should be removed.
 // TODO: fully support fenv for MSVC.
-#elif defined(LIBC_TARGET_ARCH_IS_X86) && !defined(__APPLE__)
+#elif defined(LIBC_TARGET_ARCH_IS_X86) && !defined(__APPLE__) &&               \
+    !defined(LIBC_USE_CONSTEXPR)
 #include "src/__support/FPUtil/x86_64/FEnvImpl.h"
 #elif defined(LIBC_TARGET_ARCH_IS_ARM) && defined(__ARM_FP) &&                 \
-    !defined(LIBC_COMPILER_IS_MSVC)
+    !defined(LIBC_COMPILER_IS_MSVC) && !defined(LIBC_USE_CONSTEXPR)
 #include "src/__support/FPUtil/arm/FEnvImpl.h"
-#elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV) && defined(__riscv_flen)
+#elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV) && defined(__riscv_flen) &&       \
+    !defined(LIBC_USE_CONSTEXPR)
 #include "src/__support/FPUtil/riscv/FEnvImpl.h"
-#elif defined(LIBC_TARGET_ARCH_IS_HEXAGON)
+#elif defined(LIBC_TARGET_ARCH_IS_HEXAGON) && !defined(LIBC_USE_CONSTEXPR)
 #include "src/__support/FPUtil/hexagon/FEnvImpl.h"
----------------
bassiounix wrote:

guarding the imports here with `LIBC_USE_CONSTEXPR` doesn't make sense

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


More information about the libc-commits mailing list