[compiler-rt] [AArch64][compiler-rt] Guard sme-abi-vg.c with !defined(DISABLE_AARCH64_FMV) (PR #94973)

Kerry McLaughlin via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 06:45:43 PDT 2024


https://github.com/kmclaughlin-arm updated https://github.com/llvm/llvm-project/pull/94973

>From f946f33d98b721263ce8fcffa2e32bc5f2094b88 Mon Sep 17 00:00:00 2001
From: Kerry McLaughlin <kerry.mclaughlin at arm.com>
Date: Mon, 10 Jun 2024 12:27:29 +0000
Subject: [PATCH 1/3] [AArch64][compiler-rt] Guard sme-abi-vg.c with
 !defined(DISABLE_AARCH64_FMV)

---
 compiler-rt/lib/builtins/aarch64/sme-abi-vg.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/compiler-rt/lib/builtins/aarch64/sme-abi-vg.c b/compiler-rt/lib/builtins/aarch64/sme-abi-vg.c
index e384ab7f87c46..273f49020079d 100644
--- a/compiler-rt/lib/builtins/aarch64/sme-abi-vg.c
+++ b/compiler-rt/lib/builtins/aarch64/sme-abi-vg.c
@@ -4,6 +4,8 @@
 
 #include "../cpu_model/aarch64.h"
 
+#if !defined(DISABLE_AARCH64_FMV)
+
 struct FEATURES {
   long long features;
 };
@@ -43,3 +45,5 @@ __arm_get_current_vg(void) __arm_streaming_compatible {
 
   return 0;
 }
+
+#endif // !defined(DISABLE_AARCH64_FMV)

>From d952a83903e733785ad7f358befd07fa192bc4a9 Mon Sep 17 00:00:00 2001
From: Kerry McLaughlin <kerry.mclaughlin at arm.com>
Date: Mon, 10 Jun 2024 15:17:21 +0000
Subject: [PATCH 2/3] - Add a cmake warning for enabling SME without FMV
 support.

---
 compiler-rt/lib/builtins/CMakeLists.txt | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index 0b9e9bd7a2956..b52125a52c1c3 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -562,9 +562,13 @@ set(aarch64_SOURCES
 )
 
 if(COMPILER_RT_HAS_AARCH64_SME AND COMPILER_RT_HAS_FNO_BUILTIN_FLAG AND (COMPILER_RT_HAS_AUXV OR COMPILER_RT_BAREMETAL_BUILD))
-  list(APPEND aarch64_SOURCES aarch64/sme-abi.S aarch64/sme-abi-init.c aarch64/sme-abi-vg.c aarch64/sme-libc-routines.c)
-  message(STATUS "AArch64 SME ABI routines enabled")
-  set_source_files_properties(aarch64/sme-libc-routines.c PROPERTIES COMPILE_FLAGS "-fno-builtin")
+  if(COMPILER_RT_DISABLE_AARCH64_FMV)
+    message(WARNING "AArch64 SME ABI routines require function multiversioning support.")
+  else()
+    list(APPEND aarch64_SOURCES aarch64/sme-abi.S aarch64/sme-abi-init.c aarch64/sme-abi-vg.c aarch64/sme-libc-routines.c)
+    message(STATUS "AArch64 SME ABI routines enabled")
+    set_source_files_properties(aarch64/sme-libc-routines.c PROPERTIES COMPILE_FLAGS "-fno-builtin")
+  endif()
 else()
   message(STATUS "AArch64 SME ABI routines disabled")
 endif()

>From ed21402d1c4c64e5062c1176e262dd7daacc331c Mon Sep 17 00:00:00 2001
From: Kerry McLaughlin <kerry.mclaughlin at arm.com>
Date: Tue, 11 Jun 2024 12:59:00 +0000
Subject: [PATCH 3/3] - Extend warnings in builtins/CMakeLists.txt to cover
 other requirements   for building the AArch64 SME ABI routines.

---
 compiler-rt/lib/builtins/CMakeLists.txt | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index b52125a52c1c3..6778ae1c35263 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -561,16 +561,23 @@ set(aarch64_SOURCES
   aarch64/fp_mode.c
 )
 
-if(COMPILER_RT_HAS_AARCH64_SME AND COMPILER_RT_HAS_FNO_BUILTIN_FLAG AND (COMPILER_RT_HAS_AUXV OR COMPILER_RT_BAREMETAL_BUILD))
-  if(COMPILER_RT_DISABLE_AARCH64_FMV)
-    message(WARNING "AArch64 SME ABI routines require function multiversioning support.")
-  else()
+if (COMPILER_RT_HAS_AARCH64_SME)
+  if (NOT COMPILER_RT_DISABLE_AARCH64_FMV AND COMPILER_RT_HAS_FNO_BUILTIN_FLAG AND (COMPILER_RT_HAS_AUXV OR COMPILER_RT_BAREMETAL_BUILD))
     list(APPEND aarch64_SOURCES aarch64/sme-abi.S aarch64/sme-abi-init.c aarch64/sme-abi-vg.c aarch64/sme-libc-routines.c)
     message(STATUS "AArch64 SME ABI routines enabled")
     set_source_files_properties(aarch64/sme-libc-routines.c PROPERTIES COMPILE_FLAGS "-fno-builtin")
+  else()
+    if(COMPILER_RT_DISABLE_AARCH64_FMV)
+      message(WARNING "AArch64 SME ABI routines require function multiversioning support.")
+    endif()
+    if(NOT COMPILER_RT_HAS_FNO_BUILTIN_FLAG)
+      message(WARNING "AArch64 SME ABI routines require '-fno-builtin'")
+    endif()
+    if(NOT (COMPILER_RT_HAS_AUXV OR COMPILER_RT_BAREMETAL_BUILD))
+      message(WARNING "AArch64 SME ABI routines requires sys/auxv.h or COMPILER_RT_BAREMETAL_BUILD flag")
+    endif()
+    message(STATUS "AArch64 SME ABI routines disabled")
   endif()
-else()
-  message(STATUS "AArch64 SME ABI routines disabled")
 endif()
 
 # Generate outline atomics helpers from lse.S base



More information about the llvm-commits mailing list