master: Replace a MUL with USHL

stassats via Sbcl-commits <[email protected]> Thu, 16 Jul 2026 01:50:13 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  3025a181b090b2ce78847faa0af555f2a829effe (commit)
      from  0e34c1c4a85d5edea2efb0cd9f583ef17f8017dd (commit)

- Log -----------------------------------------------------------------
commit 3025a181b090b2ce78847faa0af555f2a829effe
Author: Stas Boukarev <[email protected]>
Date:   Thu Jul 16 04:45:53 2026 +0300

    Replace a MUL with USHL
---
 src/code/arm64-simd.lisp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/code/arm64-simd.lisp b/src/code/arm64-simd.lisp
index eee49e6d4..e689332b2 100644
--- a/src/code/arm64-simd.lisp
+++ b/src/code/arm64-simd.lisp
@@ -1957,7 +1957,7 @@
                        ((shuf-mask complex-double-reg t :offset 6))
                        ((and-mask complex-double-reg t :offset 7))
                        ((orr-mask complex-double-reg t :offset 8))
-                       ((mul-mask complex-double-reg t))
+                       ((shift-mask complex-double-reg t))
                        ((c-10000 complex-double-reg t))
                        ((c-800 complex-double-reg t))
                        ((c-80-4s complex-double-reg t)))
@@ -2108,8 +2108,9 @@
 
                      (inst addv r4 temp :4s) ;; total length in utf-8 bytes - 4
 
-                     ;; Multiply by 1 4 16 64, getting a shifted two-bit mask for each lane
-                     (inst mul temp mul-mask temp :4s)
+                     ;; Shift by 0 2 4 6
+                     (inst ushl temp temp shift-mask :4s)
+                     ;; combine into an 8-bit mask, 2 bits per lane
                      (inst addv temp temp :4s)
                      (inst umov tmp temp 0 :b)
 
@@ -2154,7 +2155,7 @@
                 (inst b DONE)
 
                 START-FULL-LENGTH
-                (load-inline-constant mul-mask :oword #x40000000100000000400000001)
+                (load-inline-constant shift-mask :oword #x6000000040000000200000000)
                 (inst movi c-10000 #x10000 :4s)
                 (inst movi c-800 #x800 :4s)
                 (inst movi c-80-4s #x80 :4s)

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL