[llvm] [X86] Support promoted ENQCMD, KEYLOCKER and USER-MSR instructions (PR #77293)
Shengchen Kan via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 24 00:58:35 PST 2024
================
@@ -436,21 +436,38 @@ def WRMSRLIST : I<0x01, MRM_C6, (outs), (ins), "wrmsrlist", []>, TB, XS;
def RDMSRLIST : I<0x01, MRM_C6, (outs), (ins), "rdmsrlist", []>, TB, XD;
}
-let Predicates = [HasUSERMSR], mayLoad = 1 in {
- def URDMSRrr : I<0xf8, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src),
- "urdmsr\t{$src, $dst|$dst, $src}",
- [(set GR64:$dst, (int_x86_urdmsr GR64:$src))]>, T8, XD;
- def URDMSRri : Ii32<0xf8, MRM0r, (outs GR64:$dst), (ins i64i32imm:$imm),
- "urdmsr\t{$imm, $dst|$dst, $imm}",
- [(set GR64:$dst, (int_x86_urdmsr i64immSExt32_su:$imm))]>, T_MAP7, XD, VEX;
+multiclass Urdwrmsr_rr<string suffix> {
+ let mayLoad = 1 in
+ def URDMSRrr#suffix : I<0xf8, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src),
+ "urdmsr\t{$src, $dst|$dst, $src}",
+ [(set GR64:$dst, (int_x86_urdmsr GR64:$src))]>, XD, NoCD8;
+ let mayStore = 1 in
+ def UWRMSRrr#suffix : I<0xf8, MRMSrcReg, (outs), (ins GR64:$src1, GR64:$src2),
+ "uwrmsr\t{$src2, $src1|$src1, $src2}",
+ [(int_x86_uwrmsr GR64:$src1, GR64:$src2)]>, XS, NoCD8;
}
-let Predicates = [HasUSERMSR], mayStore = 1 in {
- def UWRMSRrr : I<0xf8, MRMSrcReg, (outs), (ins GR64:$src1, GR64:$src2),
- "uwrmsr\t{$src2, $src1|$src1, $src2}",
- [(int_x86_uwrmsr GR64:$src1, GR64:$src2)]>, T8, XS;
- def UWRMSRir : Ii32<0xf8, MRM0r, (outs), (ins GR64:$src, i64i32imm:$imm),
- "uwrmsr\t{$src, $imm|$imm, $src}",
- [(int_x86_uwrmsr i64immSExt32_su:$imm, GR64:$src)]>, T_MAP7, XS, VEX;
+
+multiclass Urdwrmsr_ri<string suffix> {
+ let mayLoad = 1 in
+ def URDMSRri#suffix : Ii32<0xf8, MRM0r, (outs GR64:$dst), (ins i64i32imm:$imm),
+ "urdmsr\t{$imm, $dst|$dst, $imm}",
+ [(set GR64:$dst, (int_x86_urdmsr i64immSExt32_su:$imm))]>,
+ T_MAP7, XD, NoCD8;
+ let mayStore = 1 in
+ def UWRMSRir#suffix : Ii32<0xf8, MRM0r, (outs), (ins GR64:$src, i64i32imm:$imm),
+ "uwrmsr\t{$src, $imm|$imm, $src}",
+ [(int_x86_uwrmsr i64immSExt32_su:$imm, GR64:$src)]>,
+ T_MAP7, XS, NoCD8;
+}
+
+let Predicates = [HasUSERMSR, NoEGPR] in {
+ defm "" : Urdwrmsr_rr<"">, T8;
+ defm "" : Urdwrmsr_ri<"">, VEX;
+}
+
+let Predicates = [HasUSERMSR, HasEGPR, In64BitMode], mayLoad = 1 in {
----------------
KanRobert wrote:
mayLoad = 1 should be redundant.
https://github.com/llvm/llvm-project/pull/77293
More information about the llvm-commits
mailing list