master: Replace a bunch of AVERs with better types

stassats via Sbcl-commits <[email protected]> Thu, 30 Apr 2026 22:58:35 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  64efbd61f73d03db0f093053fb826bfddb50c9c6 (commit)
      from  9b67e9100dfd518747d61d3a1fd8b986d09120d6 (commit)

- Log -----------------------------------------------------------------
commit 64efbd61f73d03db0f093053fb826bfddb50c9c6
Author: Stas Boukarev <[email protected]>
Date:   Fri May 1 01:56:36 2026 +0300

    Replace a bunch of AVERs with better types
---
 src/compiler/arm64/arith.lisp  | 15 ++++++---------
 src/compiler/x86-64/arith.lisp |  3 +--
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/compiler/arm64/arith.lisp b/src/compiler/arm64/arith.lisp
index a1478648b..c7cc42f3d 100644
--- a/src/compiler/arm64/arith.lisp
+++ b/src/compiler/arm64/arith.lisp
@@ -1411,12 +1411,11 @@
   (:translate sb-c::mask-signed-field)
   (:policy :fast-safe)
   (:args (x :scs (signed-reg unsigned-reg)))
-  (:arg-types (:constant (integer 0 64)) untagged-num)
+  (:arg-types (:constant (integer 1 64)) untagged-num)
   (:results (r :scs (signed-reg)))
   (:result-types signed-num)
   (:info width)
   (:generator 3
-    (aver (/= width 0))
     (cond ((= width 64)
            (move r x))
           (t
@@ -1426,12 +1425,11 @@
   (:translate sb-c::mask-signed-field)
   (:policy :fast-safe)
   (:args (x :scs (descriptor-reg)))
-  (:arg-types (:constant (integer 0 64)) bignum)
+  (:arg-types (:constant (integer 1 64)) bignum)
   (:results (r :scs (signed-reg)))
   (:result-types signed-num)
   (:info width)
   (:generator 4
-    (aver (/= width 0))
     (loadw r x bignum-digits-offset other-pointer-lowtag)
     (inst sbfm r r 0 (1- width))))
 
@@ -1468,7 +1466,7 @@
   (:policy :fast-safe)
   (:args (x :scs (descriptor-reg)))
   (:arg-refs x-ref)
-  (:arg-types (:constant (integer 0 64)) t)
+  (:arg-types (:constant (integer 1 64)) t)
   (:results (r :scs (signed-reg)))
   (:result-types signed-num)
   (:info width)
@@ -1476,7 +1474,6 @@
   (:vop-var vop)
   (:save-p :compute-only)
   (:generator 63
-    (aver (/= width 0))
     (inst asr r x n-fixnum-tag-bits)
     (inst tbz x 0 do)
     (let* ((integerp (csubtypep (tn-ref-type x-ref)
@@ -3865,11 +3862,10 @@
   (:translate rotate-right-word)
   (:args (integer :scs (unsigned-reg) :target result))
   (:info count)
-  (:arg-types unsigned-num (:constant (mod 64)))
+  (:arg-types unsigned-num (:constant (integer 1 63)))
   (:results (result :scs (unsigned-reg)))
   (:result-types unsigned-num)
   (:generator 5
-    (aver (not (= count 0)))
     (inst ror result integer count)))
 
 (define-vop ()
@@ -3906,7 +3902,8 @@
   (:arg-types unsigned-num)
   (:results (res :scs (unsigned-reg)))
   (:result-types unsigned-num)
-  (:generator 1 (inst rbit res arg)))
+  (:generator 1
+    (inst rbit res arg)))
 
 (deftransform abs ((x) (:or ((signed-word) signed-word)) * :vop t)
   t)
diff --git a/src/compiler/x86-64/arith.lisp b/src/compiler/x86-64/arith.lisp
index 6d2c167e8..946928d48 100644
--- a/src/compiler/x86-64/arith.lisp
+++ b/src/compiler/x86-64/arith.lisp
@@ -5059,11 +5059,10 @@
   (:translate rotate-right-word)
   (:args (integer :scs (unsigned-reg) :target result))
   (:info count)
-  (:arg-types unsigned-num (:constant (mod 64)))
+  (:arg-types unsigned-num (:constant (integer 1 63)))
   (:results (result :scs (unsigned-reg)))
   (:result-types unsigned-num)
   (:generator 5
-    (aver (not (= count 0)))
     (move result integer)
     (inst ror result count)))
 

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


hooks/post-receive
-- 
SBCL