master: Revert do-conset-elements to older logic on 3 backends
snuglas via Sbcl-commits <[email protected]> Fri, 17 Jul 2026 20:18:27 +0000
| Newsgroups | gmane.lisp.steel-bank.cvs |
|---|---|
| Message-ID | <[email protected]> |
The branch "master" has been updated in SBCL:
via 573b76f06944bac4527b76c13cb8081b3762e6e4 (commit)
from 0aeedbcaf61cf8944848ad57c431caa529b9e5b7 (commit)
- Log -----------------------------------------------------------------
commit 573b76f06944bac4527b76c13cb8081b3762e6e4
Author: Douglas Katzman <[email protected]>
Date: Fri Jul 17 20:03:21 2026 +0000
Revert do-conset-elements to older logic on 3 backends
---
src/compiler/constraint.lisp | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/compiler/constraint.lisp b/src/compiler/constraint.lisp
index 517b0013a..5b8307287 100644
--- a/src/compiler/constraint.lisp
+++ b/src/compiler/constraint.lisp
@@ -514,7 +514,13 @@
#-sb-xc-host (the simple-vector (sb-kernel:%array-data *constraint-universe*))
#+sb-xc-host *constraint-universe*))
(declare (optimize speed))
- #-sb-xc-host
+ ;; Some backends do not implement either count-leading-zeros or count-trailing-zeros
+ ;; efficiently. For those, iterating over all bits of a simple-bit-vector
+ ;; uses potentially fewer cycles than scanning for just the 1 bits.
+ ;; - Loongarch supports these in the base architecture but our vop is deficient
+ ;; - Sparc added LZCNT no earlier than V9, but not on all V9 implementations
+ ;; - Risc-v only implements something if the Zbb extension is supported
+ #+(and (not sb-xc-host) (not (or sparc loongarch64 riscv)))
;; Aligning to word boundaries is valid because MIN and MAX are merely hints about where
;; nonzero bits exist.
(let ((,minword (floor (conset-min ,conset) sb-vm:n-word-bits))
@@ -540,7 +546,7 @@
(* ,index sb-vm:n-word-bits))))))
,@body)))
finally (return ,result)))
- #+sb-xc-host
+ #-(and (not sb-xc-host) (not (or sparc loongarch64 riscv)))
(loop for ,index from (conset-min ,conset) below (conset-max ,conset)
do (when (plusp (sbit ,conset-vector ,index))
(let ((,constraint (aref ,universe ,index)))
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL