master: arm64: use zip1 for creating complex floats

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  5b897710fc37863c45b268d33f59ce437492c7df (commit)
      from  69ad1e7908467dc303edce6b0ccfe58b73526b42 (commit)

- Log -----------------------------------------------------------------
commit 5b897710fc37863c45b268d33f59ce437492c7df
Author: Stas Boukarev <[email protected]>
Date:   Sun Aug 30 07:02:55 2026 +0300

    arm64: use zip1 for creating complex floats
---
 src/compiler/arm64/float.lisp     | 16 +++++++----
 src/compiler/arm64/simd-pack.lisp | 60 ++++++++-------------------------------
 2 files changed, 22 insertions(+), 54 deletions(-)

diff --git a/src/compiler/arm64/float.lisp b/src/compiler/arm64/float.lisp
index f09736679..46d0f96a0 100644
--- a/src/compiler/arm64/float.lisp
+++ b/src/compiler/arm64/float.lisp
@@ -934,9 +934,9 @@
   (:translate complex)
   (:args (real :scs (single-reg) :target r
                :load-if (not (location= real r)))
-         (imag :scs (single-reg) :to :save))
+         (imag :scs (single-reg)))
   (:arg-types single-float single-float)
-  (:results (r :scs (complex-single-reg) :from (:argument 0)
+  (:results (r :scs (complex-single-reg)
                :load-if (not (sc-is r complex-single-stack))))
   (:result-types complex-single-float)
   (:note "inline complex single-float creation")
@@ -945,8 +945,10 @@
   (:generator 5
     (sc-case r
       (complex-single-reg
-       (move r real :8b)
-       (inst ins r 1 imag 0 :s))
+       (cond ((location= r real)
+              (inst ins r 1 imag 0 :s))
+             (t
+              (inst zip1 r real imag :2s))))
       (complex-single-stack
        (let ((nfp (current-nfp-tn vop))
              (offset (tn-offset r)))
@@ -975,8 +977,10 @@
   (:generator 5
     (sc-case r
       (complex-double-reg
-       (move r real :16b)
-       (inst ins r 1 imag 0 :d))
+       (cond ((location= r real)
+              (inst ins r 1 imag 0 :d))
+             (t
+              (inst zip1 r real imag :2d))))
       (complex-double-stack
        (let ((nfp (current-nfp-tn vop))
              (offset (tn-offset r)))
diff --git a/src/compiler/arm64/simd-pack.lisp b/src/compiler/arm64/simd-pack.lisp
index 5d31ac9d8..e3ed5c91a 100644
--- a/src/compiler/arm64/simd-pack.lisp
+++ b/src/compiler/arm64/simd-pack.lisp
@@ -307,56 +307,29 @@
 (define-vop (%make-simd-pack-double)
   (:translate %make-simd-pack-double)
   (:policy :fast-safe)
-  (:args (lo :scs (double-reg) :target dst)
+  (:args (lo :scs (double-reg))
          (hi :scs (double-reg)))
   (:arg-types double-float double-float)
   (:results (dst :scs (double-neon-reg)))
   (:result-types simd-pack-double)
   (:generator 5
-    (cond ((location= dst lo)
-           (inst ins dst 1 hi 0 :d))
-          ((location= dst hi)
-           (inst ins dst 1 hi 0 :d)
-           (inst ins dst 0 lo 0 :d))
-          (t
-           (inst ins dst 0 lo 0 :d)
-           (inst ins dst 1 hi 0 :d)))))
+    (inst zip1 dst lo hi :2d)))
 
 (define-vop (%make-simd-pack-single)
   (:translate %make-simd-pack-single)
   (:policy :fast-safe)
-  (:args (x :scs (single-reg) :target dst)
+  (:args (x :scs (single-reg) :target tmp)
          (y :scs (single-reg))
          (z :scs (single-reg))
          (w :scs (single-reg)))
   (:arg-types single-float single-float single-float single-float)
+  (:temporary (:sc single-neon-reg :from (:argument 2)) tmp)
   (:results (dst :scs (single-neon-reg)))
   (:result-types simd-pack-single)
-  (:generator 5
-    (cond ((location= dst x)
-           (inst ins dst 1 y 0 :s)
-           (inst ins dst 2 z 0 :s)
-           (inst ins dst 3 w 0 :s))
-          ((location= dst y)
-           (inst ins dst 1 y 0 :s)
-           (inst ins dst 0 x 0 :s)
-           (inst ins dst 2 z 0 :s)
-           (inst ins dst 3 w 0 :s))
-          ((location= dst z)
-           (inst ins dst 2 z 0 :s)
-           (inst ins dst 0 x 0 :s)
-           (inst ins dst 1 y 0 :s)
-           (inst ins dst 3 w 0 :s))
-          ((location= dst w)
-           (inst ins dst 3 w 0 :s)
-           (inst ins dst 0 x 0 :s)
-           (inst ins dst 1 y 0 :s)
-           (inst ins dst 2 z 0 :s))
-          (t
-           (inst ins dst 0 x 0 :s)
-           (inst ins dst 1 y 0 :s)
-           (inst ins dst 2 z 0 :s)
-           (inst ins dst 3 w 0 :s)))))
+  (:generator 3
+    (inst zip1 tmp x y :2s)
+    (inst zip1 dst z w :2s)
+    (inst zip1 dst tmp dst :2d)))
 
 (defknown %simd-pack-single-item
   (simd-pack (integer 0 3)) single-float (flushable))
@@ -368,13 +341,9 @@
   (:info index)
   (:results (dst :scs (single-reg)))
   (:result-types single-float)
-  (:temporary (:sc double-neon-reg :from (:argument 0)) tmp)
   (:policy :fast-safe)
-  (:generator 3
-    (unless (location= x tmp)
-      (inst mov tmp x :16b))
-    (inst movi dst 0 :4s)
-    (inst ins dst 0 tmp index :s)))
+  (:generator 1
+    (inst ins dst 0 x index :s)))
 
 #-sb-xc-host
 (progn
@@ -392,19 +361,14 @@
 
 (define-vop (%simd-pack-double-item)
   (:translate %simd-pack-double-item)
-  (:args (x :scs (int-neon-reg double-neon-reg single-neon-reg)
-            :target tmp))
+  (:args (x :scs (int-neon-reg double-neon-reg single-neon-reg)))
   (:info index)
   (:arg-types simd-pack (:constant t))
   (:results (dst :scs (double-reg)))
   (:result-types double-float)
-  (:temporary (:sc double-neon-reg :from (:argument 0)) tmp)
   (:policy :fast-safe)
   (:generator 3
-    (unless (location= x tmp)
-      (inst mov tmp x :16b))
-    (inst movi dst 0 :2d)
-    (inst ins dst 0 tmp index :d)))
+    (inst ins dst 0 x index :d)))
 
 #-sb-xc-host
 (progn

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


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.