[clang] [AArch64] Add missing ACLE predefined macros and update __ARM_ACLE. (PR #108857)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 16 09:56:51 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang

@llvm/pr-subscribers-backend-aarch64

Author: Alexandros Lamprineas (labrinea)

<details>
<summary>Changes</summary>

Adds __ARM_ACLE_VERSION and __FUNCTION_MULTI_VERSIONING_SUPPORT_LEVEL as defined here https://github.com/ARM-software/acle/pull/301 and here https://github.com/ARM-software/acle/pull/302.

Also bumps __ARM_ACLE to 202420.

---
Full diff: https://github.com/llvm/llvm-project/pull/108857.diff


3 Files Affected:

- (modified) clang/lib/Basic/Targets/AArch64.cpp (+8-1) 
- (modified) clang/test/Preprocessor/aarch64-target-features.c (-1) 
- (modified) clang/test/Preprocessor/init-aarch64.c (+12-3) 


``````````diff
diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp
index 63fc15f916c558..9c7fb5d475ef45 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -399,7 +399,14 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts,
   Builder.defineMacro("__AARCH64_CMODEL_" + CodeModel + "__");
 
   // ACLE predefines. Many can only have one possible value on v8 AArch64.
-  Builder.defineMacro("__ARM_ACLE", "200");
+  Builder.defineMacro("__ARM_ACLE_VERSION(year, quarter, patch)",
+                      "100 * (year) + 10 * (quarter) + (patch)");
+#define __ARM_ACLE_VERSION(Y, Q, P) 100 * (Y) + 10 * (Q) + (P)
+  Builder.defineMacro("__ARM_ACLE",
+                      std::to_string(__ARM_ACLE_VERSION(2024, 2, 0)));
+  Builder.defineMacro("__FUNCTION_MULTI_VERSIONING_SUPPORT_LEVEL",
+                      std::to_string(__ARM_ACLE_VERSION(2024, 2, 0)));
+#undef __ARM_ACLE_VERSION
   Builder.defineMacro("__ARM_ARCH",
                       std::to_string(ArchInfo->Version.getMajor()));
   Builder.defineMacro("__ARM_ARCH_PROFILE",
diff --git a/clang/test/Preprocessor/aarch64-target-features.c b/clang/test/Preprocessor/aarch64-target-features.c
index ae2bdda6f536c5..bcc0640c55e35a 100644
--- a/clang/test/Preprocessor/aarch64-target-features.c
+++ b/clang/test/Preprocessor/aarch64-target-features.c
@@ -4,7 +4,6 @@
 // CHECK: __AARCH64EL__ 1
 // CHECK: __ARM_64BIT_STATE 1
 // CHECK-NOT: __ARM_32BIT_STATE
-// CHECK: __ARM_ACLE 200
 // CHECK: __ARM_ALIGN_MAX_STACK_PWR 4
 // CHECK: __ARM_ARCH 8
 // CHECK: __ARM_ARCH_ISA_A64 1
diff --git a/clang/test/Preprocessor/init-aarch64.c b/clang/test/Preprocessor/init-aarch64.c
index 81c9a66f137512..e4fde357b83f92 100644
--- a/clang/test/Preprocessor/init-aarch64.c
+++ b/clang/test/Preprocessor/init-aarch64.c
@@ -12,7 +12,8 @@
 // AARCH64_LE-NEXT: #define __AARCH64EL__ 1
 // AARCH64_LE-NEXT: #define __AARCH64_CMODEL_SMALL__ 1
 // AARCH64-NEXT: #define __ARM_64BIT_STATE 1
-// AARCH64-NEXT: #define __ARM_ACLE 200
+// AARCH64-NEXT: #define __ARM_ACLE 202420
+// AARCH64-NEXT: #define __ARM_ACLE_VERSION(year,quarter,patch) 100 * (year) + 10 * (quarter) + (patch)
 // AARCH64-NEXT: #define __ARM_ALIGN_MAX_STACK_PWR 4
 // AARCH64-NEXT: #define __ARM_ARCH 8
 // AARCH64-NEXT: #define __ARM_ARCH_ISA_A64 1
@@ -121,6 +122,7 @@
 // AARCH64-NEXT: #define __FPCLASS_SNAN 0x0001
 // AARCH64-NEXT: #define __FP_FAST_FMA 1
 // AARCH64-NEXT: #define __FP_FAST_FMAF 1
+// AARCH64-NEXT: #define __FUNCTION_MULTI_VERSIONING_SUPPORT_LEVEL 202420
 // AARCH64-NEXT: #define __GCC_ASM_FLAG_OUTPUTS__ 1
 // AARCH64-NEXT: #define __GCC_CONSTRUCTIVE_SIZE {{.+}}
 // AARCH64-NEXT: #define __GCC_DESTRUCTIVE_SIZE {{.+}}
@@ -393,6 +395,8 @@
 // AARCH64-DARWIN: #define __AARCH64EL__ 1
 // AARCH64-DARWIN-NOT: #define __AARCH_BIG_ENDIAN 1
 // AARCH64-DARWIN: #define __ARM_64BIT_STATE 1
+// AARCH64-DARWIN: #define __ARM_ACLE 202420
+// AARCH64-DARWIN: #define __ARM_ACLE_VERSION(year,quarter,patch) 100 * (year) + 10 * (quarter) + (patch)
 // AARCH64-DARWIN: #define __ARM_ARCH 8
 // AARCH64-DARWIN: #define __ARM_ARCH_ISA_A64 1
 // AARCH64-DARWIN-NOT: #define __ARM_BIG_ENDIAN 1
@@ -429,6 +433,7 @@
 // AARCH64-DARWIN: #define __FLT_MIN_EXP__ (-125)
 // AARCH64-DARWIN: #define __FLT_MIN__ 1.17549435e-38F
 // AARCH64-DARWIN: #define __FLT_RADIX__ 2
+// AARCH64-DARWIN: #define __FUNCTION_MULTI_VERSIONING_SUPPORT_LEVEL 202420
 // AARCH64-DARWIN: #define __INT16_C_SUFFIX__
 // AARCH64-DARWIN: #define __INT16_FMTd__ "hd"
 // AARCH64-DARWIN: #define __INT16_FMTi__ "hi"
@@ -588,7 +593,8 @@
 // AARCH64-MSVC: #define _WIN64 1
 // AARCH64-MSVC: #define __AARCH64EL__ 1
 // AARCH64-MSVC: #define __ARM_64BIT_STATE 1
-// AARCH64-MSVC: #define __ARM_ACLE 200
+// AARCH64-MSVC: #define __ARM_ACLE 202420
+// AARCH64-MSVC: #define __ARM_ACLE_VERSION(year,quarter,patch) 100 * (year) + 10 * (quarter) + (patch)
 // AARCH64-MSVC: #define __ARM_ALIGN_MAX_STACK_PWR 4
 // AARCH64-MSVC: #define __ARM_ARCH 8
 // AARCH64-MSVC: #define __ARM_ARCH_ISA_A64 1
@@ -644,6 +650,7 @@
 // AARCH64-MSVC: #define __FLT_MIN_EXP__ (-125)
 // AARCH64-MSVC: #define __FLT_MIN__ 1.17549435e-38F
 // AARCH64-MSVC: #define __FLT_RADIX__ 2
+// AARCH64-MSVC: #define __FUNCTION_MULTI_VERSIONING_SUPPORT_LEVEL 202420
 // AARCH64-MSVC: #define __INT_MAX__ 2147483647
 // AARCH64-MSVC: #define __LDBL_DECIMAL_DIG__ 17
 // AARCH64-MSVC: #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
@@ -750,7 +757,8 @@
 // ARM64EC-MSVC: #define __AARCH64EL__ 1
 // ARM64EC-MSVC: #define __AARCH64_CMODEL_SMALL__ 1
 // ARM64EC-MSVC: #define __ARM_64BIT_STATE 1
-// ARM64EC-MSVC: #define __ARM_ACLE 200
+// ARM64EC-MSVC: #define __ARM_ACLE 202420
+// ARM64EC-MSVC: #define __ARM_ACLE_VERSION(year,quarter,patch) 100 * (year) + 10 * (quarter) + (patch)
 // ARM64EC-MSVC: #define __ARM_ALIGN_MAX_STACK_PWR 4
 // ARM64EC-MSVC: #define __ARM_ARCH 8
 // ARM64EC-MSVC: #define __ARM_ARCH_ISA_A64 1
@@ -850,6 +858,7 @@
 // ARM64EC-MSVC: #define __FPCLASS_SNAN 0x0001
 // ARM64EC-MSVC: #define __FP_FAST_FMA 1
 // ARM64EC-MSVC: #define __FP_FAST_FMAF 1
+// ARM64EC-MSVC: #define __FUNCTION_MULTI_VERSIONING_SUPPORT_LEVEL 202420
 // ARM64EC-MSVC: #define __GCC_ASM_FLAG_OUTPUTS__ 1
 // ARM64EC-MSVC: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
 // ARM64EC-MSVC: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 1

``````````

</details>


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


More information about the cfe-commits mailing list