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

via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 9 08:14:15 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.
----------------
lntue wrote:

I guess just for completeness, and the x87_only part is isolated and simple enough?

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


More information about the llvm-commits mailing list