master: arm64/character-string-to-utf8: slightly faster surrogate check By moving one instruction from simd to scalar.

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  e96684a5e732b5816d8145259b485b9f030848ff (commit)
      from  22288ec186e3fa20aad319ba57f7c1b5d53e2b98 (commit)

- Log -----------------------------------------------------------------
commit e96684a5e732b5816d8145259b485b9f030848ff
Author: Stas Boukarev <[email protected]>
Date:   Tue Aug 11 09:55:16 2026 +0300

    arm64/character-string-to-utf8: slightly faster surrogate check
    By moving one instruction from simd to scalar.
---
 src/code/arm64-simd.lisp | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/code/arm64-simd.lisp b/src/code/arm64-simd.lisp
index 245cd8697..5ca5a9e8c 100644
--- a/src/code/arm64-simd.lisp
+++ b/src/code/arm64-simd.lisp
@@ -1438,7 +1438,7 @@
                        ((tmp unsigned-reg))
                        ((full-table any-reg t))
                        ((shift-mask complex-double-reg))
-                       ((c-1b complex-double-reg))
+                       ((c-d800 complex-double-reg))
 
                        ((r4 complex-double-reg t))
                        ((length1 complex-double-reg t :offset 8))
@@ -1545,18 +1545,19 @@
 
                (load-inline-constant shift-mask :oword #x6000000040000000200000000)
                (load-inline-constant full-table (make-full-table))
-               (inst movi c-1b  #x1b :4s)
+               (inst movi c-d800  #xd800 :4s)
                (inst movi length1 3 :16b)
                (load-inline-constant length2 :oword #x00000000000000010101010202020202)
 
                FULL-LOOP
                (progn
                  ;; Check for surrogates #xD800-#xDFFF
-                 (inst ushr temp bytes 11 :4s)
-                 (inst cmeq temp temp c-1b :4s)
-                 (inst umaxv temp temp :4s)
-                 (inst umov tmp temp 0 :b)
-                 (inst cbnz tmp DONE)
+                 (inst sub temp bytes c-d800 :4s)
+                 (inst uminv temp temp :4s)
+                 (inst umov tmp temp 0 :s)
+                 (inst cmp tmp #x7ff)
+
+                 (inst b :ls DONE)
 
                  (inst cmeq temp bytes newlines :4s)
                  (inst bit last-newlines indexes temp :16b)

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


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.