[libc] [llvm] [libc][fenv] Refactor x86 fenv implementations to make it work for various fenv_t. (PR #165015)

James Y Knight via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 7 09:49:18 PST 2025


================
@@ -9,642 +9,244 @@
 #ifndef LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_FENVIMPL_H
 #define LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_FENVIMPL_H
 
+#include "hdr/fenv_macros.h"
+#include "hdr/stdint_proxy.h"
+#include "hdr/types/fenv_t.h"
+#include "src/__support/CPP/bit.h"
 #include "src/__support/macros/attributes.h" // LIBC_INLINE
 #include "src/__support/macros/config.h"
+#include "src/__support/macros/optimization.h"
 #include "src/__support/macros/properties/architectures.h"
+#include "src/__support/macros/properties/compiler.h"
+#include "src/__support/macros/properties/types.h"
 
 #if !defined(LIBC_TARGET_ARCH_IS_X86)
 #error "Invalid include"
 #endif
 
-#include "hdr/stdint_proxy.h"
-#include "hdr/types/fenv_t.h"
-#include "src/__support/macros/sanitizer.h"
+#if (defined(__i386__) && !defined(__SSE__)) ||                                \
+    (defined(_M_IX86_FP) && (_M_IX86_FP == 0))
+// When SSE is not available, we will only touch x87 floating point environment.
----------------
jyknight wrote:

Why do we have an x87-only mode? Does someone actually want to use llvm-libc on a 32-bit x86 machine that lacks SSE2 (e.g., Pentium 3 or older)?

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


More information about the llvm-commits mailing list