master: arm64-simd: streamline start/end calculations

stassats via Sbcl-commits <[email protected]>
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  f519f0f1e3c03c08e8662763804b82443191ea07 (commit)
      from  410e879997ea7cbaa1d83cfb953dec2c57d232df (commit)

- Log -----------------------------------------------------------------
commit f519f0f1e3c03c08e8662763804b82443191ea07
Author: Stas Boukarev <[email protected]>
Date:   Wed Aug 12 04:58:39 2026 +0300

    arm64-simd: streamline start/end calculations
---
 src/code/arm64-simd.lisp | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/src/code/arm64-simd.lisp b/src/code/arm64-simd.lisp
index 969f7b0ae..dcd883d76 100644
--- a/src/code/arm64-simd.lisp
+++ b/src/code/arm64-simd.lisp
@@ -535,9 +535,8 @@
   (with-pinned-objects-in-registers (string)
     (let* ((head (sb-impl::buffer-head ibuf))
            (tail (sb-impl::buffer-tail ibuf))
-           (left (- end start))
-           (string-end (- left (/ 64 4)))
-           (byte-end (- tail head 16)))
+           (string-end (- end (/ 64 4)))
+           (byte-end (- tail 16)))
       (multiple-value-bind (copied written)
           (inline-vop (((byte-start any-reg) head)
                        ((string-start any-reg) start)
@@ -582,10 +581,8 @@
               ((copied unsigned-reg positive-fixnum)
                (written unsigned-reg positive-fixnum))
 
-
-            (inst add byte-array* byte-array* (lsr byte-start 1))
-            (inst mov byte-array byte-array*)
             (inst add byte-end byte-array* (asr byte-end 1))
+            (inst add byte-array byte-array* (lsr byte-start 1))
 
             (inst add string-end string* (lsl string-end (- 2 n-fixnum-tag-bits)))
             (inst add string string* (lsl string-start (- 2 n-fixnum-tag-bits)))
@@ -777,7 +774,7 @@
             (inst sub copied byte-array byte-array*)
             (inst sub written string string*)
             (inst lsr written written 2))
-        (setf (sb-impl::buffer-head ibuf) (+ head copied))
+        (setf (sb-impl::buffer-head ibuf) copied)
         (truly-the index written)))))
 
 #+sb-unicode
@@ -1057,9 +1054,8 @@
   (with-pinned-objects-in-registers (string)
     (let* ((head (sb-impl::buffer-head ibuf))
            (tail (sb-impl::buffer-tail ibuf))
-           (left (- end start))
-           (string-end (- left (/ 64 4)))
-           (byte-end (- tail head 32)))
+           (string-end (- end (/ 64 4)))
+           (byte-end (- tail 32)))
       (multiple-value-bind (copied written)
           (inline-vop (((byte-start any-reg) head)
                        ((string-start any-reg) start)
@@ -1107,10 +1103,8 @@
               ((copied unsigned-reg positive-fixnum)
                (written unsigned-reg positive-fixnum))
 
-
-            (inst add byte-array* byte-array* (lsr byte-start 1))
-            (inst mov byte-array byte-array*)
             (inst add byte-end byte-array* (asr byte-end 1))
+            (inst add byte-array byte-array* (lsr byte-start 1))
 
             (inst add string-end string* (lsl string-end (- 2 n-fixnum-tag-bits)))
             (inst add string string* (lsl string-start (- 2 n-fixnum-tag-bits)))
@@ -1397,7 +1391,7 @@
             (inst sub copied byte-array byte-array*)
             (inst sub written string string*)
             (inst lsr written written 2))
-        (setf (sb-impl::buffer-head ibuf) (+ head copied))
+        (setf (sb-impl::buffer-head ibuf) copied)
         (truly-the index written)))))
 
 (defun character-string-to-utf8 (start end string obuf)

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


hooks/post-receive
-- 
SBCL
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.