master: Address a FIXME in emit-inline-add-sub

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  79752fb42ac4af7026c808375371abcd776a7ade (commit)
      from  8595450051912d35003fecaee2fbc4948aeb5a6b (commit)

- Log -----------------------------------------------------------------
commit 79752fb42ac4af7026c808375371abcd776a7ade
Author: Stas Boukarev <[email protected]>
Date:   Mon Apr 20 20:44:18 2026 +0300

    Address a FIXME in emit-inline-add-sub
---
 src/compiler/x86-64/arith.lisp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/compiler/x86-64/arith.lisp b/src/compiler/x86-64/arith.lisp
index 74209f64a..f9083f8a7 100644
--- a/src/compiler/x86-64/arith.lisp
+++ b/src/compiler/x86-64/arith.lisp
@@ -436,11 +436,11 @@
       (sub
        (setf op 'add
              y (- (sb-c::mask-signed-field n-word-bits y))))))
-  ;; FIXME: What is (ash -1 63) for ? this comment within doesn't match the test.
-  (when (and (eq op 'sub) (and (integerp y) (not (eql y (ash -1 63)))))
-    ;; If Y is -2147483648 then the negation is not (signed-byte 32).
-    ;; How likely is someone to subtract that?
-    (setq op 'add y (- y)))
+  (cond ((and (eq op 'sub) (and (integerp y) (not (eql y (ash -1 31)))))
+         ;; If Y is -2147483648 then the negation is not (signed-byte 32).
+         (setq op 'add y (- y)))
+        ((and (eq op 'add) (eql y (ash 1 31)))
+         (setq op 'sub y (- y))))
 
   ;; Oversized integers need to become RIP-relative constants
   (when (integerp x) (setq x (constantize x)))

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


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.