[compiler-rt] 149f91b - [compiler-rt][AArch64] Don't use x18 in __arm_sme_save (#157802)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 12 08:20:20 PDT 2025


Author: Sander de Smalen
Date: 2025-09-12T16:20:16+01:00
New Revision: 149f91bad66972ad8bf0add5c79bf74055f6905a

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

LOG: [compiler-rt][AArch64] Don't use x18 in __arm_sme_save (#157802)

The AAPCS recommends avoiding the use of x18 as it may be used for other
purposes such as a shadow call stack.

In this particular case it could just as well use x16 instead.

Added: 
    

Modified: 
    compiler-rt/lib/builtins/aarch64/sme-abi.S

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/aarch64/sme-abi.S b/compiler-rt/lib/builtins/aarch64/sme-abi.S
index d5510ac0cfa50..1713a5969459a 100644
--- a/compiler-rt/lib/builtins/aarch64/sme-abi.S
+++ b/compiler-rt/lib/builtins/aarch64/sme-abi.S
@@ -280,17 +280,17 @@ DEFINE_COMPILERRT_FUNCTION(__arm_sme_save)
   mov     w16, #1
   str     x16, [x0]
 
-  add     x18, x0, #32
+  add     x16, x0, #32
   tbz     x17, #FEAT_SME2_BIT, 1f
 
   // Store ZT0
-  str     zt0, [x18]
-  add     x18, x18, #64
+  str     zt0, [x16]
+  add     x16, x16, #64
 
 1:
-  // Set up lazy-save (x18 = pointer to buffer)
+  // Set up lazy-save (x16 = pointer to buffer)
   rdsvl   x17, #1
-  str     x18, [x0, #16]!
+  str     x16, [x0, #16]!
   strh    w17, [x0, #8]
   strh    wzr, [x0, #10]
   str     wzr, [x0, #12]


        


More information about the llvm-commits mailing list