master: Remove a couple of instructions

stassats via Sbcl-commits <[email protected]> Sat, 04 Jul 2026 02:55:00 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  d0d9c0df6fc8f022b68149a41deef4509d09948e (commit)
      from  a238aa5c912b663bb24007154db7a832d91b526a (commit)

- Log -----------------------------------------------------------------
commit d0d9c0df6fc8f022b68149a41deef4509d09948e
Author: Stas Boukarev <[email protected]>
Date:   Sat Jul 4 05:54:29 2026 +0300

    Remove a couple of instructions
---
 src/code/arm64-simd.lisp             | 15 ++++++---------
 src/compiler/arm64/insts.lisp        | 10 +++++++---
 src/compiler/arm64/target-insts.lisp | 12 ++++++++++--
 3 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/src/code/arm64-simd.lisp b/src/code/arm64-simd.lisp
index f36f72bb6..4bf9f9178 100644
--- a/src/code/arm64-simd.lisp
+++ b/src/code/arm64-simd.lisp
@@ -1045,7 +1045,7 @@
             (loop for bytes in (list bytes bytes2 bytes3 bytes4)
                   do
                   (inst cmeq temp bytes newlines :4s)
-                  (inst bit last-newlines indexes temp :4s)
+                  (inst bit last-newlines indexes temp :16b)
                   (inst add indexes indexes increment :4s))
 
             (inst add 32-bit-array 32-bit-array 64)
@@ -1726,9 +1726,8 @@
                 ;; suitable for the lookup table
                 (inst ushr sh current 6 :8b)
                 (inst cmeq continuations sh mask-2 :8b)
-                (inst not starts continuations :8b)
-                (inst and count starts ones :8b)
-                (inst and starts starts powers :8b)
+                (inst bic starts powers continuations :8b)
+                (inst bic count ones continuations :8b)
                 (inst addv starts starts :8b)
                 (inst addv count count :8b)
                 (inst umov tmp starts 0 :b)
@@ -1741,19 +1740,17 @@
                 ;; i.e. (dpb b0 (byte 5 6) b1)
                 (inst and lead current16 mask-1f :8h)
                 (inst shl lead lead 6 :8h)
-                (inst and continuations next16 mask-3f :16b)
-                (inst orr combined lead continuations :16b)
+                (inst and continuations next16 mask-3f :8h)
+                (inst orr combined lead continuations :8h)
 
                 ;; Select either the combined two bytes or one ascii byte
                 (inst cmhi is-lead16 current16 mask-bf :8h)
                 (inst bsl is-lead16 combined current16 :16b)
 
                 ;; Remove the gaps left over from using two bytes as one codepoint
-                (inst add ptr table (lsl tmp 4))
-                (inst ldr shuf (@ ptr))
+                (inst ldr shuf (@ table (lsl tmp 4)))
                 (inst tbl packed (list is-lead16) shuf :16b)
 
-
                 ;; Widen
                 (inst ushll p32-1 :4s packed :4h 0)
                 (inst ushll2 p32-2 :4s packed :8h 0)
diff --git a/src/compiler/arm64/insts.lisp b/src/compiler/arm64/insts.lisp
index 8f757b4af..368047771 100644
--- a/src/compiler/arm64/insts.lisp
+++ b/src/compiler/arm64/insts.lisp
@@ -338,7 +338,11 @@
     (aver (integerp offset)))
 
   (when (shifter-operand-p offset)
-    (aver (integerp (shifter-operand-operand offset))))
+    (aver (integerp (shifter-operand-operand offset)))
+    (when (eq (shifter-operand-function-code offset) 0)
+      (setf offset (extend (shifter-operand-register offset)
+                           :lsl
+                           (shifter-operand-operand offset)))))
 
   (make-memory-operand base offset mode))
 
@@ -1527,7 +1531,7 @@
      :include ldr-str)
   (op4 :field (byte 1 21) :value 1)
   (rm :field (byte 5 16) :type 'x-reg)
-  (option :fields (list (byte 3 13) (byte 1 12)) :type 'ldr-str-extend)
+  (option :fields (list (byte 2 30) (byte 1 26) (byte 1 23) (byte 3 13) (byte 1 12)) :type 'ldr-str-extend)
   (op5 :field (byte 2 10) :value #b10)
   (ldr-str-annotation :field (byte 5 16) :type 'ldr-str-reg-annotation))
 
@@ -3378,7 +3382,7 @@
                           ,@printer)
                 (:emitter
                  (emit-simd-three-same segment
-                                       (encode-vector-size size)
+                                       (encode-vector-size (the (member :16b :8b) size))
                                        ,u
                                        ,size
                                        (fpr-offset rm)
diff --git a/src/compiler/arm64/target-insts.lisp b/src/compiler/arm64/target-insts.lisp
index d3eef6d26..3eadb141a 100644
--- a/src/compiler/arm64/target-insts.lisp
+++ b/src/compiler/arm64/target-insts.lisp
@@ -89,7 +89,7 @@
 
 (defun print-ldr-str-extend (value stream dstate)
   (declare (ignore dstate))
-  (destructuring-bind (kind amount) value
+  (destructuring-bind (size vector opc kind amount) value
     (unless (and (= kind #b011)
                  (zerop amount))
       (princ ", " stream)
@@ -100,7 +100,15 @@
                (#b111 "SXTX"))
              stream))
     (when (plusp amount)
-      (princ " #3" stream))))
+     (if vector
+         (format stream " #~a" (cond ((= opc 1)
+                                      4)
+                                     (t
+                                      size)
+                                   ))
+         (format stream " #~a" (if (= size #b11)
+                                   3
+                                   2))))))
 
 (defun print-immediate (value stream dstate)
   (declare (ignore dstate))

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


hooks/post-receive
-- 
SBCL