From e0b121ce26bb3146f7336325f33ce3070eaa6b0c Mon Sep 17 00:00:00 2001 From: Amara Emerson Date: Fri, 3 Jan 2025 22:01:34 -0800 Subject: [PATCH] [AArch64][SME] Fix broken compiler check for SME2 support in compiler-rt. This compile time test uses inline asm with .arch directives to set the target feature. It is however broken and always fails, since each asm() construct in LLVM sets up a new AsmParser, and therefore the .arch directive has no effect on later asm() contents. To fix this we need to use a single inline asm() call with the entire code chunk to emit contained inside. --- compiler-rt/cmake/builtin-config-ix.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler-rt/cmake/builtin-config-ix.cmake b/compiler-rt/cmake/builtin-config-ix.cmake index 706a1ff7eeb6d..b1bde47ec8555 100644 --- a/compiler-rt/cmake/builtin-config-ix.cmake +++ b/compiler-rt/cmake/builtin-config-ix.cmake @@ -43,9 +43,9 @@ asm(\"cas w0, w1, [x2]\"); builtin_check_c_compiler_source(COMPILER_RT_HAS_AARCH64_SME " void foo(void) __arm_streaming_compatible { - asm(\".arch armv9-a+sme2\"); - asm(\"smstart\"); - asm(\"ldr zt0, [sp]\"); + asm(\".arch armv9-a+sme2\\n\" + \"smstart\\n\" + \"ldr zt0, [sp]\"); } ")