[compiler-rt] a2ce564 - [compiler-rt][cmake] Test COMPILER_RT_HAS_AARCH64_SME with arm64 (#141115)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 22 15:08:13 PDT 2025


Author: Usama Hameed
Date: 2025-05-22T15:08:10-07:00
New Revision: a2ce5647200ad40ae356affd44db7d054de444d2

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

LOG: [compiler-rt][cmake] Test COMPILER_RT_HAS_AARCH64_SME with arm64 (#141115)

architecture only.

Apple configures CMake only once for compiler-rt, even when building for
multiple architectures. As a result, we need to explicitly test for
arm64 specific attributes by building for that architecture

Added: 
    

Modified: 
    compiler-rt/cmake/Modules/BuiltinTests.cmake
    compiler-rt/cmake/builtin-config-ix.cmake

Removed: 
    


################################################################################
diff  --git a/compiler-rt/cmake/Modules/BuiltinTests.cmake b/compiler-rt/cmake/Modules/BuiltinTests.cmake
index 63c5f47cb5010..093a1c758e278 100644
--- a/compiler-rt/cmake/Modules/BuiltinTests.cmake
+++ b/compiler-rt/cmake/Modules/BuiltinTests.cmake
@@ -134,3 +134,16 @@ function(builtin_check_c_compiler_source output source)
     endif()
   endif()
 endfunction()
+
+function(builtin_check_c_compiler_source_with_flags output source flags)
+  if(NOT DEFINED ${output})
+    message(STATUS "Performing Test ${output}")
+    try_compile_only(result SOURCE ${source} FLAGS ${flags})
+    set(${output} ${result} CACHE INTERNAL "Compiler supports ${output} with ${flags}")
+    if(${result})
+      message(STATUS "Performing Test ${output} - Success")
+    else()
+      message(STATUS "Performing Test ${output} - Failed")
+    endif()
+  endif()
+endfunction()

diff  --git a/compiler-rt/cmake/builtin-config-ix.cmake b/compiler-rt/cmake/builtin-config-ix.cmake
index 8c9c84ad64bc0..c0684ebc519e3 100644
--- a/compiler-rt/cmake/builtin-config-ix.cmake
+++ b/compiler-rt/cmake/builtin-config-ix.cmake
@@ -41,14 +41,14 @@ asm(\".arch armv8-a+lse\");
 asm(\"cas w0, w1, [x2]\");
 ")
 
-builtin_check_c_compiler_source(COMPILER_RT_HAS_AARCH64_SME
+builtin_check_c_compiler_source_with_flags(COMPILER_RT_HAS_AARCH64_SME
 "
 void foo(void)  __arm_streaming_compatible {
   asm(\".arch armv9-a+sme2\\n\"
       \"smstart\\n\"
       \"ldr zt0, [sp]\");
 }
-")
+" "-target aarch64-linux-gnu")
 
 check_include_files("sys/auxv.h"    COMPILER_RT_HAS_AUXV)
 


        


More information about the llvm-commits mailing list