From f946f33d98b721263ce8fcffa2e32bc5f2094b88 Mon Sep 17 00:00:00 2001 From: Kerry McLaughlin Date: Mon, 10 Jun 2024 12:27:29 +0000 Subject: [PATCH 1/4] [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 e384ab7f87c464..273f49020079d6 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 Date: Mon, 10 Jun 2024 15:17:21 +0000 Subject: [PATCH 2/4] - 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 0b9e9bd7a2956e..b52125a52c1c3c 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 Date: Tue, 11 Jun 2024 12:59:00 +0000 Subject: [PATCH 3/4] - 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 b52125a52c1c3c..6778ae1c352633 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 From 3734ab0e3a2dc70177198c0bcd993f99d105b846 Mon Sep 17 00:00:00 2001 From: Kerry McLaughlin Date: Tue, 11 Jun 2024 16:39:37 +0000 Subject: [PATCH 4/4] - Remove !defined(DISABLE_AARCH64_FMV) guard from sme-abi-vg.c --- compiler-rt/lib/builtins/aarch64/sme-abi-vg.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/compiler-rt/lib/builtins/aarch64/sme-abi-vg.c b/compiler-rt/lib/builtins/aarch64/sme-abi-vg.c index 273f49020079d6..e384ab7f87c464 100644 --- a/compiler-rt/lib/builtins/aarch64/sme-abi-vg.c +++ b/compiler-rt/lib/builtins/aarch64/sme-abi-vg.c @@ -4,8 +4,6 @@ #include "../cpu_model/aarch64.h" -#if !defined(DISABLE_AARCH64_FMV) - struct FEATURES { long long features; }; @@ -45,5 +43,3 @@ __arm_get_current_vg(void) __arm_streaming_compatible { return 0; } - -#endif // !defined(DISABLE_AARCH64_FMV)