master: arm64: unify all float immediates

stassats via Sbcl-commits <[email protected]> Sun, 28 Jun 2026 13:03:25 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  a549f8c1356a107312eeaff707dc0e6b8d867d98 (commit)
      from  5b6a30331b6c25d83cf70a414e57c37ac89dbb33 (commit)

- Log -----------------------------------------------------------------
commit a549f8c1356a107312eeaff707dc0e6b8d867d98
Author: Stas Boukarev <[email protected]>
Date:   Sat Jun 27 20:49:28 2026 +0300

    arm64: unify all float immediates
---
 src/compiler/arm64/cell.lisp   |  8 ++++----
 src/compiler/arm64/float.lisp  |  8 ++++----
 src/compiler/arm64/macros.lisp |  6 +++---
 src/compiler/arm64/vm.lisp     | 24 +++++++-----------------
 xperfecthash63.lisp-expr       | 20 ++++++++++++++++++++
 5 files changed, 38 insertions(+), 28 deletions(-)

diff --git a/src/compiler/arm64/cell.lisp b/src/compiler/arm64/cell.lisp
index db9c7cb22..2f1ebb81d 100644
--- a/src/compiler/arm64/cell.lisp
+++ b/src/compiler/arm64/cell.lisp
@@ -775,10 +775,10 @@
                         `((,move-macro result value))))))
          (multiple-value-bind (immediate-sc immediate-value)
              (case name
-               (single (values 'single-immediate 0f0))
-               (double (values 'double-immediate 0d0))
-               (complex-single (values 'complex-single-immediate #c(0f0 0f0)))
-               ;(complex-double (values 'complex-double-immediate #c(0d0 0d0)))
+               (single (values 'fp-immediate 0f0))
+               (double (values 'fp-immediate 0d0))
+               (complex-single (values 'fp-immediate #c(0f0 0f0)))
+               ;(complex-double (values 'fp-immediate #c(0d0 0d0)))
                (t (values 'immediate 0)))
            `(progn
               (define-vop ()
diff --git a/src/compiler/arm64/float.lisp b/src/compiler/arm64/float.lisp
index 08487ae00..821de4636 100644
--- a/src/compiler/arm64/float.lisp
+++ b/src/compiler/arm64/float.lisp
@@ -30,10 +30,10 @@
   (storew x (current-nfp-tn vop) (tn-offset y)))
 
 (define-move-fun (load-fp-immediate 1) (vop x y)
-                 ((single-immediate) (single-reg)
-                  (double-immediate) (double-reg)
-                  (complex-single-immediate) (complex-single-reg)
-                  (complex-double-immediate) (complex-double-reg))
+                 ((fp-immediate) (single-reg)
+                  (fp-immediate) (double-reg)
+                  (fp-immediate) (complex-single-reg)
+                  (fp-immediate) (complex-double-reg))
   (let ((x (tn-value x)))
     (cond ((eql x #c(0d0 0d0))
            (inst movi y 0 :2d))
diff --git a/src/compiler/arm64/macros.lisp b/src/compiler/arm64/macros.lisp
index 505e3db81..07d4b457a 100644
--- a/src/compiler/arm64/macros.lisp
+++ b/src/compiler/arm64/macros.lisp
@@ -426,7 +426,7 @@
                (index :scs (any-reg unsigned-reg signed-reg immediate))
                (value :scs (,@scs ,(case el-type
                                      (double-float
-                                      '(double-immediate (eql (tn-value tn) 0d0)))
+                                      '(fp-immediate (eql (tn-value tn) 0d0)))
                                      (t
                                       'zero)))))
         (:arg-types ,type tagged-num ,el-type)
@@ -439,7 +439,7 @@
                   (emit-gengc-barrier object nil tmp-tn t))))
           ,@(case el-type
               (double-float
-               '((when (sc-is value double-immediate)
+               '((when (sc-is value fp-immediate)
                    (setf value zr-tn)))))
           (sc-case index
             (immediate
@@ -497,7 +497,7 @@
                                  &optional translate)
   (multiple-value-bind (immediate-sc immediate-value)
       (case el-type
-        (single-float (values 'single-immediate 0f0))
+        (single-float (values 'fp-immediate 0f0))
         (t (values 'immediate 0)))
     (let ((value `((value :scs (,@scs (,immediate-sc
                                        (eql (tn-value tn) ,immediate-value))))))
diff --git a/src/compiler/arm64/vm.lisp b/src/compiler/arm64/vm.lisp
index e2a34498a..cd6b96ea2 100644
--- a/src/compiler/arm64/vm.lisp
+++ b/src/compiler/arm64/vm.lisp
@@ -182,32 +182,28 @@
 
   ;; **** Things that can go in the floating point registers.
 
-  (single-immediate immediate-constant)
-  (double-immediate immediate-constant)
+  (fp-immediate immediate-constant)
 
   (single-reg float-registers
               :locations #.(loop for i below 32 collect i)
-              :constant-scs (single-immediate)
+              :constant-scs (fp-immediate)
               :save-p t
               :alternate-scs (single-stack))
   (double-reg float-registers
               :locations #.(loop for i below 32 collect i)
-              :constant-scs (double-immediate)
+              :constant-scs (fp-immediate)
               :save-p t
               :alternate-scs (double-stack))
 
-  (complex-single-immediate immediate-constant)
-  (complex-double-immediate immediate-constant)
-
   (complex-single-reg float-registers
                       :locations #.(loop for i below 32 collect i)
-                      :constant-scs (complex-single-immediate)
+                      :constant-scs (fp-immediate)
                       :save-p t
                       :alternate-scs (complex-single-stack))
 
   (complex-double-reg float-registers
                       :locations #.(loop for i below 32 collect i)
-                      :constant-scs (complex-double-immediate)
+                      :constant-scs (fp-immediate)
                       :save-p t
                       :alternate-scs (complex-double-stack))
 
@@ -254,14 +250,8 @@
      (if (static-symbol-p value)
          immediate-sc-number
          nil))
-    (double-float
-     double-immediate-sc-number)
-    (single-float
-     single-immediate-sc-number)
-    ((complex double-float)
-     complex-double-immediate-sc-number)
-    ((complex single-float)
-     complex-single-immediate-sc-number)
+    ((or float (complex float))
+     fp-immediate-sc-number)
     (structure-object
      (when (eq value sb-lockless:+tail+)
        immediate-sc-number))))
diff --git a/xperfecthash63.lisp-expr b/xperfecthash63.lisp-expr
index cc7182b8b..ef9fe3237 100644
--- a/xperfecthash63.lisp-expr
+++ b/xperfecthash63.lisp-expr
@@ -1712,5 +1712,25 @@
 (#(1E21A5F9 2A6BF857 80D0C591 AC841474 CB6BDBB0)
  "(SB-VM::SIGNED-BYTE-64 SB-VM::UNSIGNED-BYTE-64 SYSTEM-AREA-POINTER SINGLE-FLOAT DOUBLE-FLOAT)"
  "((& (+ (>> val 4) (>> val 10)) 7))")
+(#(6 8 A 18 26)
+ "(5 4 3 12 19)"
+ "((let ((tab #a((4) (unsigned-byte 8) 0 2 7 0)))
+  (let ((b (>> (<< val 26) 30)))
+   (let ((a (& (>> val 1) #x3)))
+    (^ a (aref tab b))))))")
+(#(0 2 4 1E 20 22 28 2A)
+ "(15 16 20 21 2 17 1 0)"
+ "((let ((tab #a((4) (unsigned-byte 8) 0 7 1 7)))
+  (+= val #xcafb35e5)
+  (^= val (>> val 4))
+  (let ((b (& (>> val 3) #x3)))
+   (let ((a (>> (u32+ val (<< val 29)) 30)))
+    (^ a (aref tab b))))))")
+(#(0 2 4 6 8 A E 10 12 14 16 18 1A 1C 1E 20 22 24 28 2A 2C 2E 7A)
+ "(61 4 3 10 7 8 9 5 14 13 12 11 23 22 21 20 18 17 2 16 15 0 1)"
+ "((let ((tab #a((16) (unsigned-byte 8) 0 13 1 7 13 7 21 15 16 9 22 17 21 0 18 22)))
+  (let ((b (& (>> val 1) #xf)))
+   (let ((a (>> (<< val 25) 28)))
+    (^ a (aref tab b))))))")
 )
 ;; EOF

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


hooks/post-receive
-- 
SBCL