[libc-commits] [libc] 6899f03 - [libc] Check if arm targets support FPSCR in FEnvImpl.h. (#72158)

via libc-commits libc-commits at lists.llvm.org
Mon Nov 13 15:32:46 PST 2023


Author: lntue
Date: 2023-11-13T18:32:42-05:00
New Revision: 6899f035aea8d6699e4e84163201e34c23b2fb5d

URL: https://github.com/llvm/llvm-project/commit/6899f035aea8d6699e4e84163201e34c23b2fb5d
DIFF: https://github.com/llvm/llvm-project/commit/6899f035aea8d6699e4e84163201e34c23b2fb5d.diff

LOG: [libc] Check if arm targets support FPSCR in FEnvImpl.h. (#72158)

https://github.com/llvm/llvm-project/issues/72157

Added: 
    

Modified: 
    libc/src/__support/FPUtil/CMakeLists.txt
    libc/src/__support/FPUtil/FEnvImpl.h
    libc/src/__support/FPUtil/arm/FEnvImpl.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/FPUtil/CMakeLists.txt b/libc/src/__support/FPUtil/CMakeLists.txt
index 6b43a9fa4892fe8..e19d8fc4aa9a08f 100644
--- a/libc/src/__support/FPUtil/CMakeLists.txt
+++ b/libc/src/__support/FPUtil/CMakeLists.txt
@@ -6,6 +6,8 @@ add_header_library(
     libc.include.fenv
     libc.include.math
     libc.src.__support.macros.attributes
+    libc.src.__support.macros.config
+    libc.src.errno.errno
 )
 
 add_header_library(

diff  --git a/libc/src/__support/FPUtil/FEnvImpl.h b/libc/src/__support/FPUtil/FEnvImpl.h
index 6f2f3c75f512a3e..619f6a0a91c4c7e 100644
--- a/libc/src/__support/FPUtil/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/FEnvImpl.h
@@ -10,6 +10,7 @@
 #define LLVM_LIBC_SRC___SUPPORT_FPUTIL_FENVIMPL_H
 
 #include "src/__support/macros/attributes.h" // LIBC_INLINE
+#include "src/__support/macros/config.h"     // LIBC_HAS_BUILTIN
 #include "src/__support/macros/properties/architectures.h"
 #include "src/errno/libc_errno.h"
 
@@ -28,7 +29,8 @@
 // the apple condition here should be removed.
 #elif defined(LIBC_TARGET_ARCH_IS_X86) && !defined(__APPLE__)
 #include "x86_64/FEnvImpl.h"
-#elif defined(LIBC_TARGET_ARCH_IS_ARM)
+#elif defined(LIBC_TARGET_ARCH_IS_ARM) &&                                      \
+    LIBC_HAS_BUILTIN(__builtin_arm_get_fpscr)
 #include "arm/FEnvImpl.h"
 #elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
 #include "riscv/FEnvImpl.h"

diff  --git a/libc/src/__support/FPUtil/arm/FEnvImpl.h b/libc/src/__support/FPUtil/arm/FEnvImpl.h
index e2669d13bc2a7c2..dcc560286472278 100644
--- a/libc/src/__support/FPUtil/arm/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/arm/FEnvImpl.h
@@ -10,7 +10,7 @@
 #define LLVM_LIBC_SRC___SUPPORT_FPUTIL_ARM_FENVIMPL_H
 
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/macros/config.h" // For LIBC_INLINE
+#include "src/__support/macros/attributes.h" // For LIBC_INLINE
 
 #include <fenv.h>
 #include <stdint.h>


        


More information about the libc-commits mailing list