master: Don't issue bt instead of cmp x, imm

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  c1a075a94cfd5653cf53f47e7141662d557ceeea (commit)
      from  100afd03eb941cfebee8511b835ec29aad704378 (commit)

- Log -----------------------------------------------------------------
commit c1a075a94cfd5653cf53f47e7141662d557ceeea
Author: Stas Boukarev <[email protected]>
Date:   Sat Aug 29 23:29:48 2026 +0300

    Don't issue bt instead of cmp x, imm
    
    It is more compact but has lower throughput.
---
 src/compiler/x86-64/arith.lisp | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/compiler/x86-64/arith.lisp b/src/compiler/x86-64/arith.lisp
index 8605657af..5512a4784 100644
--- a/src/compiler/x86-64/arith.lisp
+++ b/src/compiler/x86-64/arith.lisp
@@ -3469,6 +3469,9 @@
                                           (fixnum-width (+ width ,(if fixnump
                                                                       1
                                                                       0)))
+                                          (fixnum-bit (+ bit ,(if fixnump
+                                                                  1
+                                                                  0)))
                                           (size (if (<= fixnum-width 32)
                                                     :dword
                                                     :qword)))
@@ -3477,23 +3480,21 @@
                                           (<
                                            `(when (= y (ash 1 bit))
                                               (cond (,test-form
-                                                     (change-vop-flags vop '(:ns)))
-                                                    (t
-                                                     (inst bt size x (+ bit ,(if fixnump
-                                                                                 1
-                                                                                 0)))
-                                                     (change-vop-flags vop '(:nc))))
-                                              (return-from ,name)))
+                                                     (change-vop-flags vop '(:ns))
+                                                     (return-from ,name))
+                                                    ((> fixnum-bit 31)
+                                                     (inst bt size x fixnum-bit)
+                                                     (change-vop-flags vop '(:nc))
+                                                     (return-from ,name)))))
                                           (>
                                            `(when (= y (1- (ash 1 bit)))
                                               (cond (,test-form
-                                                     (change-vop-flags vop '(:s)))
-                                                    (t
-                                                     (inst bt size x (+ bit ,(if fixnump
-                                                                                 1
-                                                                                 0)))
-                                                     (change-vop-flags vop '(:c))))
-                                              (return-from ,name))))))))))
+                                                     (change-vop-flags vop '(:s))
+                                                     (return-from ,name))
+                                                    ((> fixnum-bit 31)
+                                                     (inst bt size x fixnum-bit)
+                                                     (change-vop-flags vop '(:c))
+                                                     (return-from ,name))))))))))))
                          ,(when constant
                             `(cond
                                ((zerop (+ y ,addend))

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


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.