master: Add some (safety 0)
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 0ed5ec0d57160926b01558e299cb5bbe86fcc924 (commit)
from 9c6a402b32485014fd34b3026fb1b9c4fe00e7de (commit)
- Log -----------------------------------------------------------------
commit 0ed5ec0d57160926b01558e299cb5bbe86fcc924
Author: Stas Boukarev <[email protected]>
Date: Fri Aug 14 02:44:24 2026 +0300
Add some (safety 0)
And some other micro-optimizations.
---
src/code/x86-64-simd.lisp | 13 +++++++------
tests/utf-8.pure.lisp | 4 ++--
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/code/x86-64-simd.lisp b/src/code/x86-64-simd.lisp
index 189b6e418..2b24db0fb 100644
--- a/src/code/x86-64-simd.lisp
+++ b/src/code/x86-64-simd.lisp
@@ -1681,7 +1681,7 @@
;; Multiplying by 1 + 2^6 + 2^12 + 2^18
;; shifts two bits per byte into the upper byte
- (inst imul tmp multiplier)
+ (inst imul tmp multiplier) ; #x0100040010004000
(inst shr tmp (- 56 6)) ;; shift left 6 for the table entry size
;; Spread the character to all 4 bytes
@@ -1724,7 +1724,7 @@
(register-inline-constant :sse (concat-ub 32 (loop repeat 4 collect #x800007FF))))
(inst vmovmskps tmp t2)
- (inst cmp tmp #xF)
+ (inst cmp :dword tmp #xF)
(inst jmp :e DONE)
(inst vzeroupper)
(inst jmp error)
@@ -2488,7 +2488,7 @@
(inst mov byte-length ptr)
(inst mov char-length byte-length)
(inst shl char-length 1)
- (load-symbol all-ascii t)
+ (zeroize all-ascii) ;; generalized boolean non-nil
(inst jmp DONE)
NON-ASCII
@@ -2575,6 +2575,7 @@
(inst vzeroupper)))))
(def-variant sb-impl::character-string-utf8-length :avx2 (string)
+ (declare (optimize speed (safety 0)))
(with-pinned-objects (string)
(inline-vop
(((ptr sap-reg t) (vector-sap string))
@@ -2601,7 +2602,7 @@
(all-ascii descriptor-reg t :from :load))
(inst mov res length)
- (load-symbol all-ascii t)
+ (zeroize all-ascii) ;; generalized boolean non-nil
(inst test length length)
(inst jmp :z DONE)
@@ -2636,7 +2637,7 @@
(inst vmovdqa c-ffff (register-inline-constant
:sse (concat-ub 32 (loop repeat 4 collect #xFFFF))))
(inst vmovdqa c-d800 (register-inline-constant
- :sse (concat-ub 32 (loop repeat 4 collect #xd800))))
+ :sse (concat-ub 32 (loop repeat 4 collect #xd800))))
(inst jmp START)
@@ -2676,7 +2677,7 @@
(register-inline-constant :sse (concat-ub 32 (loop repeat 4 collect #x800007FF))))
(inst vmovmskps tmp tmp1)
- (inst cmp tmp #xF)
+ (inst cmp :dword tmp #xF)
(inst jmp :ne DONE-FULL)
(inst vextracti128 tmp1 extra-len 1)
diff --git a/tests/utf-8.pure.lisp b/tests/utf-8.pure.lisp
index caf3120db..9a07932e9 100644
--- a/tests/utf-8.pure.lisp
+++ b/tests/utf-8.pure.lisp
@@ -477,7 +477,7 @@
(multiple-value-bind (length byte-length ascii-p)
(sb-vm::utf8-strlen (sb-sys:sap+ (sb-sys:vector-sap bytes) offset))
(unless (and (eql expected-length length)
- (eql expected-ascii-p ascii-p)
+ (eql expected-ascii-p (and ascii-p t))
(or (not expected-length)
(eql expected-byte-length byte-length)))
(error "(sb-vm::utf8-strlen (sb-sys:sap+ (sb-sys:vector-sap ~s) ~s)) => ~a, ~a, ~a; but ~a, ~a, ~a expected"
@@ -519,7 +519,7 @@
(multiple-value-bind (length ascii-p)
(sb-impl::character-string-utf8-length string)
(unless (and (eql expected-length length)
- (eql expected-ascii-p ascii-p))
+ (eql expected-ascii-p (and ascii-p t)))
(error "(sb-impl::character-string-utf8-length ~a) => ~a, ~a; but ~a, ~a expected"
string length ascii-p
expected-length expected-ascii-p))))))
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL