[llvm-branch-commits] [compiler-rt] release/19.x: [AArch64][SME] Rewrite __arm_sc_memset to remove invalid instruction (#101522) (PR #101938)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Aug 5 01:20:11 PDT 2024


https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/101938

Backport d6649f2

Requested by: @kmclaughlin-arm

>From e8c807eaa338c83f82634cffdb2fa176712e101b Mon Sep 17 00:00:00 2001
From: Kerry McLaughlin <kerry.mclaughlin at arm.com>
Date: Fri, 2 Aug 2024 18:00:59 +0100
Subject: [PATCH] [AArch64][SME] Rewrite __arm_sc_memset to remove invalid
 instruction (#101522)

The implementation of __arm_sc_memset in compiler-rt contains
a Neon dup instruction which is not valid in streaming mode. This
patch rewrites the function, using an SVE mov instruction if available.

(cherry picked from commit d6649f2d4871c4535ae0519920e36100748890c4)
---
 .../lib/builtins/aarch64/sme-libc-mem-routines.S       | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/compiler-rt/lib/builtins/aarch64/sme-libc-mem-routines.S b/compiler-rt/lib/builtins/aarch64/sme-libc-mem-routines.S
index 926ad3b1b6331..0318d9a6f1ebd 100644
--- a/compiler-rt/lib/builtins/aarch64/sme-libc-mem-routines.S
+++ b/compiler-rt/lib/builtins/aarch64/sme-libc-mem-routines.S
@@ -252,7 +252,15 @@ DEFINE_COMPILERRT_FUNCTION_ALIAS(__arm_sc_memmove, __arm_sc_memcpy)
 #define zva_val  x5
 
 DEFINE_COMPILERRT_OUTLINE_FUNCTION_UNMANGLED(__arm_sc_memset)
-        dup     v0.16B, valw
+#ifdef __ARM_FEATURE_SVE
+        mov     z0.b, valw
+#else
+        bfi valw, valw, #8, #8
+        bfi valw, valw, #16, #16
+        bfi val, val, #32, #32
+        fmov d0, val
+        fmov v0.d[1], val
+#endif
         add     dstend2, dstin, count
 
         cmp     count, 96



More information about the llvm-branch-commits mailing list