[libc-commits] [libc] [libc] Check if arm targets support FPSCR in FEnvImpl.h. (PR #72158)
via libc-commits
libc-commits at lists.llvm.org
Mon Nov 13 14:40:46 PST 2023
https://github.com/lntue updated https://github.com/llvm/llvm-project/pull/72158
>From 5cb960cd149ddf9454e5d67dec2e4f7873702362 Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue at google.com>
Date: Mon, 13 Nov 2023 15:42:08 -0500
Subject: [PATCH 1/2] [libc] Check if arm targets support FPSCR in FEnvImpl.h.
---
libc/src/__support/FPUtil/FEnvImpl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/src/__support/FPUtil/FEnvImpl.h b/libc/src/__support/FPUtil/FEnvImpl.h
index 6f2f3c75f512a3e..12f8a66508111fd 100644
--- a/libc/src/__support/FPUtil/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/FEnvImpl.h
@@ -28,7 +28,7 @@
// 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) && __has_builtin(__builtin_arm_get_fpscr)
#include "arm/FEnvImpl.h"
#elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
#include "riscv/FEnvImpl.h"
>From 0947cdd710963ba817b9ca2fcc9b8a0246a91ed1 Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue at google.com>
Date: Mon, 13 Nov 2023 17:39:52 -0500
Subject: [PATCH 2/2] Use LIBC_HAS_BUILTIN macro.
---
libc/src/__support/FPUtil/CMakeLists.txt | 2 ++
libc/src/__support/FPUtil/FEnvImpl.h | 4 +++-
libc/src/__support/FPUtil/arm/FEnvImpl.h | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
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 12f8a66508111fd..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) && __has_builtin(__builtin_arm_get_fpscr)
+#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