master: Fix emit-avx512-inst-imm

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  d1fabf915bf5345d1b2f662b0ca5d84b4b6e4036 (commit)
      from  ad1b771806f84638af8a494765ecdfe457951ff9 (commit)

- Log -----------------------------------------------------------------
commit d1fabf915bf5345d1b2f662b0ca5d84b4b6e4036
Author: Stas Boukarev <[email protected]>
Date:   Wed Aug 26 03:28:00 2026 +0300

    Fix emit-avx512-inst-imm
    
    With correct evex detection
---
 src/compiler/x86-64/avx2-insts.lisp | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/compiler/x86-64/avx2-insts.lisp b/src/compiler/x86-64/avx2-insts.lisp
index 973702df3..90883f561 100644
--- a/src/compiler/x86-64/avx2-insts.lisp
+++ b/src/compiler/x86-64/avx2-insts.lisp
@@ -702,11 +702,16 @@ REG is the source (encoded in ModR/M.r/m).
                                 evex-w
                                 (opcode-prefix #x0F))
   (aver (<= 0 /i 7))
-  ;; Auto-detect ZMM operands and delegate to EVEX encoding
-  (when (and (register-p reg) (is-zmm-id-p (reg-id reg)))
-    (return-from emit-avx2-inst-imm
-      (emit-avx512-inst-imm segment thing reg imm prefix opcode /i
-                            :ll l :w (or evex-w w) :opcode-prefix opcode-prefix)))
+  (flet ((evex-reg-p (r)
+           (and (register-p r)
+                (or (is-zmm-id-p (reg-id r))
+                    (>= (reg-id-num (reg-id r)) 16)))))
+    ;; Auto-detect ZMM operands and delegate to EVEX encoding
+    (when (or (evex-reg-p reg)
+              (evex-reg-p thing))
+      (return-from emit-avx2-inst-imm
+        (emit-avx512-inst-imm segment thing reg imm prefix opcode /i
+                              :ll l :w (or evex-w w) :opcode-prefix opcode-prefix))))
   (emit-vex segment thing reg nil prefix opcode-prefix l w)
   (emit-bytes segment opcode)
   (emit-byte segment (logior (ash (logior #b11000 /i) 3)

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


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.