Skip to content

Commit cdd81e3

Browse files
authored
[X86][MC] Support Enc/Dec for EGPR for promoted INVPCID instruction (llvm#74548)
R16-R31 was added into GPRs in llvm#70958, This patch supports the encoding/decoding for promoted INVPCID instruction in EVEX space. RFC: https://discourse.llvm.org/t/rfc-design-for-apx-feature-egpr-and-ndd-support/73031/4
1 parent 9e03468 commit cdd81e3

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

llvm/lib/Target/X86/X86InstrSystem.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,10 @@ def INVPCID32 : I<0x82, MRMSrcMem, (outs), (ins GR32:$src1, i128mem:$src2),
679679
def INVPCID64 : I<0x82, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
680680
"invpcid\t{$src2, $src1|$src1, $src2}", []>, T8PD,
681681
Requires<[In64BitMode, HasINVPCID]>;
682+
683+
def INVPCID64_EVEX : I<0xF2, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
684+
"invpcid\t{$src2, $src1|$src1, $src2}", []>,
685+
EVEX_NoCD8, T_MAP4XS, Requires<[In64BitMode, HasINVPCID]>;
682686
} // SchedRW
683687

684688
let Predicates = [In64BitMode, HasINVPCID] in {

llvm/lib/Target/X86/X86InstrUtils.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class EVEX_CD8<int esize, CD8VForm form> {
8686
int CD8_EltSize = !srl(esize, 3);
8787
bits<3> CD8_Form = form.Value;
8888
}
89+
class EVEX_NoCD8 : EVEX { bits<7> CD8_Scale = 0; }
8990
class XOP { Encoding OpEnc = EncXOP; }
9091
class XOP_4V : XOP { bit hasVEX_4V = 1; }
9192
class EVEX2VEXOverride<string VEXInstrName> {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# RUN: llvm-mc --disassemble %s -triple=x86_64 | FileCheck %s --check-prefixes=ATT
2+
# RUN: llvm-mc --disassemble %s -triple=x86_64 -x86-asm-syntax=intel --output-asm-variant=1 | FileCheck %s --check-prefixes=INTEL
3+
4+
# ATT: invpcid 291(%r28,%r29,4), %r19
5+
# INTEL: invpcid r19, xmmword ptr [r28 + 4*r29 + 291]
6+
0x62,0x8c,0x7a,0x08,0xf2,0x9c,0xac,0x23,0x01,0x00,0x00

llvm/test/MC/X86/apx/invpcid-att.s

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# RUN: llvm-mc -triple x86_64 --show-encoding %s | FileCheck %s
2+
# RUN: not llvm-mc -triple i386 -show-encoding %s 2>&1 | FileCheck %s --check-prefix=ERROR
3+
4+
# ERROR-COUNT-1: error:
5+
# ERROR-NOT: error:
6+
# CHECK: invpcid 291(%r28,%r29,4), %r19
7+
# CHECK: encoding: [0x62,0x8c,0x7a,0x08,0xf2,0x9c,0xac,0x23,0x01,0x00,0x00]
8+
invpcid 291(%r28,%r29,4), %r19

llvm/test/MC/X86/apx/invpcid-intel.s

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# RUN: llvm-mc -triple x86_64 -x86-asm-syntax=intel -output-asm-variant=1 --show-encoding %s | FileCheck %s
2+
3+
# CHECK: invpcid r19, xmmword ptr [r28 + 4*r29 + 291]
4+
# CHECK: encoding: [0x62,0x8c,0x7a,0x08,0xf2,0x9c,0xac,0x23,0x01,0x00,0x00]
5+
invpcid r19, xmmword ptr [r28 + 4*r29 + 291]

0 commit comments

Comments
 (0)