master: arm64, utf8-strlen: unify some parts

stassats via Sbcl-commits <[email protected]> Tue, 21 Jul 2026 15:52:50 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  7ab7c5accbd24412da524c85e008bb21a8c96d05 (commit)
      from  1e3e9bc7f64dbcba9301ee836185cfcb4fdffef5 (commit)

- Log -----------------------------------------------------------------
commit 7ab7c5accbd24412da524c85e008bb21a8c96d05
Author: Stas Boukarev <[email protected]>
Date:   Tue Jul 21 18:47:03 2026 +0300

    arm64, utf8-strlen: unify some parts
---
 src/code/arm64-simd.lisp | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/src/code/arm64-simd.lisp b/src/code/arm64-simd.lisp
index 8ab421dce..0954eb542 100644
--- a/src/code/arm64-simd.lisp
+++ b/src/code/arm64-simd.lisp
@@ -1383,7 +1383,8 @@
        ((tmp1         complex-double-reg))
        ((tmp2         complex-double-reg))
        ((tmp3         complex-double-reg))
-       ((tmp4         complex-double-reg)))
+       ((tmp4         complex-double-reg))
+       ((cont complex-double-reg)))
 
       ((char-length descriptor-reg t :from :load)
        (byte-length unsigned-reg positive-fixnum :from :load)
@@ -1398,13 +1399,17 @@
 
                (inst ext tmp1 prev current 15 :16b)
 
+               ;; Identify continuations
+               (inst cmgt cont c-c0 current :16b)
+
+               (inst addv tmp3 cont :16b)
+               (inst smov tmp-tn tmp3 0 :b)
+               (inst sub total-conts total-conts tmp-tn)
+
                (inst tbnz tmp 5 full)
 
                ;; 1/2 bytes
 
-               ;; Identify continuations
-               (inst cmgt tmp3 c-c0 current :16b)
-
                ;; Identify leading non-ascii bytes, shifted left by
                ;; one byte, with the previous byte shifted in
                (inst cmhi tmp1 tmp1 c-c1 :16b)
@@ -1413,7 +1418,7 @@
 
                ;; Continuations must follow leading bytes,
                ;; they must align with the shifted input
-               (inst eor tmp1 tmp1 tmp3 :16b) ;; errors 1
+               (inst eor tmp1 tmp1 cont :16b) ;; errors 1
 
                ;; Find #xC0 or #xC1, which are overlong
                (inst cmhs tmp2 current c-c0 :16b) ;; >= c0
@@ -1422,9 +1427,6 @@
                (inst orr tmp1 tmp1 tmp2 :16b) ;; combine errors
                (inst orr errors errors tmp1 :16b)
 
-               (inst addv tmp3 tmp3 :16b)
-               (inst smov tmp tmp3 0 :b)
-               (inst sub total-conts total-conts tmp)
                (inst and prev-len tmp4 twos :16b)
 
                (inst b validated)
@@ -1457,18 +1459,11 @@
                (inst orr tmp2 tmp2 tmp3 :16b)
                (inst orr tmp2 tmp2 tmp4 :16b)
 
-               (inst ushr tmp3 current 6 :16b)
-               (inst cmeq tmp3 tmp3 twos :16b)
-
                (inst cmtst tmp4 tmp2 tmp2 :16b)
 
-               (inst eor tmp4 tmp3 tmp4 :16b)
+               (inst eor tmp4 cont tmp4 :16b)
                (inst orr errors errors tmp4 :16b)
 
-               ;; Subtract continuations
-               (inst addv tmp4 tmp3 :16b)
-               (inst smov tmp tmp4 0 :b)
-               (inst sub total-conts total-conts tmp)
                (unless last
                  (inst mov prev-len tmp1 :16b))
                VALIDATED)))

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


hooks/post-receive
-- 
SBCL