[PATCH] D138639: [X86] Add In64BitMode for MOVSX64/MOVZX64 instructions

Haohai, Wen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 24 00:02:49 PST 2022


HaohaiWen created this revision.
Herald added subscribers: pengfei, hiraditya.
Herald added a project: All.
HaohaiWen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

REX_W prefix requires In64BitMode


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138639

Files:
  llvm/lib/Target/X86/X86InstrExtension.td


Index: llvm/lib/Target/X86/X86InstrExtension.td
===================================================================
--- llvm/lib/Target/X86/X86InstrExtension.td
+++ llvm/lib/Target/X86/X86InstrExtension.td
@@ -136,6 +136,7 @@
 // operand, which makes it a rare instruction with an 8-bit register
 // operand that can never access an h register. If support for h registers
 // were generalized, this would require a special register class.
+let Predicates = [In64BitMode] in {
 def MOVSX64rr8 : RI<0xBE, MRMSrcReg, (outs GR64:$dst), (ins GR8 :$src),
                     "movs{bq|x}\t{$src, $dst|$dst, $src}",
                     [(set GR64:$dst, (sext GR8:$src))]>, TB,
@@ -155,11 +156,12 @@
 def MOVSX64rr32: RI<0x63, MRMSrcReg, (outs GR64:$dst), (ins GR32:$src),
                     "movs{lq|xd}\t{$src, $dst|$dst, $src}",
                     [(set GR64:$dst, (sext GR32:$src))]>,
-                    Sched<[WriteALU]>, Requires<[In64BitMode]>;
+                    Sched<[WriteALU]>;
 def MOVSX64rm32: RI<0x63, MRMSrcMem, (outs GR64:$dst), (ins i32mem:$src),
                     "movs{lq|xd}\t{$src, $dst|$dst, $src}",
                     [(set GR64:$dst, (sextloadi64i32 addr:$src))]>,
-                    Sched<[WriteLoad]>, Requires<[In64BitMode]>;
+                    Sched<[WriteLoad]>;
+}
 
 // These instructions exist as a consequence of operand size prefix having
 // control of the destination size, but not the input size. Only support them
@@ -182,7 +184,7 @@
 } // isCodeGenOnly = 1, ForceDisassemble = 1, hasSideEffects = 0
 
 // movzbq and movzwq encodings for the disassembler
-let hasSideEffects = 0 in {
+let hasSideEffects = 0, Predicates = [In64BitMode] in {
 def MOVZX64rr8 : RI<0xB6, MRMSrcReg, (outs GR64:$dst), (ins GR8:$src),
                      "movz{bq|x}\t{$src, $dst|$dst, $src}", []>,
                      TB, Sched<[WriteALU]>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138639.477691.patch
Type: text/x-patch
Size: 1873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221124/777e455d/attachment.bin>


More information about the llvm-commits mailing list