Skip to content

Commit f5adb5b

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

File tree

7 files changed

+49
-0
lines changed

7 files changed

+49
-0
lines changed

llvm/lib/Target/X86/X86InstrVMX.td

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ def INVEPT64 : I<0x80, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
2323
"invept\t{$src2, $src1|$src1, $src2}", []>, T8PD,
2424
Requires<[In64BitMode]>;
2525

26+
let CD8_Scale = 0 in
27+
def INVEPT64_EVEX : I<0xF0, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
28+
"invept\t{$src2, $src1|$src1, $src2}", []>,
29+
EVEX, T_MAP4XS, Requires<[In64BitMode]>;
30+
2631
// 66 0F 38 81
2732
def INVVPID32 : I<0x81, MRMSrcMem, (outs), (ins GR32:$src1, i128mem:$src2),
2833
"invvpid\t{$src2, $src1|$src1, $src2}", []>, T8PD,
@@ -31,6 +36,11 @@ def INVVPID64 : I<0x81, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
3136
"invvpid\t{$src2, $src1|$src1, $src2}", []>, T8PD,
3237
Requires<[In64BitMode]>;
3338

39+
let CD8_Scale = 0 in
40+
def INVVPID64_EVEX : I<0xF1, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
41+
"invvpid\t{$src2, $src1|$src1, $src2}", []>,
42+
EVEX, T_MAP4XS, Requires<[In64BitMode]>;
43+
3444
// 0F 01 C1
3545
def VMCALL : I<0x01, MRM_C1, (outs), (ins), "vmcall", []>, TB;
3646
def VMCLEARm : I<0xC7, MRM6m, (outs), (ins i64mem:$vmcs),
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: invept 123(%r28,%r29,4), %r19
5+
# INTEL: invept r19, xmmword ptr [r28 + 4*r29 + 123]
6+
0x62,0x8c,0x7a,0x08,0xf0,0x5c,0xac,0x7b
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: invvpid 291(%r28,%r29,4), %r19
5+
# INTEL: invvpid r19, xmmword ptr [r28 + 4*r29 + 291]
6+
0x62,0x8c,0x7a,0x08,0xf1,0x9c,0xac,0x23,0x01,0x00,0x00

llvm/test/MC/X86/apx/invept-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: invept 123(%r28,%r29,4), %r19
7+
# CHECK: encoding: [0x62,0x8c,0x7a,0x08,0xf0,0x5c,0xac,0x7b]
8+
invept 123(%r28,%r29,4), %r19

llvm/test/MC/X86/apx/invept-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: invept r19, xmmword ptr [r28 + 4*r29 + 123]
4+
# CHECK: encoding: [0x62,0x8c,0x7a,0x08,0xf0,0x5c,0xac,0x7b]
5+
invept r19, xmmword ptr [r28 + 4*r29 + 123]

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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: invvpid 291(%r28,%r29,4), %r19
7+
# CHECK: encoding: [0x62,0x8c,0x7a,0x08,0xf1,0x9c,0xac,0x23,0x01,0x00,0x00]
8+
invvpid 291(%r28,%r29,4), %r19
9+

llvm/test/MC/X86/apx/invvpid-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: invvpid r19, xmmword ptr [r28 + 4*r29 + 291]
4+
# CHECK: encoding: [0x62,0x8c,0x7a,0x08,0xf1,0x9c,0xac,0x23,0x01,0x00,0x00]
5+
invvpid r19, xmmword ptr [r28 + 4*r29 + 291]

0 commit comments

Comments
 (0)