master: arm64: encode prfm

stassats via Sbcl-commits <[email protected]> Sun, 12 Jul 2026 19:51:57 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  99af116141b9be142f093e5de5bd54f4a798c52c (commit)
      from  3bd658d129edf57f47e310ba413b5a9c45b89b58 (commit)

- Log -----------------------------------------------------------------
commit 99af116141b9be142f093e5de5bd54f4a798c52c
Author: Stas Boukarev <[email protected]>
Date:   Sun Jul 12 22:29:11 2026 +0300

    arm64: encode prfm
---
 src/compiler/arm64/insts.lisp        | 37 ++++++++++++++++++++++++++++++++++--
 src/compiler/arm64/target-insts.lisp | 25 ++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/src/compiler/arm64/insts.lisp b/src/compiler/arm64/insts.lisp
index 5888ff421..2e60636cf 100644
--- a/src/compiler/arm64/insts.lisp
+++ b/src/compiler/arm64/insts.lisp
@@ -78,6 +78,7 @@
   (define-arg-type extend :printer #'print-extend)
 
   (define-arg-type ldr-str-extend :printer #'print-ldr-str-extend)
+  (define-arg-type prfop :printer #'print-prfop)
 
   (define-arg-type scaled-immediate :printer #'print-scaled-immediate)
 
@@ -1573,14 +1574,17 @@
                          (logior #b10
                                  (fp-reg-type dst)))))
                      (size)
-                     ((sc-is dst 32-bit-reg)
+                     ((and (not (integerp dst))
+                           (sc-is dst 32-bit-reg))
                       #b10)
                      (t #b11)))
          (scale (if fp
                     (logior (ash (ldb (byte 1 1) opc) 2)
                             size)
                     size))
-         (dst (reg-offset dst)))
+         (dst (if (integerp dst)
+                  dst
+                  (reg-offset dst))))
     (cond ((and (or
                  (and (fixup-p offset)
                       (eq (fixup-flavor offset) :symbol-tls-index))
@@ -1691,6 +1695,35 @@
      (t
       (emit-load-store nil 1 segment dst address vector-size)))))
 
+(define-instruction prfm (segment type address)
+  (:printer ldr-str-unsigned-imm ((op #b10)
+                                  (rt nil :type 'prfop)))
+  (:printer ldr-str-reg ((op #b10)
+                         (rt nil :type 'prfop)))
+  (:printer ldr-str-unscaled-imm ((op #b10)
+                                  (rt nil :type 'prfop)))
+  (:emitter
+   (let ((rt (getf '(:pldl1keep #b00000
+                     :pldl1strm #b00001
+                     :pldl2keep #b00010
+                     :pldl2strm #b00011
+                     :pldl3keep #b00100
+                     :pldl3strm #b00101
+                     :plil1keep #b01000
+                     :plil1strm #b01001
+                     :plil2keep #b01010
+                     :plil2strm #b01011
+                     :plil3keep #b01100
+                     :plil3strm #b01101
+                     :pstl1keep #b10000
+                     :pstl1strm #b10001
+                     :pstl2keep #b10010
+                     :pstl2strm #b10011
+                     :pstl3keep #b10100
+                     :pstl3strm #b10101)
+                   type)))
+     (emit-load-store nil #b10 segment rt address))))
+
 (def-emitter ldr-str-pair
   (opc 2 30)
   (#b101 3 27)
diff --git a/src/compiler/arm64/target-insts.lisp b/src/compiler/arm64/target-insts.lisp
index d4760519c..b28c17e47 100644
--- a/src/compiler/arm64/target-insts.lisp
+++ b/src/compiler/arm64/target-insts.lisp
@@ -251,6 +251,31 @@
                            (#b10 "Q"))
                          reg)))))))
 
+(defun print-prfop (value stream dstate)
+  (declare (ignore dstate))
+  (destructuring-bind (size opc rt) value
+    (declare (ignore size opc))
+    (princ (getf '(#b00000 pldl1keep
+                   #b00001 pldl1strm
+                   #b00010 pldl2keep
+                   #b00011 pldl2strm
+                   #b00100 pldl3keep
+                   #b00101 pldl3strm
+                   #b01000 plil1keep
+                   #b01001 plil1strm
+                   #b01010 plil2keep
+                   #b01011 plil2strm
+                   #b01100 plil3keep
+                   #b01101 plil3strm
+                   #b10000 pstl1keep
+                   #b10001 pstl1strm
+                   #b10010 pstl2keep
+                   #b10011 pstl2strm
+                   #b10100 pstl3keep
+                   #b10101 pstl3strm)
+                 rt)
+           stream)))
+
 (defun print-float-reg (value stream dstate)
   (multiple-value-bind (type value)
       (if (consp value)

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


hooks/post-receive
-- 
SBCL