[llvm] [X86][MC] Add alias for `{evex} cmp` and `{evex} test`. (PR #99277)
Freddy Ye via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 25 02:10:28 PDT 2024
https://github.com/FreddyLeaf updated https://github.com/llvm/llvm-project/pull/99277
>From d6ed15f322bd5c5fac8ee1844f29e81ebeb6f87c Mon Sep 17 00:00:00 2001
From: Freddy Ye <freddy.ye at intel.com>
Date: Thu, 13 Jun 2024 15:45:26 +0800
Subject: [PATCH 1/6] [X86][MC] Add alias for `{evex} cmp` and `{evex} test`.
---
.../lib/Target/X86/AsmParser/X86AsmParser.cpp | 74 +++++++++++-
llvm/test/MC/X86/apx/ccmp-att.s | 108 +++++++++++++++++-
llvm/test/MC/X86/apx/ccmp-intel.s | 81 +++++++++++++
llvm/test/MC/X86/apx/ctest-att.s | 53 ++++++++-
llvm/test/MC/X86/apx/ctest-intel.s | 51 +++++++++
5 files changed, 364 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index e49e96ceef6a4..8e5f713054b14 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -83,6 +83,13 @@ static const char OpPrecedence[] = {
3 // IC_GE
};
+static bool ifCmpOrTestOpcode(std::string &Opcode) {
+ return Opcode == "cmp" || Opcode == "cmpb" || Opcode == "cmpw" ||
+ Opcode == "cmpl" || Opcode == "cmpq" || Opcode == "test" ||
+ Opcode == "testb" || Opcode == "testw" || Opcode == "testl" ||
+ Opcode == "testq";
+}
+
class X86AsmParser : public MCTargetAsmParser {
ParseInstructionInfo *InstInfo;
bool Code16GCC;
@@ -96,6 +103,7 @@ class X86AsmParser : public MCTargetAsmParser {
OpcodePrefix_VEX2,
OpcodePrefix_VEX3,
OpcodePrefix_EVEX,
+ OpcodePrefix_EVEX_CMP_TEST,
};
OpcodePrefix ForcedOpcodePrefix = OpcodePrefix_Default;
@@ -3202,6 +3210,7 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
if (getLexer().isNot(AsmToken::RCurly))
return Error(Parser.getTok().getLoc(), "Expected '}'");
Parser.Lex(); // Eat curly.
+ std::string Opcode = Parser.getTok().getString().lower();
if (Prefix == "rex")
ForcedOpcodePrefix = OpcodePrefix_REX;
@@ -3214,7 +3223,9 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
else if (Prefix == "vex3")
ForcedOpcodePrefix = OpcodePrefix_VEX3;
else if (Prefix == "evex")
- ForcedOpcodePrefix = OpcodePrefix_EVEX;
+ ForcedOpcodePrefix = is64BitMode() && ifCmpOrTestOpcode(Opcode)
+ ? OpcodePrefix_EVEX_CMP_TEST
+ : OpcodePrefix_EVEX;
else if (Prefix == "disp8")
ForcedDispEncoding = DispEncoding_Disp8;
else if (Prefix == "disp32")
@@ -3784,6 +3795,66 @@ bool X86AsmParser::processInstruction(MCInst &Inst, const OperandVector &Ops) {
Inst.setOpcode(X86::INT3);
return true;
}
+#define FROM_TO(FROM, TO) \
+ case X86::FROM: { \
+ if (ForcedOpcodePrefix == OpcodePrefix_EVEX_CMP_TEST) { \
+ Inst.setOpcode(X86::TO); \
+ Inst.addOperand(MCOperand::createImm(15)); \
+ Inst.addOperand(MCOperand::createImm(4)); \
+ return true; \
+ } \
+ return false; \
+ }
+ FROM_TO(CMP64rr, CCMP64rr)
+ FROM_TO(CMP64mi32, CCMP64mi32)
+ FROM_TO(CMP64mi8, CCMP64mi8)
+ FROM_TO(CMP64mr, CCMP64mr)
+ FROM_TO(CMP64ri32, CCMP64ri32)
+ FROM_TO(CMP64ri8, CCMP64ri8)
+ FROM_TO(CMP64rm, CCMP64rm)
+
+ FROM_TO(CMP32rr, CCMP32rr)
+ FROM_TO(CMP32mi, CCMP32mi)
+ FROM_TO(CMP32mi8, CCMP32mi8)
+ FROM_TO(CMP32mr, CCMP32mr)
+ FROM_TO(CMP32ri, CCMP32ri)
+ FROM_TO(CMP32ri8, CCMP32ri8)
+ FROM_TO(CMP32rm, CCMP32rm)
+
+ FROM_TO(CMP16rr, CCMP16rr)
+ FROM_TO(CMP16mi, CCMP16mi)
+ FROM_TO(CMP16mi8, CCMP16mi8)
+ FROM_TO(CMP16mr, CCMP16mr)
+ FROM_TO(CMP16ri, CCMP16ri)
+ FROM_TO(CMP16ri8, CCMP16ri8)
+ FROM_TO(CMP16rm, CCMP16rm)
+
+ FROM_TO(CMP8rr, CCMP8rr)
+ FROM_TO(CMP8mi, CCMP8mi)
+ FROM_TO(CMP8mr, CCMP8mr)
+ FROM_TO(CMP8ri, CCMP8ri)
+ FROM_TO(CMP8rm, CCMP8rm)
+
+ FROM_TO(TEST64rr, CTEST64rr)
+ FROM_TO(TEST64mi32, CTEST64mi32)
+ FROM_TO(TEST64mr, CTEST64mr)
+ FROM_TO(TEST64ri32, CTEST64ri32)
+
+ FROM_TO(TEST32rr, CTEST32rr)
+ FROM_TO(TEST32mi, CTEST32mi)
+ FROM_TO(TEST32mr, CTEST32mr)
+ FROM_TO(TEST32ri, CTEST32ri)
+
+ FROM_TO(TEST16rr, CTEST16rr)
+ FROM_TO(TEST16mi, CTEST16mi)
+ FROM_TO(TEST16mr, CTEST16mr)
+ FROM_TO(TEST16ri, CTEST16ri)
+
+ FROM_TO(TEST8rr, CTEST8rr)
+ FROM_TO(TEST8mi, CTEST8mi)
+ FROM_TO(TEST8mr, CTEST8mr)
+ FROM_TO(TEST8ri, CTEST8ri)
+#undef FROM_TO
}
}
@@ -4122,6 +4193,7 @@ unsigned X86AsmParser::checkTargetMatchPredicate(MCInst &Inst) {
switch (ForcedOpcodePrefix) {
case OpcodePrefix_Default:
+ case OpcodePrefix_EVEX_CMP_TEST:
break;
case OpcodePrefix_REX:
case OpcodePrefix_REX2:
diff --git a/llvm/test/MC/X86/apx/ccmp-att.s b/llvm/test/MC/X86/apx/ccmp-att.s
index 405071b0f4310..10b81d2f2555d 100644
--- a/llvm/test/MC/X86/apx/ccmp-att.s
+++ b/llvm/test/MC/X86/apx/ccmp-att.s
@@ -1,7 +1,7 @@
# RUN: llvm-mc -triple x86_64 -show-encoding %s | FileCheck %s
# RUN: not llvm-mc -triple i386 -show-encoding %s 2>&1 | FileCheck %s --check-prefix=ERROR
-# ERROR-COUNT-402: error:
+# ERROR-COUNT-428: error:
# ERROR-NOT: error:
## Condition flags
@@ -1217,3 +1217,109 @@
# CHECK: ccmpoq {dfv=of,sf,zf,cf} %rax, %rbx
# CHECK: encoding: [0x62,0xf4,0xfc,0x00,0x39,0xc3]
ccmpoq {dFV=Cf,zF,SF,of} %rax, %rbx
+
+## "{evex} cmp*" are alias for "ccmpe* {dfv=of,sf,zf,cf}"
+
+# CHECK: ccmpeb {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x80,0x7c,0x80,0x7b,0x7b]
+{evex} cmpb $123, 123(%r8,%rax,4)
+
+# CHECK: ccmpew {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x83,0x7c,0x80,0x7b,0x7b]
+{evex} cmpw $123, 123(%r8,%rax,4)
+
+# CHECK: ccmpew {dfv=of,sf,zf,cf} $1234, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x81,0x7c,0x80,0x7b,0xd2,0x04]
+{evex} cmpw $1234, 123(%r8,%rax,4)
+
+# CHECK: ccmpel {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x83,0x7c,0x80,0x7b,0x7b]
+{evex} cmpl $123, 123(%r8,%rax,4)
+
+# CHECK: ccmpel {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
+{evex} cmpl $123456, 123(%r8,%rax,4)
+
+# CHECK: ccmpeq {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x83,0x7c,0x80,0x7b,0x7b]
+{evex} cmpq $123, 123(%r8,%rax,4)
+
+# CHECK: ccmpeq {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
+{evex} cmpq $123456, 123(%r8,%rax,4)
+
+# CHECK: ccmpeb {dfv=of,sf,zf,cf} %bl, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x38,0x5c,0x80,0x7b]
+{evex} cmpb %bl, 123(%r8,%rax,4)
+
+# CHECK: ccmpew {dfv=of,sf,zf,cf} %dx, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x39,0x54,0x80,0x7b]
+{evex} cmpw %dx, 123(%r8,%rax,4)
+
+# CHECK: ccmpel {dfv=of,sf,zf,cf} %ecx, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x39,0x4c,0x80,0x7b]
+{evex} cmpl %ecx, 123(%r8,%rax,4)
+
+# CHECK: ccmpeq {dfv=of,sf,zf,cf} %r9, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x39,0x4c,0x80,0x7b]
+{evex} cmpq %r9, 123(%r8,%rax,4)
+
+# CHECK: ccmpeb {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %bl
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x3a,0x5c,0x80,0x7b]
+{evex} cmpb 123(%r8,%rax,4), %bl
+
+# CHECK: ccmpew {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %dx
+# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x3b,0x54,0x80,0x7b]
+{evex} cmpw 123(%r8,%rax,4), %dx
+
+# CHECK: ccmpel {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %ecx
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x3b,0x4c,0x80,0x7b]
+{evex} cmpl 123(%r8,%rax,4), %ecx
+
+# CHECK: ccmpeq {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %r9
+# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x3b,0x4c,0x80,0x7b]
+{evex} cmpq 123(%r8,%rax,4), %r9
+
+# CHECK: ccmpeb {dfv=of,sf,zf,cf} $123, %bl
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x80,0xfb,0x7b]
+{evex} cmpb $123, %bl
+
+# CHECK: ccmpew {dfv=of,sf,zf,cf} $123, %dx
+# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x83,0xfa,0x7b]
+{evex} cmpw $123, %dx
+
+# CHECK: ccmpel {dfv=of,sf,zf,cf} $123, %ecx
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x83,0xf9,0x7b]
+{evex} cmpl $123, %ecx
+
+# CHECK: ccmpeq {dfv=of,sf,zf,cf} $123, %r9
+# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x83,0xf9,0x7b]
+{evex} cmpq $123, %r9
+
+# CHECK: ccmpew {dfv=of,sf,zf,cf} $1234, %dx
+# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x81,0xfa,0xd2,0x04]
+{evex} cmpw $1234, %dx
+
+# CHECK: ccmpel {dfv=of,sf,zf,cf} $123456, %ecx
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x81,0xf9,0x40,0xe2,0x01,0x00]
+{evex} cmpl $123456, %ecx
+
+# CHECK: ccmpeq {dfv=of,sf,zf,cf} $123456, %r9
+# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x81,0xf9,0x40,0xe2,0x01,0x00]
+{evex} cmpq $123456, %r9
+
+# CHECK: ccmpeb {dfv=of,sf,zf,cf} %bl, %dl
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x38,0xda]
+{evex} cmpb %bl, %dl
+
+# CHECK: ccmpew {dfv=of,sf,zf,cf} %dx, %ax
+# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x39,0xd0]
+{evex} cmpw %dx, %ax
+
+# CHECK: ccmpel {dfv=of,sf,zf,cf} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x39,0xca]
+{evex} cmpl %ecx, %edx
+
+# CHECK: ccmpeq {dfv=of,sf,zf,cf} %r9, %r15
+# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x39,0xcf]
+{evex} cmpq %r9, %r15
diff --git a/llvm/test/MC/X86/apx/ccmp-intel.s b/llvm/test/MC/X86/apx/ccmp-intel.s
index 2d446b053d94e..9123a2e6940f0 100644
--- a/llvm/test/MC/X86/apx/ccmp-intel.s
+++ b/llvm/test/MC/X86/apx/ccmp-intel.s
@@ -1214,3 +1214,84 @@
# CHECK: ccmpo {dfv=of,sf,zf,cf} rbx, rax
# CHECK: encoding: [0x62,0xf4,0xfc,0x00,0x39,0xc3]
ccmpo {DFv=Cf,zF,SF,of} rbx, rax
+
+## "{evex} cmp*" are alias for "ccmpe* {dfv=of,sf,zf,cf}"
+
+# CHECK: ccmpe {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x80,0x7c,0x80,0x7b,0x7b]
+ {evex} cmp byte ptr [r8 + 4*rax + 123], 123
+# CHECK: ccmpe {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x83,0x7c,0x80,0x7b,0x7b]
+ {evex} cmp word ptr [r8 + 4*rax + 123], 123
+# CHECK: ccmpe {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], 1234
+# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x81,0x7c,0x80,0x7b,0xd2,0x04]
+ {evex} cmp word ptr [r8 + 4*rax + 123], 1234
+# CHECK: ccmpe {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x83,0x7c,0x80,0x7b,0x7b]
+ {evex} cmp dword ptr [r8 + 4*rax + 123], 123
+# CHECK: ccmpe {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], 123456
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ {evex} cmp dword ptr [r8 + 4*rax + 123], 123456
+# CHECK: ccmpe {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x83,0x7c,0x80,0x7b,0x7b]
+ {evex} cmp qword ptr [r8 + 4*rax + 123], 123
+# CHECK: ccmpe {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], 123456
+# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ {evex} cmp qword ptr [r8 + 4*rax + 123], 123456
+# CHECK: ccmpe {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], bl
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x38,0x5c,0x80,0x7b]
+ {evex} cmp byte ptr [r8 + 4*rax + 123], bl
+# CHECK: ccmpe {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], dx
+# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x39,0x54,0x80,0x7b]
+ {evex} cmp word ptr [r8 + 4*rax + 123], dx
+# CHECK: ccmpe {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], ecx
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x39,0x4c,0x80,0x7b]
+ {evex} cmp dword ptr [r8 + 4*rax + 123], ecx
+# CHECK: ccmpe {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], r9
+# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x39,0x4c,0x80,0x7b]
+ {evex} cmp qword ptr [r8 + 4*rax + 123], r9
+# CHECK: ccmpe {dfv=of,sf,zf,cf} bl, byte ptr [r8 + 4*rax + 123]
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x3a,0x5c,0x80,0x7b]
+ {evex} cmp bl, byte ptr [r8 + 4*rax + 123]
+# CHECK: ccmpe {dfv=of,sf,zf,cf} dx, word ptr [r8 + 4*rax + 123]
+# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x3b,0x54,0x80,0x7b]
+ {evex} cmp dx, word ptr [r8 + 4*rax + 123]
+# CHECK: ccmpe {dfv=of,sf,zf,cf} ecx, dword ptr [r8 + 4*rax + 123]
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x3b,0x4c,0x80,0x7b]
+ {evex} cmp ecx, dword ptr [r8 + 4*rax + 123]
+# CHECK: ccmpe {dfv=of,sf,zf,cf} r9, qword ptr [r8 + 4*rax + 123]
+# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x3b,0x4c,0x80,0x7b]
+ {evex} cmp r9, qword ptr [r8 + 4*rax + 123]
+# CHECK: ccmpe {dfv=of,sf,zf,cf} bl, 123
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x80,0xfb,0x7b]
+ {evex} cmp bl, 123
+# CHECK: ccmpe {dfv=of,sf,zf,cf} dx, 123
+# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x83,0xfa,0x7b]
+ {evex} cmp dx, 123
+# CHECK: ccmpe {dfv=of,sf,zf,cf} ecx, 123
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x83,0xf9,0x7b]
+ {evex} cmp ecx, 123
+# CHECK: ccmpe {dfv=of,sf,zf,cf} r9, 123
+# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x83,0xf9,0x7b]
+ {evex} cmp r9, 123
+# CHECK: ccmpe {dfv=of,sf,zf,cf} dx, 1234
+# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x81,0xfa,0xd2,0x04]
+ {evex} cmp dx, 1234
+# CHECK: ccmpe {dfv=of,sf,zf,cf} ecx, 123456
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x81,0xf9,0x40,0xe2,0x01,0x00]
+ {evex} cmp ecx, 123456
+# CHECK: ccmpe {dfv=of,sf,zf,cf} r9, 123456
+# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x81,0xf9,0x40,0xe2,0x01,0x00]
+ {evex} cmp r9, 123456
+# CHECK: ccmpe {dfv=of,sf,zf,cf} dl, bl
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x38,0xda]
+ {evex} cmp dl, bl
+# CHECK: ccmpe {dfv=of,sf,zf,cf} ax, dx
+# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x39,0xd0]
+ {evex} cmp ax, dx
+# CHECK: ccmpe {dfv=of,sf,zf,cf} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x39,0xca]
+ {evex} cmp edx, ecx
+# CHECK: ccmpe {dfv=of,sf,zf,cf} r15, r9
+# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x39,0xcf]
+ {evex} cmp r15, r9
diff --git a/llvm/test/MC/X86/apx/ctest-att.s b/llvm/test/MC/X86/apx/ctest-att.s
index b9e98adc9841b..fa510f2c8fec5 100644
--- a/llvm/test/MC/X86/apx/ctest-att.s
+++ b/llvm/test/MC/X86/apx/ctest-att.s
@@ -1,7 +1,7 @@
# RUN: llvm-mc -triple x86_64 -show-encoding %s | FileCheck %s
# RUN: not llvm-mc -triple i386 -show-encoding %s 2>&1 | FileCheck %s --check-prefix=ERROR
-# ERROR-COUNT-256: error:
+# ERROR-COUNT-272: error:
# ERROR-NOT: error:
# CHECK: ctestbb {dfv=of} $123, 123(%r8,%rax,4)
# CHECK: encoding: [0x62,0xd4,0x44,0x02,0xf6,0x44,0x80,0x7b,0x7b]
@@ -771,3 +771,54 @@
# CHECK: ctesteq {dfv=of} %r9, %r15
# CHECK: encoding: [0x62,0x54,0xc4,0x04,0x85,0xcf]
ctesteq {dfv=of} %r9, %r15
+
+## "{evex} test*" are alias for "cteste* {dfv=of,sf,zf,cf}"
+
+# CHECK: ctesteb {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0xf6,0x44,0x80,0x7b,0x7b]
+ {evex} testb $123, 123(%r8,%rax,4)
+# CHECK: ctestew {dfv=of,sf,zf,cf} $1234, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0xf7,0x44,0x80,0x7b,0xd2,0x04]
+ {evex} testw $1234, 123(%r8,%rax,4)
+# CHECK: ctestel {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ {evex} testl $123456, 123(%r8,%rax,4)
+# CHECK: ctesteq {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ {evex} testq $123456, 123(%r8,%rax,4)
+# CHECK: ctesteb {dfv=of,sf,zf,cf} %bl, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x84,0x5c,0x80,0x7b]
+ {evex} testb %bl, 123(%r8,%rax,4)
+# CHECK: ctestew {dfv=of,sf,zf,cf} %dx, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x85,0x54,0x80,0x7b]
+ {evex} testw %dx, 123(%r8,%rax,4)
+# CHECK: ctestel {dfv=of,sf,zf,cf} %ecx, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x85,0x4c,0x80,0x7b]
+ {evex} testl %ecx, 123(%r8,%rax,4)
+# CHECK: ctesteq {dfv=of,sf,zf,cf} %r9, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x85,0x4c,0x80,0x7b]
+ {evex} testq %r9, 123(%r8,%rax,4)
+# CHECK: ctesteb {dfv=of,sf,zf,cf} $123, %bl
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0xf6,0xc3,0x7b]
+ {evex} testb $123, %bl
+# CHECK: ctestew {dfv=of,sf,zf,cf} $1234, %dx
+# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0xf7,0xc2,0xd2,0x04]
+ {evex} testw $1234, %dx
+# CHECK: ctestel {dfv=of,sf,zf,cf} $123456, %ecx
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0xf7,0xc1,0x40,0xe2,0x01,0x00]
+ {evex} testl $123456, %ecx
+# CHECK: ctesteq {dfv=of,sf,zf,cf} $123456, %r9
+# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0xf7,0xc1,0x40,0xe2,0x01,0x00]
+ {evex} testq $123456, %r9
+# CHECK: ctesteb {dfv=of,sf,zf,cf} %bl, %dl
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x84,0xda]
+ {evex} testb %bl, %dl
+# CHECK: ctestew {dfv=of,sf,zf,cf} %dx, %ax
+# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x85,0xd0]
+ {evex} testw %dx, %ax
+# CHECK: ctestel {dfv=of,sf,zf,cf} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x85,0xca]
+ {evex} testl %ecx, %edx
+# CHECK: ctesteq {dfv=of,sf,zf,cf} %r9, %r15
+# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x85,0xcf]
+ {evex} testq %r9, %r15
diff --git a/llvm/test/MC/X86/apx/ctest-intel.s b/llvm/test/MC/X86/apx/ctest-intel.s
index 17cea489b4765..23210bd75fe15 100644
--- a/llvm/test/MC/X86/apx/ctest-intel.s
+++ b/llvm/test/MC/X86/apx/ctest-intel.s
@@ -768,3 +768,54 @@
# CHECK: cteste {dfv=of} r15, r9
# CHECK: encoding: [0x62,0x54,0xc4,0x04,0x85,0xcf]
cteste {dfv=of} r15, r9
+
+## "{evex} test*" are alias for "cteste* {dfv=of,sf,zf,cf}"
+
+# CHECK: cteste {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0xf6,0x44,0x80,0x7b,0x7b]
+ {evex} test byte ptr [r8 + 4*rax + 123], 123
+# CHECK: cteste {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], 1234
+# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0xf7,0x44,0x80,0x7b,0xd2,0x04]
+ {evex} test word ptr [r8 + 4*rax + 123], 1234
+# CHECK: cteste {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], 123456
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ {evex} test dword ptr [r8 + 4*rax + 123], 123456
+# CHECK: cteste {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], 123456
+# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ {evex} test qword ptr [r8 + 4*rax + 123], 123456
+# CHECK: cteste {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], bl
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x84,0x5c,0x80,0x7b]
+ {evex} test byte ptr [r8 + 4*rax + 123], bl
+# CHECK: cteste {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], dx
+# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x85,0x54,0x80,0x7b]
+ {evex} test word ptr [r8 + 4*rax + 123], dx
+# CHECK: cteste {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], ecx
+# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x85,0x4c,0x80,0x7b]
+ {evex} test dword ptr [r8 + 4*rax + 123], ecx
+# CHECK: cteste {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], r9
+# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x85,0x4c,0x80,0x7b]
+ {evex} test qword ptr [r8 + 4*rax + 123], r9
+# CHECK: cteste {dfv=of,sf,zf,cf} bl, 123
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0xf6,0xc3,0x7b]
+ {evex} test bl, 123
+# CHECK: cteste {dfv=of,sf,zf,cf} dx, 1234
+# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0xf7,0xc2,0xd2,0x04]
+ {evex} test dx, 1234
+# CHECK: cteste {dfv=of,sf,zf,cf} ecx, 123456
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0xf7,0xc1,0x40,0xe2,0x01,0x00]
+ {evex} test ecx, 123456
+# CHECK: cteste {dfv=of,sf,zf,cf} r9, 123456
+# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0xf7,0xc1,0x40,0xe2,0x01,0x00]
+ {evex} test r9, 123456
+# CHECK: cteste {dfv=of,sf,zf,cf} dl, bl
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x84,0xda]
+ {evex} test dl, bl
+# CHECK: cteste {dfv=of,sf,zf,cf} ax, dx
+# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x85,0xd0]
+ {evex} test ax, dx
+# CHECK: cteste {dfv=of,sf,zf,cf} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x85,0xca]
+ {evex} test edx, ecx
+# CHECK: cteste {dfv=of,sf,zf,cf} r15, r9
+# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x85,0xcf]
+ {evex} test r15, r9
>From 1edff3ab2eab856d7720af248dc03b58ac5da4f8 Mon Sep 17 00:00:00 2001
From: Freddy Ye <freddy.ye at intel.com>
Date: Wed, 17 Jul 2024 15:07:08 +0800
Subject: [PATCH 2/6] change e into t
---
.../lib/Target/X86/AsmParser/X86AsmParser.cpp | 2 +-
llvm/test/MC/X86/apx/ccmp-att.s | 183 ++++++++----------
llvm/test/MC/X86/apx/ccmp-intel.s | 159 +++++++--------
llvm/test/MC/X86/apx/ctest-att.s | 66 +++----
llvm/test/MC/X86/apx/ctest-intel.s | 68 +++----
5 files changed, 228 insertions(+), 250 deletions(-)
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 8e5f713054b14..183b322394d87 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -3800,7 +3800,7 @@ bool X86AsmParser::processInstruction(MCInst &Inst, const OperandVector &Ops) {
if (ForcedOpcodePrefix == OpcodePrefix_EVEX_CMP_TEST) { \
Inst.setOpcode(X86::TO); \
Inst.addOperand(MCOperand::createImm(15)); \
- Inst.addOperand(MCOperand::createImm(4)); \
+ Inst.addOperand(MCOperand::createImm(10)); \
return true; \
} \
return false; \
diff --git a/llvm/test/MC/X86/apx/ccmp-att.s b/llvm/test/MC/X86/apx/ccmp-att.s
index 10b81d2f2555d..4dd54df7b370a 100644
--- a/llvm/test/MC/X86/apx/ccmp-att.s
+++ b/llvm/test/MC/X86/apx/ccmp-att.s
@@ -1218,108 +1218,83 @@
# CHECK: encoding: [0x62,0xf4,0xfc,0x00,0x39,0xc3]
ccmpoq {dFV=Cf,zF,SF,of} %rax, %rbx
-## "{evex} cmp*" are alias for "ccmpe* {dfv=of,sf,zf,cf}"
+## "{evex} cmp*" are alias for "ccmpt* {dfv=of,sf,zf,cf}"
-# CHECK: ccmpeb {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x80,0x7c,0x80,0x7b,0x7b]
-{evex} cmpb $123, 123(%r8,%rax,4)
-
-# CHECK: ccmpew {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x83,0x7c,0x80,0x7b,0x7b]
-{evex} cmpw $123, 123(%r8,%rax,4)
-
-# CHECK: ccmpew {dfv=of,sf,zf,cf} $1234, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x81,0x7c,0x80,0x7b,0xd2,0x04]
-{evex} cmpw $1234, 123(%r8,%rax,4)
-
-# CHECK: ccmpel {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x83,0x7c,0x80,0x7b,0x7b]
-{evex} cmpl $123, 123(%r8,%rax,4)
-
-# CHECK: ccmpel {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
-{evex} cmpl $123456, 123(%r8,%rax,4)
-
-# CHECK: ccmpeq {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x83,0x7c,0x80,0x7b,0x7b]
-{evex} cmpq $123, 123(%r8,%rax,4)
-
-# CHECK: ccmpeq {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
-{evex} cmpq $123456, 123(%r8,%rax,4)
-
-# CHECK: ccmpeb {dfv=of,sf,zf,cf} %bl, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x38,0x5c,0x80,0x7b]
-{evex} cmpb %bl, 123(%r8,%rax,4)
-
-# CHECK: ccmpew {dfv=of,sf,zf,cf} %dx, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x39,0x54,0x80,0x7b]
-{evex} cmpw %dx, 123(%r8,%rax,4)
-
-# CHECK: ccmpel {dfv=of,sf,zf,cf} %ecx, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x39,0x4c,0x80,0x7b]
-{evex} cmpl %ecx, 123(%r8,%rax,4)
-
-# CHECK: ccmpeq {dfv=of,sf,zf,cf} %r9, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x39,0x4c,0x80,0x7b]
-{evex} cmpq %r9, 123(%r8,%rax,4)
-
-# CHECK: ccmpeb {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %bl
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x3a,0x5c,0x80,0x7b]
-{evex} cmpb 123(%r8,%rax,4), %bl
-
-# CHECK: ccmpew {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %dx
-# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x3b,0x54,0x80,0x7b]
-{evex} cmpw 123(%r8,%rax,4), %dx
-
-# CHECK: ccmpel {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %ecx
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x3b,0x4c,0x80,0x7b]
-{evex} cmpl 123(%r8,%rax,4), %ecx
-
-# CHECK: ccmpeq {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %r9
-# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x3b,0x4c,0x80,0x7b]
-{evex} cmpq 123(%r8,%rax,4), %r9
-
-# CHECK: ccmpeb {dfv=of,sf,zf,cf} $123, %bl
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x80,0xfb,0x7b]
-{evex} cmpb $123, %bl
-
-# CHECK: ccmpew {dfv=of,sf,zf,cf} $123, %dx
-# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x83,0xfa,0x7b]
-{evex} cmpw $123, %dx
-
-# CHECK: ccmpel {dfv=of,sf,zf,cf} $123, %ecx
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x83,0xf9,0x7b]
-{evex} cmpl $123, %ecx
-
-# CHECK: ccmpeq {dfv=of,sf,zf,cf} $123, %r9
-# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x83,0xf9,0x7b]
-{evex} cmpq $123, %r9
-
-# CHECK: ccmpew {dfv=of,sf,zf,cf} $1234, %dx
-# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x81,0xfa,0xd2,0x04]
-{evex} cmpw $1234, %dx
-
-# CHECK: ccmpel {dfv=of,sf,zf,cf} $123456, %ecx
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x81,0xf9,0x40,0xe2,0x01,0x00]
-{evex} cmpl $123456, %ecx
-
-# CHECK: ccmpeq {dfv=of,sf,zf,cf} $123456, %r9
-# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x81,0xf9,0x40,0xe2,0x01,0x00]
-{evex} cmpq $123456, %r9
-
-# CHECK: ccmpeb {dfv=of,sf,zf,cf} %bl, %dl
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x38,0xda]
-{evex} cmpb %bl, %dl
-
-# CHECK: ccmpew {dfv=of,sf,zf,cf} %dx, %ax
-# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x39,0xd0]
-{evex} cmpw %dx, %ax
-
-# CHECK: ccmpel {dfv=of,sf,zf,cf} %ecx, %edx
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x39,0xca]
-{evex} cmpl %ecx, %edx
-
-# CHECK: ccmpeq {dfv=of,sf,zf,cf} %r9, %r15
-# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x39,0xcf]
-{evex} cmpq %r9, %r15
+# CHECK: ccmptb {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x80,0x7c,0x80,0x7b,0x7b]
+ {evex} cmpb $123, 123(%r8,%rax,4)
+# CHECK: ccmptw {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
+ {evex} cmpw $123, 123(%r8,%rax,4)
+# CHECK: ccmptw {dfv=of,sf,zf,cf} $1234, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x81,0x7c,0x80,0x7b,0xd2,0x04]
+ {evex} cmpw $1234, 123(%r8,%rax,4)
+# CHECK: ccmptl {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
+ {evex} cmpl $123, 123(%r8,%rax,4)
+# CHECK: ccmptl {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ {evex} cmpl $123456, 123(%r8,%rax,4)
+# CHECK: ccmptq {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
+ {evex} cmpq $123, 123(%r8,%rax,4)
+# CHECK: ccmptq {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ {evex} cmpq $123456, 123(%r8,%rax,4)
+# CHECK: ccmptb {dfv=of,sf,zf,cf} %bl, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x38,0x5c,0x80,0x7b]
+ {evex} cmpb %bl, 123(%r8,%rax,4)
+# CHECK: ccmptw {dfv=of,sf,zf,cf} %dx, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x39,0x54,0x80,0x7b]
+ {evex} cmpw %dx, 123(%r8,%rax,4)
+# CHECK: ccmptl {dfv=of,sf,zf,cf} %ecx, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x39,0x4c,0x80,0x7b]
+ {evex} cmpl %ecx, 123(%r8,%rax,4)
+# CHECK: ccmptq {dfv=of,sf,zf,cf} %r9, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x39,0x4c,0x80,0x7b]
+ {evex} cmpq %r9, 123(%r8,%rax,4)
+# CHECK: ccmptb {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %bl
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x3a,0x5c,0x80,0x7b]
+ {evex} cmpb 123(%r8,%rax,4), %bl
+# CHECK: ccmptw {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %dx
+# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x3b,0x54,0x80,0x7b]
+ {evex} cmpw 123(%r8,%rax,4), %dx
+# CHECK: ccmptl {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %ecx
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x3b,0x4c,0x80,0x7b]
+ {evex} cmpl 123(%r8,%rax,4), %ecx
+# CHECK: ccmptq {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %r9
+# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x3b,0x4c,0x80,0x7b]
+ {evex} cmpq 123(%r8,%rax,4), %r9
+# CHECK: ccmptb {dfv=of,sf,zf,cf} $123, %bl
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x80,0xfb,0x7b]
+ {evex} cmpb $123, %bl
+# CHECK: ccmptw {dfv=of,sf,zf,cf} $123, %dx
+# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x83,0xfa,0x7b]
+ {evex} cmpw $123, %dx
+# CHECK: ccmptl {dfv=of,sf,zf,cf} $123, %ecx
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x83,0xf9,0x7b]
+ {evex} cmpl $123, %ecx
+# CHECK: ccmptq {dfv=of,sf,zf,cf} $123, %r9
+# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x83,0xf9,0x7b]
+ {evex} cmpq $123, %r9
+# CHECK: ccmptw {dfv=of,sf,zf,cf} $1234, %dx
+# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x81,0xfa,0xd2,0x04]
+ {evex} cmpw $1234, %dx
+# CHECK: ccmptl {dfv=of,sf,zf,cf} $123456, %ecx
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x81,0xf9,0x40,0xe2,0x01,0x00]
+ {evex} cmpl $123456, %ecx
+# CHECK: ccmptq {dfv=of,sf,zf,cf} $123456, %r9
+# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x81,0xf9,0x40,0xe2,0x01,0x00]
+ {evex} cmpq $123456, %r9
+# CHECK: ccmptb {dfv=of,sf,zf,cf} %bl, %dl
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x38,0xda]
+ {evex} cmpb %bl, %dl
+# CHECK: ccmptw {dfv=of,sf,zf,cf} %dx, %ax
+# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x39,0xd0]
+ {evex} cmpw %dx, %ax
+# CHECK: ccmptl {dfv=of,sf,zf,cf} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x39,0xca]
+ {evex} cmpl %ecx, %edx
+# CHECK: ccmptq {dfv=of,sf,zf,cf} %r9, %r15
+# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x39,0xcf]
+ {evex} cmpq %r9, %r15
diff --git a/llvm/test/MC/X86/apx/ccmp-intel.s b/llvm/test/MC/X86/apx/ccmp-intel.s
index 9123a2e6940f0..d3b649ee48208 100644
--- a/llvm/test/MC/X86/apx/ccmp-intel.s
+++ b/llvm/test/MC/X86/apx/ccmp-intel.s
@@ -1215,83 +1215,84 @@
# CHECK: encoding: [0x62,0xf4,0xfc,0x00,0x39,0xc3]
ccmpo {DFv=Cf,zF,SF,of} rbx, rax
-## "{evex} cmp*" are alias for "ccmpe* {dfv=of,sf,zf,cf}"
+## "{evex} cmp*" are alias for "ccmpt* {dfv=of,sf,zf,cf}"
+
+# CHECK: ccmpt {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x80,0x7c,0x80,0x7b,0x7b]
+ {evex} cmp byte ptr [r8 + 4*rax + 123], 123
+# CHECK: ccmpt {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
+ {evex} cmp word ptr [r8 + 4*rax + 123], 123
+# CHECK: ccmpt {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], 1234
+# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x81,0x7c,0x80,0x7b,0xd2,0x04]
+ {evex} cmp word ptr [r8 + 4*rax + 123], 1234
+# CHECK: ccmpt {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
+ {evex} cmp dword ptr [r8 + 4*rax + 123], 123
+# CHECK: ccmpt {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], 123456
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ {evex} cmp dword ptr [r8 + 4*rax + 123], 123456
+# CHECK: ccmpt {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
+ {evex} cmp qword ptr [r8 + 4*rax + 123], 123
+# CHECK: ccmpt {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], 123456
+# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ {evex} cmp qword ptr [r8 + 4*rax + 123], 123456
+# CHECK: ccmpt {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], bl
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x38,0x5c,0x80,0x7b]
+ {evex} cmp byte ptr [r8 + 4*rax + 123], bl
+# CHECK: ccmpt {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], dx
+# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x39,0x54,0x80,0x7b]
+ {evex} cmp word ptr [r8 + 4*rax + 123], dx
+# CHECK: ccmpt {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], ecx
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x39,0x4c,0x80,0x7b]
+ {evex} cmp dword ptr [r8 + 4*rax + 123], ecx
+# CHECK: ccmpt {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], r9
+# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x39,0x4c,0x80,0x7b]
+ {evex} cmp qword ptr [r8 + 4*rax + 123], r9
+# CHECK: ccmpt {dfv=of,sf,zf,cf} bl, byte ptr [r8 + 4*rax + 123]
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x3a,0x5c,0x80,0x7b]
+ {evex} cmp bl, byte ptr [r8 + 4*rax + 123]
+# CHECK: ccmpt {dfv=of,sf,zf,cf} dx, word ptr [r8 + 4*rax + 123]
+# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x3b,0x54,0x80,0x7b]
+ {evex} cmp dx, word ptr [r8 + 4*rax + 123]
+# CHECK: ccmpt {dfv=of,sf,zf,cf} ecx, dword ptr [r8 + 4*rax + 123]
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x3b,0x4c,0x80,0x7b]
+ {evex} cmp ecx, dword ptr [r8 + 4*rax + 123]
+# CHECK: ccmpt {dfv=of,sf,zf,cf} r9, qword ptr [r8 + 4*rax + 123]
+# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x3b,0x4c,0x80,0x7b]
+ {evex} cmp r9, qword ptr [r8 + 4*rax + 123]
+# CHECK: ccmpt {dfv=of,sf,zf,cf} bl, 123
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x80,0xfb,0x7b]
+ {evex} cmp bl, 123
+# CHECK: ccmpt {dfv=of,sf,zf,cf} dx, 123
+# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x83,0xfa,0x7b]
+ {evex} cmp dx, 123
+# CHECK: ccmpt {dfv=of,sf,zf,cf} ecx, 123
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x83,0xf9,0x7b]
+ {evex} cmp ecx, 123
+# CHECK: ccmpt {dfv=of,sf,zf,cf} r9, 123
+# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x83,0xf9,0x7b]
+ {evex} cmp r9, 123
+# CHECK: ccmpt {dfv=of,sf,zf,cf} dx, 1234
+# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x81,0xfa,0xd2,0x04]
+ {evex} cmp dx, 1234
+# CHECK: ccmpt {dfv=of,sf,zf,cf} ecx, 123456
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x81,0xf9,0x40,0xe2,0x01,0x00]
+ {evex} cmp ecx, 123456
+# CHECK: ccmpt {dfv=of,sf,zf,cf} r9, 123456
+# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x81,0xf9,0x40,0xe2,0x01,0x00]
+ {evex} cmp r9, 123456
+# CHECK: ccmpt {dfv=of,sf,zf,cf} dl, bl
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x38,0xda]
+ {evex} cmp dl, bl
+# CHECK: ccmpt {dfv=of,sf,zf,cf} ax, dx
+# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x39,0xd0]
+ {evex} cmp ax, dx
+# CHECK: ccmpt {dfv=of,sf,zf,cf} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x39,0xca]
+ {evex} cmp edx, ecx
+# CHECK: ccmpt {dfv=of,sf,zf,cf} r15, r9
+# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x39,0xcf]
+ {evex} cmp r15, r9
-# CHECK: ccmpe {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], 123
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x80,0x7c,0x80,0x7b,0x7b]
- {evex} cmp byte ptr [r8 + 4*rax + 123], 123
-# CHECK: ccmpe {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], 123
-# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x83,0x7c,0x80,0x7b,0x7b]
- {evex} cmp word ptr [r8 + 4*rax + 123], 123
-# CHECK: ccmpe {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], 1234
-# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x81,0x7c,0x80,0x7b,0xd2,0x04]
- {evex} cmp word ptr [r8 + 4*rax + 123], 1234
-# CHECK: ccmpe {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], 123
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x83,0x7c,0x80,0x7b,0x7b]
- {evex} cmp dword ptr [r8 + 4*rax + 123], 123
-# CHECK: ccmpe {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], 123456
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
- {evex} cmp dword ptr [r8 + 4*rax + 123], 123456
-# CHECK: ccmpe {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], 123
-# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x83,0x7c,0x80,0x7b,0x7b]
- {evex} cmp qword ptr [r8 + 4*rax + 123], 123
-# CHECK: ccmpe {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], 123456
-# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
- {evex} cmp qword ptr [r8 + 4*rax + 123], 123456
-# CHECK: ccmpe {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], bl
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x38,0x5c,0x80,0x7b]
- {evex} cmp byte ptr [r8 + 4*rax + 123], bl
-# CHECK: ccmpe {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], dx
-# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x39,0x54,0x80,0x7b]
- {evex} cmp word ptr [r8 + 4*rax + 123], dx
-# CHECK: ccmpe {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], ecx
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x39,0x4c,0x80,0x7b]
- {evex} cmp dword ptr [r8 + 4*rax + 123], ecx
-# CHECK: ccmpe {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], r9
-# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x39,0x4c,0x80,0x7b]
- {evex} cmp qword ptr [r8 + 4*rax + 123], r9
-# CHECK: ccmpe {dfv=of,sf,zf,cf} bl, byte ptr [r8 + 4*rax + 123]
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x3a,0x5c,0x80,0x7b]
- {evex} cmp bl, byte ptr [r8 + 4*rax + 123]
-# CHECK: ccmpe {dfv=of,sf,zf,cf} dx, word ptr [r8 + 4*rax + 123]
-# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x3b,0x54,0x80,0x7b]
- {evex} cmp dx, word ptr [r8 + 4*rax + 123]
-# CHECK: ccmpe {dfv=of,sf,zf,cf} ecx, dword ptr [r8 + 4*rax + 123]
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x3b,0x4c,0x80,0x7b]
- {evex} cmp ecx, dword ptr [r8 + 4*rax + 123]
-# CHECK: ccmpe {dfv=of,sf,zf,cf} r9, qword ptr [r8 + 4*rax + 123]
-# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x3b,0x4c,0x80,0x7b]
- {evex} cmp r9, qword ptr [r8 + 4*rax + 123]
-# CHECK: ccmpe {dfv=of,sf,zf,cf} bl, 123
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x80,0xfb,0x7b]
- {evex} cmp bl, 123
-# CHECK: ccmpe {dfv=of,sf,zf,cf} dx, 123
-# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x83,0xfa,0x7b]
- {evex} cmp dx, 123
-# CHECK: ccmpe {dfv=of,sf,zf,cf} ecx, 123
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x83,0xf9,0x7b]
- {evex} cmp ecx, 123
-# CHECK: ccmpe {dfv=of,sf,zf,cf} r9, 123
-# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x83,0xf9,0x7b]
- {evex} cmp r9, 123
-# CHECK: ccmpe {dfv=of,sf,zf,cf} dx, 1234
-# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x81,0xfa,0xd2,0x04]
- {evex} cmp dx, 1234
-# CHECK: ccmpe {dfv=of,sf,zf,cf} ecx, 123456
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x81,0xf9,0x40,0xe2,0x01,0x00]
- {evex} cmp ecx, 123456
-# CHECK: ccmpe {dfv=of,sf,zf,cf} r9, 123456
-# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0x81,0xf9,0x40,0xe2,0x01,0x00]
- {evex} cmp r9, 123456
-# CHECK: ccmpe {dfv=of,sf,zf,cf} dl, bl
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x38,0xda]
- {evex} cmp dl, bl
-# CHECK: ccmpe {dfv=of,sf,zf,cf} ax, dx
-# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x39,0xd0]
- {evex} cmp ax, dx
-# CHECK: ccmpe {dfv=of,sf,zf,cf} edx, ecx
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x39,0xca]
- {evex} cmp edx, ecx
-# CHECK: ccmpe {dfv=of,sf,zf,cf} r15, r9
-# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x39,0xcf]
- {evex} cmp r15, r9
diff --git a/llvm/test/MC/X86/apx/ctest-att.s b/llvm/test/MC/X86/apx/ctest-att.s
index fa510f2c8fec5..9048e0e4dd8e3 100644
--- a/llvm/test/MC/X86/apx/ctest-att.s
+++ b/llvm/test/MC/X86/apx/ctest-att.s
@@ -772,53 +772,53 @@
# CHECK: encoding: [0x62,0x54,0xc4,0x04,0x85,0xcf]
ctesteq {dfv=of} %r9, %r15
-## "{evex} test*" are alias for "cteste* {dfv=of,sf,zf,cf}"
+## "{evex} test*" are alias for "ctestt* {dfv=of,sf,zf,cf}"
-# CHECK: ctesteb {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0xf6,0x44,0x80,0x7b,0x7b]
+# CHECK: ctesttb {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0xf6,0x44,0x80,0x7b,0x7b]
{evex} testb $123, 123(%r8,%rax,4)
-# CHECK: ctestew {dfv=of,sf,zf,cf} $1234, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0xf7,0x44,0x80,0x7b,0xd2,0x04]
+# CHECK: ctesttw {dfv=of,sf,zf,cf} $1234, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0xf7,0x44,0x80,0x7b,0xd2,0x04]
{evex} testw $1234, 123(%r8,%rax,4)
-# CHECK: ctestel {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
+# CHECK: ctesttl {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
{evex} testl $123456, 123(%r8,%rax,4)
-# CHECK: ctesteq {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
+# CHECK: ctesttq {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
{evex} testq $123456, 123(%r8,%rax,4)
-# CHECK: ctesteb {dfv=of,sf,zf,cf} %bl, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x84,0x5c,0x80,0x7b]
+# CHECK: ctesttb {dfv=of,sf,zf,cf} %bl, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x84,0x5c,0x80,0x7b]
{evex} testb %bl, 123(%r8,%rax,4)
-# CHECK: ctestew {dfv=of,sf,zf,cf} %dx, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x85,0x54,0x80,0x7b]
+# CHECK: ctesttw {dfv=of,sf,zf,cf} %dx, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x85,0x54,0x80,0x7b]
{evex} testw %dx, 123(%r8,%rax,4)
-# CHECK: ctestel {dfv=of,sf,zf,cf} %ecx, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x85,0x4c,0x80,0x7b]
+# CHECK: ctesttl {dfv=of,sf,zf,cf} %ecx, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x85,0x4c,0x80,0x7b]
{evex} testl %ecx, 123(%r8,%rax,4)
-# CHECK: ctesteq {dfv=of,sf,zf,cf} %r9, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x85,0x4c,0x80,0x7b]
+# CHECK: ctesttq {dfv=of,sf,zf,cf} %r9, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x85,0x4c,0x80,0x7b]
{evex} testq %r9, 123(%r8,%rax,4)
-# CHECK: ctesteb {dfv=of,sf,zf,cf} $123, %bl
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0xf6,0xc3,0x7b]
+# CHECK: ctesttb {dfv=of,sf,zf,cf} $123, %bl
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0xf6,0xc3,0x7b]
{evex} testb $123, %bl
-# CHECK: ctestew {dfv=of,sf,zf,cf} $1234, %dx
-# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0xf7,0xc2,0xd2,0x04]
+# CHECK: ctesttw {dfv=of,sf,zf,cf} $1234, %dx
+# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0xf7,0xc2,0xd2,0x04]
{evex} testw $1234, %dx
-# CHECK: ctestel {dfv=of,sf,zf,cf} $123456, %ecx
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0xf7,0xc1,0x40,0xe2,0x01,0x00]
+# CHECK: ctesttl {dfv=of,sf,zf,cf} $123456, %ecx
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0xf7,0xc1,0x40,0xe2,0x01,0x00]
{evex} testl $123456, %ecx
-# CHECK: ctesteq {dfv=of,sf,zf,cf} $123456, %r9
-# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0xf7,0xc1,0x40,0xe2,0x01,0x00]
+# CHECK: ctesttq {dfv=of,sf,zf,cf} $123456, %r9
+# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0xf7,0xc1,0x40,0xe2,0x01,0x00]
{evex} testq $123456, %r9
-# CHECK: ctesteb {dfv=of,sf,zf,cf} %bl, %dl
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x84,0xda]
+# CHECK: ctesttb {dfv=of,sf,zf,cf} %bl, %dl
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x84,0xda]
{evex} testb %bl, %dl
-# CHECK: ctestew {dfv=of,sf,zf,cf} %dx, %ax
-# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x85,0xd0]
+# CHECK: ctesttw {dfv=of,sf,zf,cf} %dx, %ax
+# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x85,0xd0]
{evex} testw %dx, %ax
-# CHECK: ctestel {dfv=of,sf,zf,cf} %ecx, %edx
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x85,0xca]
+# CHECK: ctesttl {dfv=of,sf,zf,cf} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x85,0xca]
{evex} testl %ecx, %edx
-# CHECK: ctesteq {dfv=of,sf,zf,cf} %r9, %r15
-# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x85,0xcf]
+# CHECK: ctesttq {dfv=of,sf,zf,cf} %r9, %r15
+# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x85,0xcf]
{evex} testq %r9, %r15
diff --git a/llvm/test/MC/X86/apx/ctest-intel.s b/llvm/test/MC/X86/apx/ctest-intel.s
index 23210bd75fe15..b7479301495e8 100644
--- a/llvm/test/MC/X86/apx/ctest-intel.s
+++ b/llvm/test/MC/X86/apx/ctest-intel.s
@@ -769,53 +769,55 @@
# CHECK: encoding: [0x62,0x54,0xc4,0x04,0x85,0xcf]
cteste {dfv=of} r15, r9
-## "{evex} test*" are alias for "cteste* {dfv=of,sf,zf,cf}"
+## "{evex} test*" are alias for "ctestt* {dfv=of,sf,zf,cf}"
-# CHECK: cteste {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], 123
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0xf6,0x44,0x80,0x7b,0x7b]
+# RUN: llvm-mc -triple x86_64 -show-encoding -x86-asm-syntax=intel -output-asm-variant=1 %s | FileCheck %s
+
+# CHECK: ctestt {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0xf6,0x44,0x80,0x7b,0x7b]
{evex} test byte ptr [r8 + 4*rax + 123], 123
-# CHECK: cteste {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], 1234
-# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0xf7,0x44,0x80,0x7b,0xd2,0x04]
+# CHECK: ctestt {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], 1234
+# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0xf7,0x44,0x80,0x7b,0xd2,0x04]
{evex} test word ptr [r8 + 4*rax + 123], 1234
-# CHECK: cteste {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], 123456
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
+# CHECK: ctestt {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], 123456
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
{evex} test dword ptr [r8 + 4*rax + 123], 123456
-# CHECK: cteste {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], 123456
-# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
+# CHECK: ctestt {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], 123456
+# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
{evex} test qword ptr [r8 + 4*rax + 123], 123456
-# CHECK: cteste {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], bl
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x84,0x5c,0x80,0x7b]
+# CHECK: ctestt {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], bl
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x84,0x5c,0x80,0x7b]
{evex} test byte ptr [r8 + 4*rax + 123], bl
-# CHECK: cteste {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], dx
-# CHECK: encoding: [0x62,0xd4,0x7d,0x04,0x85,0x54,0x80,0x7b]
+# CHECK: ctestt {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], dx
+# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x85,0x54,0x80,0x7b]
{evex} test word ptr [r8 + 4*rax + 123], dx
-# CHECK: cteste {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], ecx
-# CHECK: encoding: [0x62,0xd4,0x7c,0x04,0x85,0x4c,0x80,0x7b]
+# CHECK: ctestt {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], ecx
+# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x85,0x4c,0x80,0x7b]
{evex} test dword ptr [r8 + 4*rax + 123], ecx
-# CHECK: cteste {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], r9
-# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x85,0x4c,0x80,0x7b]
+# CHECK: ctestt {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], r9
+# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x85,0x4c,0x80,0x7b]
{evex} test qword ptr [r8 + 4*rax + 123], r9
-# CHECK: cteste {dfv=of,sf,zf,cf} bl, 123
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0xf6,0xc3,0x7b]
+# CHECK: ctestt {dfv=of,sf,zf,cf} bl, 123
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0xf6,0xc3,0x7b]
{evex} test bl, 123
-# CHECK: cteste {dfv=of,sf,zf,cf} dx, 1234
-# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0xf7,0xc2,0xd2,0x04]
+# CHECK: ctestt {dfv=of,sf,zf,cf} dx, 1234
+# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0xf7,0xc2,0xd2,0x04]
{evex} test dx, 1234
-# CHECK: cteste {dfv=of,sf,zf,cf} ecx, 123456
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0xf7,0xc1,0x40,0xe2,0x01,0x00]
+# CHECK: ctestt {dfv=of,sf,zf,cf} ecx, 123456
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0xf7,0xc1,0x40,0xe2,0x01,0x00]
{evex} test ecx, 123456
-# CHECK: cteste {dfv=of,sf,zf,cf} r9, 123456
-# CHECK: encoding: [0x62,0xd4,0xfc,0x04,0xf7,0xc1,0x40,0xe2,0x01,0x00]
+# CHECK: ctestt {dfv=of,sf,zf,cf} r9, 123456
+# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0xf7,0xc1,0x40,0xe2,0x01,0x00]
{evex} test r9, 123456
-# CHECK: cteste {dfv=of,sf,zf,cf} dl, bl
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x84,0xda]
+# CHECK: ctestt {dfv=of,sf,zf,cf} dl, bl
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x84,0xda]
{evex} test dl, bl
-# CHECK: cteste {dfv=of,sf,zf,cf} ax, dx
-# CHECK: encoding: [0x62,0xf4,0x7d,0x04,0x85,0xd0]
+# CHECK: ctestt {dfv=of,sf,zf,cf} ax, dx
+# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x85,0xd0]
{evex} test ax, dx
-# CHECK: cteste {dfv=of,sf,zf,cf} edx, ecx
-# CHECK: encoding: [0x62,0xf4,0x7c,0x04,0x85,0xca]
+# CHECK: ctestt {dfv=of,sf,zf,cf} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x85,0xca]
{evex} test edx, ecx
-# CHECK: cteste {dfv=of,sf,zf,cf} r15, r9
-# CHECK: encoding: [0x62,0x54,0xfc,0x04,0x85,0xcf]
+# CHECK: ctestt {dfv=of,sf,zf,cf} r15, r9
+# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x85,0xcf]
{evex} test r15, r9
>From 2dd7c4a0760da98e1583a8393fcf8f25d47ada63 Mon Sep 17 00:00:00 2001
From: Freddy Ye <freddy.ye at intel.com>
Date: Mon, 22 Jul 2024 09:17:05 +0800
Subject: [PATCH 3/6] address comments.
---
.../lib/Target/X86/AsmParser/X86AsmParser.cpp | 23 +++++++------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 183b322394d87..5b2eb4b0b7214 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -83,13 +83,6 @@ static const char OpPrecedence[] = {
3 // IC_GE
};
-static bool ifCmpOrTestOpcode(std::string &Opcode) {
- return Opcode == "cmp" || Opcode == "cmpb" || Opcode == "cmpw" ||
- Opcode == "cmpl" || Opcode == "cmpq" || Opcode == "test" ||
- Opcode == "testb" || Opcode == "testw" || Opcode == "testl" ||
- Opcode == "testq";
-}
-
class X86AsmParser : public MCTargetAsmParser {
ParseInstructionInfo *InstInfo;
bool Code16GCC;
@@ -103,7 +96,6 @@ class X86AsmParser : public MCTargetAsmParser {
OpcodePrefix_VEX2,
OpcodePrefix_VEX3,
OpcodePrefix_EVEX,
- OpcodePrefix_EVEX_CMP_TEST,
};
OpcodePrefix ForcedOpcodePrefix = OpcodePrefix_Default;
@@ -3210,7 +3202,6 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
if (getLexer().isNot(AsmToken::RCurly))
return Error(Parser.getTok().getLoc(), "Expected '}'");
Parser.Lex(); // Eat curly.
- std::string Opcode = Parser.getTok().getString().lower();
if (Prefix == "rex")
ForcedOpcodePrefix = OpcodePrefix_REX;
@@ -3223,9 +3214,7 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
else if (Prefix == "vex3")
ForcedOpcodePrefix = OpcodePrefix_VEX3;
else if (Prefix == "evex")
- ForcedOpcodePrefix = is64BitMode() && ifCmpOrTestOpcode(Opcode)
- ? OpcodePrefix_EVEX_CMP_TEST
- : OpcodePrefix_EVEX;
+ ForcedOpcodePrefix = OpcodePrefix_EVEX;
else if (Prefix == "disp8")
ForcedDispEncoding = DispEncoding_Disp8;
else if (Prefix == "disp32")
@@ -3795,9 +3784,11 @@ bool X86AsmParser::processInstruction(MCInst &Inst, const OperandVector &Ops) {
Inst.setOpcode(X86::INT3);
return true;
}
+ // `{evex} cmp <>, <>` is alias of `ccmpt {dfv=of,sf,zf,cf} <>, <>`
#define FROM_TO(FROM, TO) \
case X86::FROM: { \
- if (ForcedOpcodePrefix == OpcodePrefix_EVEX_CMP_TEST) { \
+ if (ForcedOpcodePrefix == OpcodePrefix_EVEX) { \
+ Inst.setFlags(~(X86::IP_USE_EVEX) & Inst.getFlags()); \
Inst.setOpcode(X86::TO); \
Inst.addOperand(MCOperand::createImm(15)); \
Inst.addOperand(MCOperand::createImm(10)); \
@@ -4193,7 +4184,6 @@ unsigned X86AsmParser::checkTargetMatchPredicate(MCInst &Inst) {
switch (ForcedOpcodePrefix) {
case OpcodePrefix_Default:
- case OpcodePrefix_EVEX_CMP_TEST:
break;
case OpcodePrefix_REX:
case OpcodePrefix_REX2:
@@ -4207,7 +4197,10 @@ unsigned X86AsmParser::checkTargetMatchPredicate(MCInst &Inst) {
return Match_Unsupported;
break;
case OpcodePrefix_EVEX:
- if ((TSFlags & X86II::EncodingMask) != X86II::EVEX)
+ if (is64BitMode() && (TSFlags & X86II::EncodingMask) != X86II::EVEX &&
+ !X86::isCMP(Opc) && !X86::isTEST(Opc))
+ return Match_Unsupported;
+ if (!is64BitMode() && (TSFlags & X86II::EncodingMask) != X86II::EVEX)
return Match_Unsupported;
break;
}
>From 5212e21e0ab3d659885b12fe55287a03c6cffece Mon Sep 17 00:00:00 2001
From: Freddy Ye <freddy.ye at intel.com>
Date: Mon, 22 Jul 2024 10:19:27 +0800
Subject: [PATCH 4/6] address comments.
---
llvm/test/MC/X86/apx/ccmp-intel.s | 1 -
llvm/test/MC/X86/apx/ctest-intel.s | 2 --
2 files changed, 3 deletions(-)
diff --git a/llvm/test/MC/X86/apx/ccmp-intel.s b/llvm/test/MC/X86/apx/ccmp-intel.s
index d3b649ee48208..bafaa2106c7e0 100644
--- a/llvm/test/MC/X86/apx/ccmp-intel.s
+++ b/llvm/test/MC/X86/apx/ccmp-intel.s
@@ -1295,4 +1295,3 @@
# CHECK: ccmpt {dfv=of,sf,zf,cf} r15, r9
# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x39,0xcf]
{evex} cmp r15, r9
-
diff --git a/llvm/test/MC/X86/apx/ctest-intel.s b/llvm/test/MC/X86/apx/ctest-intel.s
index b7479301495e8..af983a4fe62d0 100644
--- a/llvm/test/MC/X86/apx/ctest-intel.s
+++ b/llvm/test/MC/X86/apx/ctest-intel.s
@@ -771,8 +771,6 @@
## "{evex} test*" are alias for "ctestt* {dfv=of,sf,zf,cf}"
-# RUN: llvm-mc -triple x86_64 -show-encoding -x86-asm-syntax=intel -output-asm-variant=1 %s | FileCheck %s
-
# CHECK: ctestt {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], 123
# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0xf6,0x44,0x80,0x7b,0x7b]
{evex} test byte ptr [r8 + 4*rax + 123], 123
>From c950e92693b28abed9e8e8c348b55ca2e787e135 Mon Sep 17 00:00:00 2001
From: Freddy Ye <freddy.ye at intel.com>
Date: Mon, 22 Jul 2024 10:54:56 +0800
Subject: [PATCH 5/6] address comments.
---
.../lib/Target/X86/AsmParser/X86AsmParser.cpp | 4 +-
llvm/test/MC/X86/apx/ccmp-att.s | 158 +++++++++---------
llvm/test/MC/X86/apx/ccmp-intel.s | 158 +++++++++---------
llvm/test/MC/X86/apx/ctest-att.s | 98 +++++------
llvm/test/MC/X86/apx/ctest-intel.s | 98 +++++------
5 files changed, 258 insertions(+), 258 deletions(-)
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 5b2eb4b0b7214..3aa59bb731c90 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -3784,13 +3784,13 @@ bool X86AsmParser::processInstruction(MCInst &Inst, const OperandVector &Ops) {
Inst.setOpcode(X86::INT3);
return true;
}
- // `{evex} cmp <>, <>` is alias of `ccmpt {dfv=of,sf,zf,cf} <>, <>`
+ // `{evex} cmp <>, <>` is alias of `ccmpt {dfv=} <>, <>`
#define FROM_TO(FROM, TO) \
case X86::FROM: { \
if (ForcedOpcodePrefix == OpcodePrefix_EVEX) { \
Inst.setFlags(~(X86::IP_USE_EVEX) & Inst.getFlags()); \
Inst.setOpcode(X86::TO); \
- Inst.addOperand(MCOperand::createImm(15)); \
+ Inst.addOperand(MCOperand::createImm(0)); \
Inst.addOperand(MCOperand::createImm(10)); \
return true; \
} \
diff --git a/llvm/test/MC/X86/apx/ccmp-att.s b/llvm/test/MC/X86/apx/ccmp-att.s
index 4dd54df7b370a..4a631a42466fe 100644
--- a/llvm/test/MC/X86/apx/ccmp-att.s
+++ b/llvm/test/MC/X86/apx/ccmp-att.s
@@ -1218,83 +1218,83 @@
# CHECK: encoding: [0x62,0xf4,0xfc,0x00,0x39,0xc3]
ccmpoq {dFV=Cf,zF,SF,of} %rax, %rbx
-## "{evex} cmp*" are alias for "ccmpt* {dfv=of,sf,zf,cf}"
+## "{evex} cmp*" are alias for "ccmpt* {dfv=}"
-# CHECK: ccmptb {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x80,0x7c,0x80,0x7b,0x7b]
- {evex} cmpb $123, 123(%r8,%rax,4)
-# CHECK: ccmptw {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
- {evex} cmpw $123, 123(%r8,%rax,4)
-# CHECK: ccmptw {dfv=of,sf,zf,cf} $1234, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x81,0x7c,0x80,0x7b,0xd2,0x04]
- {evex} cmpw $1234, 123(%r8,%rax,4)
-# CHECK: ccmptl {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
- {evex} cmpl $123, 123(%r8,%rax,4)
-# CHECK: ccmptl {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
- {evex} cmpl $123456, 123(%r8,%rax,4)
-# CHECK: ccmptq {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
- {evex} cmpq $123, 123(%r8,%rax,4)
-# CHECK: ccmptq {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
- {evex} cmpq $123456, 123(%r8,%rax,4)
-# CHECK: ccmptb {dfv=of,sf,zf,cf} %bl, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x38,0x5c,0x80,0x7b]
- {evex} cmpb %bl, 123(%r8,%rax,4)
-# CHECK: ccmptw {dfv=of,sf,zf,cf} %dx, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x39,0x54,0x80,0x7b]
- {evex} cmpw %dx, 123(%r8,%rax,4)
-# CHECK: ccmptl {dfv=of,sf,zf,cf} %ecx, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x39,0x4c,0x80,0x7b]
- {evex} cmpl %ecx, 123(%r8,%rax,4)
-# CHECK: ccmptq {dfv=of,sf,zf,cf} %r9, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x39,0x4c,0x80,0x7b]
- {evex} cmpq %r9, 123(%r8,%rax,4)
-# CHECK: ccmptb {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %bl
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x3a,0x5c,0x80,0x7b]
- {evex} cmpb 123(%r8,%rax,4), %bl
-# CHECK: ccmptw {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %dx
-# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x3b,0x54,0x80,0x7b]
- {evex} cmpw 123(%r8,%rax,4), %dx
-# CHECK: ccmptl {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %ecx
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x3b,0x4c,0x80,0x7b]
- {evex} cmpl 123(%r8,%rax,4), %ecx
-# CHECK: ccmptq {dfv=of,sf,zf,cf} 123(%r8,%rax,4), %r9
-# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x3b,0x4c,0x80,0x7b]
- {evex} cmpq 123(%r8,%rax,4), %r9
-# CHECK: ccmptb {dfv=of,sf,zf,cf} $123, %bl
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x80,0xfb,0x7b]
- {evex} cmpb $123, %bl
-# CHECK: ccmptw {dfv=of,sf,zf,cf} $123, %dx
-# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x83,0xfa,0x7b]
- {evex} cmpw $123, %dx
-# CHECK: ccmptl {dfv=of,sf,zf,cf} $123, %ecx
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x83,0xf9,0x7b]
- {evex} cmpl $123, %ecx
-# CHECK: ccmptq {dfv=of,sf,zf,cf} $123, %r9
-# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x83,0xf9,0x7b]
- {evex} cmpq $123, %r9
-# CHECK: ccmptw {dfv=of,sf,zf,cf} $1234, %dx
-# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x81,0xfa,0xd2,0x04]
- {evex} cmpw $1234, %dx
-# CHECK: ccmptl {dfv=of,sf,zf,cf} $123456, %ecx
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x81,0xf9,0x40,0xe2,0x01,0x00]
- {evex} cmpl $123456, %ecx
-# CHECK: ccmptq {dfv=of,sf,zf,cf} $123456, %r9
-# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x81,0xf9,0x40,0xe2,0x01,0x00]
- {evex} cmpq $123456, %r9
-# CHECK: ccmptb {dfv=of,sf,zf,cf} %bl, %dl
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x38,0xda]
- {evex} cmpb %bl, %dl
-# CHECK: ccmptw {dfv=of,sf,zf,cf} %dx, %ax
-# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x39,0xd0]
- {evex} cmpw %dx, %ax
-# CHECK: ccmptl {dfv=of,sf,zf,cf} %ecx, %edx
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x39,0xca]
- {evex} cmpl %ecx, %edx
-# CHECK: ccmptq {dfv=of,sf,zf,cf} %r9, %r15
-# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x39,0xcf]
- {evex} cmpq %r9, %r15
+# CHECK: ccmptb {dfv=} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x80,0x7c,0x80,0x7b,0x7b]
+ ccmptb {dfv=} $123, 123(%r8,%rax,4)
+# CHECK: ccmptw {dfv=} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x05,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
+ ccmptw {dfv=} $123, 123(%r8,%rax,4)
+# CHECK: ccmptw {dfv=} $1234, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x05,0x0a,0x81,0x7c,0x80,0x7b,0xd2,0x04]
+ ccmptw {dfv=} $1234, 123(%r8,%rax,4)
+# CHECK: ccmptl {dfv=} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
+ ccmptl {dfv=} $123, 123(%r8,%rax,4)
+# CHECK: ccmptl {dfv=} $123456, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ ccmptl {dfv=} $123456, 123(%r8,%rax,4)
+# CHECK: ccmptq {dfv=} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x84,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
+ ccmptq {dfv=} $123, 123(%r8,%rax,4)
+# CHECK: ccmptq {dfv=} $123456, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x84,0x0a,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ ccmptq {dfv=} $123456, 123(%r8,%rax,4)
+# CHECK: ccmptb {dfv=} %bl, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x38,0x5c,0x80,0x7b]
+ ccmptb {dfv=} %bl, 123(%r8,%rax,4)
+# CHECK: ccmptw {dfv=} %dx, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x05,0x0a,0x39,0x54,0x80,0x7b]
+ ccmptw {dfv=} %dx, 123(%r8,%rax,4)
+# CHECK: ccmptl {dfv=} %ecx, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x39,0x4c,0x80,0x7b]
+ ccmptl {dfv=} %ecx, 123(%r8,%rax,4)
+# CHECK: ccmptq {dfv=} %r9, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0x54,0x84,0x0a,0x39,0x4c,0x80,0x7b]
+ ccmptq {dfv=} %r9, 123(%r8,%rax,4)
+# CHECK: ccmptb {dfv=} 123(%r8,%rax,4), %bl
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x3a,0x5c,0x80,0x7b]
+ ccmptb {dfv=} 123(%r8,%rax,4), %bl
+# CHECK: ccmptw {dfv=} 123(%r8,%rax,4), %dx
+# CHECK: encoding: [0x62,0xd4,0x05,0x0a,0x3b,0x54,0x80,0x7b]
+ ccmptw {dfv=} 123(%r8,%rax,4), %dx
+# CHECK: ccmptl {dfv=} 123(%r8,%rax,4), %ecx
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x3b,0x4c,0x80,0x7b]
+ ccmptl {dfv=} 123(%r8,%rax,4), %ecx
+# CHECK: ccmptq {dfv=} 123(%r8,%rax,4), %r9
+# CHECK: encoding: [0x62,0x54,0x84,0x0a,0x3b,0x4c,0x80,0x7b]
+ ccmptq {dfv=} 123(%r8,%rax,4), %r9
+# CHECK: ccmptb {dfv=} $123, %bl
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0x80,0xfb,0x7b]
+ ccmptb {dfv=} $123, %bl
+# CHECK: ccmptw {dfv=} $123, %dx
+# CHECK: encoding: [0x62,0xf4,0x05,0x0a,0x83,0xfa,0x7b]
+ ccmptw {dfv=} $123, %dx
+# CHECK: ccmptl {dfv=} $123, %ecx
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0x83,0xf9,0x7b]
+ ccmptl {dfv=} $123, %ecx
+# CHECK: ccmptq {dfv=} $123, %r9
+# CHECK: encoding: [0x62,0xd4,0x84,0x0a,0x83,0xf9,0x7b]
+ ccmptq {dfv=} $123, %r9
+# CHECK: ccmptw {dfv=} $1234, %dx
+# CHECK: encoding: [0x62,0xf4,0x05,0x0a,0x81,0xfa,0xd2,0x04]
+ ccmptw {dfv=} $1234, %dx
+# CHECK: ccmptl {dfv=} $123456, %ecx
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0x81,0xf9,0x40,0xe2,0x01,0x00]
+ ccmptl {dfv=} $123456, %ecx
+# CHECK: ccmptq {dfv=} $123456, %r9
+# CHECK: encoding: [0x62,0xd4,0x84,0x0a,0x81,0xf9,0x40,0xe2,0x01,0x00]
+ ccmptq {dfv=} $123456, %r9
+# CHECK: ccmptb {dfv=} %bl, %dl
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0x38,0xda]
+ ccmptb {dfv=} %bl, %dl
+# CHECK: ccmptw {dfv=} %dx, %ax
+# CHECK: encoding: [0x62,0xf4,0x05,0x0a,0x39,0xd0]
+ ccmptw {dfv=} %dx, %ax
+# CHECK: ccmptl {dfv=} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0x39,0xca]
+ ccmptl {dfv=} %ecx, %edx
+# CHECK: ccmptq {dfv=} %r9, %r15
+# CHECK: encoding: [0x62,0x54,0x84,0x0a,0x39,0xcf]
+ ccmptq {dfv=} %r9, %r15
diff --git a/llvm/test/MC/X86/apx/ccmp-intel.s b/llvm/test/MC/X86/apx/ccmp-intel.s
index bafaa2106c7e0..0b05490b9fc83 100644
--- a/llvm/test/MC/X86/apx/ccmp-intel.s
+++ b/llvm/test/MC/X86/apx/ccmp-intel.s
@@ -1215,83 +1215,83 @@
# CHECK: encoding: [0x62,0xf4,0xfc,0x00,0x39,0xc3]
ccmpo {DFv=Cf,zF,SF,of} rbx, rax
-## "{evex} cmp*" are alias for "ccmpt* {dfv=of,sf,zf,cf}"
+## "{evex} cmp*" are alias for "ccmpt* {dfv=}"
-# CHECK: ccmpt {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], 123
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x80,0x7c,0x80,0x7b,0x7b]
- {evex} cmp byte ptr [r8 + 4*rax + 123], 123
-# CHECK: ccmpt {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], 123
-# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
- {evex} cmp word ptr [r8 + 4*rax + 123], 123
-# CHECK: ccmpt {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], 1234
-# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x81,0x7c,0x80,0x7b,0xd2,0x04]
- {evex} cmp word ptr [r8 + 4*rax + 123], 1234
-# CHECK: ccmpt {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], 123
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
- {evex} cmp dword ptr [r8 + 4*rax + 123], 123
-# CHECK: ccmpt {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], 123456
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
- {evex} cmp dword ptr [r8 + 4*rax + 123], 123456
-# CHECK: ccmpt {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], 123
-# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
- {evex} cmp qword ptr [r8 + 4*rax + 123], 123
-# CHECK: ccmpt {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], 123456
-# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
- {evex} cmp qword ptr [r8 + 4*rax + 123], 123456
-# CHECK: ccmpt {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], bl
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x38,0x5c,0x80,0x7b]
- {evex} cmp byte ptr [r8 + 4*rax + 123], bl
-# CHECK: ccmpt {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], dx
-# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x39,0x54,0x80,0x7b]
- {evex} cmp word ptr [r8 + 4*rax + 123], dx
-# CHECK: ccmpt {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], ecx
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x39,0x4c,0x80,0x7b]
- {evex} cmp dword ptr [r8 + 4*rax + 123], ecx
-# CHECK: ccmpt {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], r9
-# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x39,0x4c,0x80,0x7b]
- {evex} cmp qword ptr [r8 + 4*rax + 123], r9
-# CHECK: ccmpt {dfv=of,sf,zf,cf} bl, byte ptr [r8 + 4*rax + 123]
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x3a,0x5c,0x80,0x7b]
- {evex} cmp bl, byte ptr [r8 + 4*rax + 123]
-# CHECK: ccmpt {dfv=of,sf,zf,cf} dx, word ptr [r8 + 4*rax + 123]
-# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x3b,0x54,0x80,0x7b]
- {evex} cmp dx, word ptr [r8 + 4*rax + 123]
-# CHECK: ccmpt {dfv=of,sf,zf,cf} ecx, dword ptr [r8 + 4*rax + 123]
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x3b,0x4c,0x80,0x7b]
- {evex} cmp ecx, dword ptr [r8 + 4*rax + 123]
-# CHECK: ccmpt {dfv=of,sf,zf,cf} r9, qword ptr [r8 + 4*rax + 123]
-# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x3b,0x4c,0x80,0x7b]
- {evex} cmp r9, qword ptr [r8 + 4*rax + 123]
-# CHECK: ccmpt {dfv=of,sf,zf,cf} bl, 123
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x80,0xfb,0x7b]
- {evex} cmp bl, 123
-# CHECK: ccmpt {dfv=of,sf,zf,cf} dx, 123
-# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x83,0xfa,0x7b]
- {evex} cmp dx, 123
-# CHECK: ccmpt {dfv=of,sf,zf,cf} ecx, 123
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x83,0xf9,0x7b]
- {evex} cmp ecx, 123
-# CHECK: ccmpt {dfv=of,sf,zf,cf} r9, 123
-# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x83,0xf9,0x7b]
- {evex} cmp r9, 123
-# CHECK: ccmpt {dfv=of,sf,zf,cf} dx, 1234
-# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x81,0xfa,0xd2,0x04]
- {evex} cmp dx, 1234
-# CHECK: ccmpt {dfv=of,sf,zf,cf} ecx, 123456
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x81,0xf9,0x40,0xe2,0x01,0x00]
- {evex} cmp ecx, 123456
-# CHECK: ccmpt {dfv=of,sf,zf,cf} r9, 123456
-# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0x81,0xf9,0x40,0xe2,0x01,0x00]
- {evex} cmp r9, 123456
-# CHECK: ccmpt {dfv=of,sf,zf,cf} dl, bl
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x38,0xda]
- {evex} cmp dl, bl
-# CHECK: ccmpt {dfv=of,sf,zf,cf} ax, dx
-# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x39,0xd0]
- {evex} cmp ax, dx
-# CHECK: ccmpt {dfv=of,sf,zf,cf} edx, ecx
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x39,0xca]
- {evex} cmp edx, ecx
-# CHECK: ccmpt {dfv=of,sf,zf,cf} r15, r9
-# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x39,0xcf]
- {evex} cmp r15, r9
+# CHECK: ccmpt {dfv=} byte ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x80,0x7c,0x80,0x7b,0x7b]
+ ccmpt {dfv=} byte ptr [r8 + 4*rax + 123], 123
+# CHECK: ccmpt {dfv=} word ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0x05,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
+ ccmpt {dfv=} word ptr [r8 + 4*rax + 123], 123
+# CHECK: ccmpt {dfv=} word ptr [r8 + 4*rax + 123], 1234
+# CHECK: encoding: [0x62,0xd4,0x05,0x0a,0x81,0x7c,0x80,0x7b,0xd2,0x04]
+ ccmpt {dfv=} word ptr [r8 + 4*rax + 123], 1234
+# CHECK: ccmpt {dfv=} dword ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
+ ccmpt {dfv=} dword ptr [r8 + 4*rax + 123], 123
+# CHECK: ccmpt {dfv=} dword ptr [r8 + 4*rax + 123], 123456
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ ccmpt {dfv=} dword ptr [r8 + 4*rax + 123], 123456
+# CHECK: ccmpt {dfv=} qword ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0x84,0x0a,0x83,0x7c,0x80,0x7b,0x7b]
+ ccmpt {dfv=} qword ptr [r8 + 4*rax + 123], 123
+# CHECK: ccmpt {dfv=} qword ptr [r8 + 4*rax + 123], 123456
+# CHECK: encoding: [0x62,0xd4,0x84,0x0a,0x81,0x7c,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ ccmpt {dfv=} qword ptr [r8 + 4*rax + 123], 123456
+# CHECK: ccmpt {dfv=} byte ptr [r8 + 4*rax + 123], bl
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x38,0x5c,0x80,0x7b]
+ ccmpt {dfv=} byte ptr [r8 + 4*rax + 123], bl
+# CHECK: ccmpt {dfv=} word ptr [r8 + 4*rax + 123], dx
+# CHECK: encoding: [0x62,0xd4,0x05,0x0a,0x39,0x54,0x80,0x7b]
+ ccmpt {dfv=} word ptr [r8 + 4*rax + 123], dx
+# CHECK: ccmpt {dfv=} dword ptr [r8 + 4*rax + 123], ecx
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x39,0x4c,0x80,0x7b]
+ ccmpt {dfv=} dword ptr [r8 + 4*rax + 123], ecx
+# CHECK: ccmpt {dfv=} qword ptr [r8 + 4*rax + 123], r9
+# CHECK: encoding: [0x62,0x54,0x84,0x0a,0x39,0x4c,0x80,0x7b]
+ ccmpt {dfv=} qword ptr [r8 + 4*rax + 123], r9
+# CHECK: ccmpt {dfv=} bl, byte ptr [r8 + 4*rax + 123]
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x3a,0x5c,0x80,0x7b]
+ ccmpt {dfv=} bl, byte ptr [r8 + 4*rax + 123]
+# CHECK: ccmpt {dfv=} dx, word ptr [r8 + 4*rax + 123]
+# CHECK: encoding: [0x62,0xd4,0x05,0x0a,0x3b,0x54,0x80,0x7b]
+ ccmpt {dfv=} dx, word ptr [r8 + 4*rax + 123]
+# CHECK: ccmpt {dfv=} ecx, dword ptr [r8 + 4*rax + 123]
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x3b,0x4c,0x80,0x7b]
+ ccmpt {dfv=} ecx, dword ptr [r8 + 4*rax + 123]
+# CHECK: ccmpt {dfv=} r9, qword ptr [r8 + 4*rax + 123]
+# CHECK: encoding: [0x62,0x54,0x84,0x0a,0x3b,0x4c,0x80,0x7b]
+ ccmpt {dfv=} r9, qword ptr [r8 + 4*rax + 123]
+# CHECK: ccmpt {dfv=} bl, 123
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0x80,0xfb,0x7b]
+ ccmpt {dfv=} bl, 123
+# CHECK: ccmpt {dfv=} dx, 123
+# CHECK: encoding: [0x62,0xf4,0x05,0x0a,0x83,0xfa,0x7b]
+ ccmpt {dfv=} dx, 123
+# CHECK: ccmpt {dfv=} ecx, 123
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0x83,0xf9,0x7b]
+ ccmpt {dfv=} ecx, 123
+# CHECK: ccmpt {dfv=} r9, 123
+# CHECK: encoding: [0x62,0xd4,0x84,0x0a,0x83,0xf9,0x7b]
+ ccmpt {dfv=} r9, 123
+# CHECK: ccmpt {dfv=} dx, 1234
+# CHECK: encoding: [0x62,0xf4,0x05,0x0a,0x81,0xfa,0xd2,0x04]
+ ccmpt {dfv=} dx, 1234
+# CHECK: ccmpt {dfv=} ecx, 123456
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0x81,0xf9,0x40,0xe2,0x01,0x00]
+ ccmpt {dfv=} ecx, 123456
+# CHECK: ccmpt {dfv=} r9, 123456
+# CHECK: encoding: [0x62,0xd4,0x84,0x0a,0x81,0xf9,0x40,0xe2,0x01,0x00]
+ ccmpt {dfv=} r9, 123456
+# CHECK: ccmpt {dfv=} dl, bl
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0x38,0xda]
+ ccmpt {dfv=} dl, bl
+# CHECK: ccmpt {dfv=} ax, dx
+# CHECK: encoding: [0x62,0xf4,0x05,0x0a,0x39,0xd0]
+ ccmpt {dfv=} ax, dx
+# CHECK: ccmpt {dfv=} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0x39,0xca]
+ ccmpt {dfv=} edx, ecx
+# CHECK: ccmpt {dfv=} r15, r9
+# CHECK: encoding: [0x62,0x54,0x84,0x0a,0x39,0xcf]
+ ccmpt {dfv=} r15, r9
diff --git a/llvm/test/MC/X86/apx/ctest-att.s b/llvm/test/MC/X86/apx/ctest-att.s
index 9048e0e4dd8e3..f92e019a8e987 100644
--- a/llvm/test/MC/X86/apx/ctest-att.s
+++ b/llvm/test/MC/X86/apx/ctest-att.s
@@ -772,53 +772,53 @@
# CHECK: encoding: [0x62,0x54,0xc4,0x04,0x85,0xcf]
ctesteq {dfv=of} %r9, %r15
-## "{evex} test*" are alias for "ctestt* {dfv=of,sf,zf,cf}"
+## "{evex} test*" are alias for "ctestt* {dfv=}"
-# CHECK: ctesttb {dfv=of,sf,zf,cf} $123, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0xf6,0x44,0x80,0x7b,0x7b]
- {evex} testb $123, 123(%r8,%rax,4)
-# CHECK: ctesttw {dfv=of,sf,zf,cf} $1234, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0xf7,0x44,0x80,0x7b,0xd2,0x04]
- {evex} testw $1234, 123(%r8,%rax,4)
-# CHECK: ctesttl {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
- {evex} testl $123456, 123(%r8,%rax,4)
-# CHECK: ctesttq {dfv=of,sf,zf,cf} $123456, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
- {evex} testq $123456, 123(%r8,%rax,4)
-# CHECK: ctesttb {dfv=of,sf,zf,cf} %bl, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x84,0x5c,0x80,0x7b]
- {evex} testb %bl, 123(%r8,%rax,4)
-# CHECK: ctesttw {dfv=of,sf,zf,cf} %dx, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x85,0x54,0x80,0x7b]
- {evex} testw %dx, 123(%r8,%rax,4)
-# CHECK: ctesttl {dfv=of,sf,zf,cf} %ecx, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x85,0x4c,0x80,0x7b]
- {evex} testl %ecx, 123(%r8,%rax,4)
-# CHECK: ctesttq {dfv=of,sf,zf,cf} %r9, 123(%r8,%rax,4)
-# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x85,0x4c,0x80,0x7b]
- {evex} testq %r9, 123(%r8,%rax,4)
-# CHECK: ctesttb {dfv=of,sf,zf,cf} $123, %bl
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0xf6,0xc3,0x7b]
- {evex} testb $123, %bl
-# CHECK: ctesttw {dfv=of,sf,zf,cf} $1234, %dx
-# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0xf7,0xc2,0xd2,0x04]
- {evex} testw $1234, %dx
-# CHECK: ctesttl {dfv=of,sf,zf,cf} $123456, %ecx
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0xf7,0xc1,0x40,0xe2,0x01,0x00]
- {evex} testl $123456, %ecx
-# CHECK: ctesttq {dfv=of,sf,zf,cf} $123456, %r9
-# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0xf7,0xc1,0x40,0xe2,0x01,0x00]
- {evex} testq $123456, %r9
-# CHECK: ctesttb {dfv=of,sf,zf,cf} %bl, %dl
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x84,0xda]
- {evex} testb %bl, %dl
-# CHECK: ctesttw {dfv=of,sf,zf,cf} %dx, %ax
-# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x85,0xd0]
- {evex} testw %dx, %ax
-# CHECK: ctesttl {dfv=of,sf,zf,cf} %ecx, %edx
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x85,0xca]
- {evex} testl %ecx, %edx
-# CHECK: ctesttq {dfv=of,sf,zf,cf} %r9, %r15
-# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x85,0xcf]
- {evex} testq %r9, %r15
+# CHECK: ctesttb {dfv=} $123, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0xf6,0x44,0x80,0x7b,0x7b]
+ ctesttb {dfv=} $123, 123(%r8,%rax,4)
+# CHECK: ctesttw {dfv=} $1234, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x05,0x0a,0xf7,0x44,0x80,0x7b,0xd2,0x04]
+ ctesttw {dfv=} $1234, 123(%r8,%rax,4)
+# CHECK: ctesttl {dfv=} $123456, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ ctesttl {dfv=} $123456, 123(%r8,%rax,4)
+# CHECK: ctesttq {dfv=} $123456, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x84,0x0a,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ ctesttq {dfv=} $123456, 123(%r8,%rax,4)
+# CHECK: ctesttb {dfv=} %bl, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x84,0x5c,0x80,0x7b]
+ ctesttb {dfv=} %bl, 123(%r8,%rax,4)
+# CHECK: ctesttw {dfv=} %dx, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x05,0x0a,0x85,0x54,0x80,0x7b]
+ ctesttw {dfv=} %dx, 123(%r8,%rax,4)
+# CHECK: ctesttl {dfv=} %ecx, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x85,0x4c,0x80,0x7b]
+ ctesttl {dfv=} %ecx, 123(%r8,%rax,4)
+# CHECK: ctesttq {dfv=} %r9, 123(%r8,%rax,4)
+# CHECK: encoding: [0x62,0x54,0x84,0x0a,0x85,0x4c,0x80,0x7b]
+ ctesttq {dfv=} %r9, 123(%r8,%rax,4)
+# CHECK: ctesttb {dfv=} $123, %bl
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0xf6,0xc3,0x7b]
+ ctesttb {dfv=} $123, %bl
+# CHECK: ctesttw {dfv=} $1234, %dx
+# CHECK: encoding: [0x62,0xf4,0x05,0x0a,0xf7,0xc2,0xd2,0x04]
+ ctesttw {dfv=} $1234, %dx
+# CHECK: ctesttl {dfv=} $123456, %ecx
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0xf7,0xc1,0x40,0xe2,0x01,0x00]
+ ctesttl {dfv=} $123456, %ecx
+# CHECK: ctesttq {dfv=} $123456, %r9
+# CHECK: encoding: [0x62,0xd4,0x84,0x0a,0xf7,0xc1,0x40,0xe2,0x01,0x00]
+ ctesttq {dfv=} $123456, %r9
+# CHECK: ctesttb {dfv=} %bl, %dl
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0x84,0xda]
+ ctesttb {dfv=} %bl, %dl
+# CHECK: ctesttw {dfv=} %dx, %ax
+# CHECK: encoding: [0x62,0xf4,0x05,0x0a,0x85,0xd0]
+ ctesttw {dfv=} %dx, %ax
+# CHECK: ctesttl {dfv=} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0x85,0xca]
+ ctesttl {dfv=} %ecx, %edx
+# CHECK: ctesttq {dfv=} %r9, %r15
+# CHECK: encoding: [0x62,0x54,0x84,0x0a,0x85,0xcf]
+ ctesttq {dfv=} %r9, %r15
diff --git a/llvm/test/MC/X86/apx/ctest-intel.s b/llvm/test/MC/X86/apx/ctest-intel.s
index af983a4fe62d0..dc7e0a80a53a8 100644
--- a/llvm/test/MC/X86/apx/ctest-intel.s
+++ b/llvm/test/MC/X86/apx/ctest-intel.s
@@ -769,53 +769,53 @@
# CHECK: encoding: [0x62,0x54,0xc4,0x04,0x85,0xcf]
cteste {dfv=of} r15, r9
-## "{evex} test*" are alias for "ctestt* {dfv=of,sf,zf,cf}"
+## "{evex} test*" are alias for "ctestt* {dfv=}"
-# CHECK: ctestt {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], 123
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0xf6,0x44,0x80,0x7b,0x7b]
- {evex} test byte ptr [r8 + 4*rax + 123], 123
-# CHECK: ctestt {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], 1234
-# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0xf7,0x44,0x80,0x7b,0xd2,0x04]
- {evex} test word ptr [r8 + 4*rax + 123], 1234
-# CHECK: ctestt {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], 123456
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
- {evex} test dword ptr [r8 + 4*rax + 123], 123456
-# CHECK: ctestt {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], 123456
-# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
- {evex} test qword ptr [r8 + 4*rax + 123], 123456
-# CHECK: ctestt {dfv=of,sf,zf,cf} byte ptr [r8 + 4*rax + 123], bl
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x84,0x5c,0x80,0x7b]
- {evex} test byte ptr [r8 + 4*rax + 123], bl
-# CHECK: ctestt {dfv=of,sf,zf,cf} word ptr [r8 + 4*rax + 123], dx
-# CHECK: encoding: [0x62,0xd4,0x7d,0x0a,0x85,0x54,0x80,0x7b]
- {evex} test word ptr [r8 + 4*rax + 123], dx
-# CHECK: ctestt {dfv=of,sf,zf,cf} dword ptr [r8 + 4*rax + 123], ecx
-# CHECK: encoding: [0x62,0xd4,0x7c,0x0a,0x85,0x4c,0x80,0x7b]
- {evex} test dword ptr [r8 + 4*rax + 123], ecx
-# CHECK: ctestt {dfv=of,sf,zf,cf} qword ptr [r8 + 4*rax + 123], r9
-# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x85,0x4c,0x80,0x7b]
- {evex} test qword ptr [r8 + 4*rax + 123], r9
-# CHECK: ctestt {dfv=of,sf,zf,cf} bl, 123
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0xf6,0xc3,0x7b]
- {evex} test bl, 123
-# CHECK: ctestt {dfv=of,sf,zf,cf} dx, 1234
-# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0xf7,0xc2,0xd2,0x04]
- {evex} test dx, 1234
-# CHECK: ctestt {dfv=of,sf,zf,cf} ecx, 123456
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0xf7,0xc1,0x40,0xe2,0x01,0x00]
- {evex} test ecx, 123456
-# CHECK: ctestt {dfv=of,sf,zf,cf} r9, 123456
-# CHECK: encoding: [0x62,0xd4,0xfc,0x0a,0xf7,0xc1,0x40,0xe2,0x01,0x00]
- {evex} test r9, 123456
-# CHECK: ctestt {dfv=of,sf,zf,cf} dl, bl
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x84,0xda]
- {evex} test dl, bl
-# CHECK: ctestt {dfv=of,sf,zf,cf} ax, dx
-# CHECK: encoding: [0x62,0xf4,0x7d,0x0a,0x85,0xd0]
- {evex} test ax, dx
-# CHECK: ctestt {dfv=of,sf,zf,cf} edx, ecx
-# CHECK: encoding: [0x62,0xf4,0x7c,0x0a,0x85,0xca]
- {evex} test edx, ecx
-# CHECK: ctestt {dfv=of,sf,zf,cf} r15, r9
-# CHECK: encoding: [0x62,0x54,0xfc,0x0a,0x85,0xcf]
- {evex} test r15, r9
+# CHECK: ctestt {dfv=} byte ptr [r8 + 4*rax + 123], 123
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0xf6,0x44,0x80,0x7b,0x7b]
+ ctestt {dfv=} byte ptr [r8 + 4*rax + 123], 123
+# CHECK: ctestt {dfv=} word ptr [r8 + 4*rax + 123], 1234
+# CHECK: encoding: [0x62,0xd4,0x05,0x0a,0xf7,0x44,0x80,0x7b,0xd2,0x04]
+ ctestt {dfv=} word ptr [r8 + 4*rax + 123], 1234
+# CHECK: ctestt {dfv=} dword ptr [r8 + 4*rax + 123], 123456
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ ctestt {dfv=} dword ptr [r8 + 4*rax + 123], 123456
+# CHECK: ctestt {dfv=} qword ptr [r8 + 4*rax + 123], 123456
+# CHECK: encoding: [0x62,0xd4,0x84,0x0a,0xf7,0x44,0x80,0x7b,0x40,0xe2,0x01,0x00]
+ ctestt {dfv=} qword ptr [r8 + 4*rax + 123], 123456
+# CHECK: ctestt {dfv=} byte ptr [r8 + 4*rax + 123], bl
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x84,0x5c,0x80,0x7b]
+ ctestt {dfv=} byte ptr [r8 + 4*rax + 123], bl
+# CHECK: ctestt {dfv=} word ptr [r8 + 4*rax + 123], dx
+# CHECK: encoding: [0x62,0xd4,0x05,0x0a,0x85,0x54,0x80,0x7b]
+ ctestt {dfv=} word ptr [r8 + 4*rax + 123], dx
+# CHECK: ctestt {dfv=} dword ptr [r8 + 4*rax + 123], ecx
+# CHECK: encoding: [0x62,0xd4,0x04,0x0a,0x85,0x4c,0x80,0x7b]
+ ctestt {dfv=} dword ptr [r8 + 4*rax + 123], ecx
+# CHECK: ctestt {dfv=} qword ptr [r8 + 4*rax + 123], r9
+# CHECK: encoding: [0x62,0x54,0x84,0x0a,0x85,0x4c,0x80,0x7b]
+ ctestt {dfv=} qword ptr [r8 + 4*rax + 123], r9
+# CHECK: ctestt {dfv=} bl, 123
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0xf6,0xc3,0x7b]
+ ctestt {dfv=} bl, 123
+# CHECK: ctestt {dfv=} dx, 1234
+# CHECK: encoding: [0x62,0xf4,0x05,0x0a,0xf7,0xc2,0xd2,0x04]
+ ctestt {dfv=} dx, 1234
+# CHECK: ctestt {dfv=} ecx, 123456
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0xf7,0xc1,0x40,0xe2,0x01,0x00]
+ ctestt {dfv=} ecx, 123456
+# CHECK: ctestt {dfv=} r9, 123456
+# CHECK: encoding: [0x62,0xd4,0x84,0x0a,0xf7,0xc1,0x40,0xe2,0x01,0x00]
+ ctestt {dfv=} r9, 123456
+# CHECK: ctestt {dfv=} dl, bl
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0x84,0xda]
+ ctestt {dfv=} dl, bl
+# CHECK: ctestt {dfv=} ax, dx
+# CHECK: encoding: [0x62,0xf4,0x05,0x0a,0x85,0xd0]
+ ctestt {dfv=} ax, dx
+# CHECK: ctestt {dfv=} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x04,0x0a,0x85,0xca]
+ ctestt {dfv=} edx, ecx
+# CHECK: ctestt {dfv=} r15, r9
+# CHECK: encoding: [0x62,0x54,0x84,0x0a,0x85,0xcf]
+ ctestt {dfv=} r15, r9
>From d64ac2e42088758d2758cdaa29f6a58f51c72e35 Mon Sep 17 00:00:00 2001
From: Freddy Ye <freddy.ye at intel.com>
Date: Thu, 25 Jul 2024 17:10:05 +0800
Subject: [PATCH 6/6] address comments
---
.../lib/Target/X86/AsmParser/X86AsmParser.cpp | 20 +++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 3aa59bb731c90..282fe69714e19 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -3753,6 +3753,17 @@ bool X86AsmParser::processInstruction(MCInst &Inst, const OperandVector &Ops) {
if (X86::optimizeShiftRotateWithImmediateOne(Inst))
return true;
+ auto replaceWithCCMP = [&] (unsigned Opcode) -> bool {
+ if (ForcedOpcodePrefix == OpcodePrefix_EVEX) {
+ Inst.setFlags(~(X86::IP_USE_EVEX) & Inst.getFlags());
+ Inst.setOpcode(Opcode);
+ Inst.addOperand(MCOperand::createImm(0));
+ Inst.addOperand(MCOperand::createImm(10));
+ return true;
+ }
+ return false;
+ };
+
switch (Inst.getOpcode()) {
default: return false;
case X86::JMP_1:
@@ -3787,14 +3798,7 @@ bool X86AsmParser::processInstruction(MCInst &Inst, const OperandVector &Ops) {
// `{evex} cmp <>, <>` is alias of `ccmpt {dfv=} <>, <>`
#define FROM_TO(FROM, TO) \
case X86::FROM: { \
- if (ForcedOpcodePrefix == OpcodePrefix_EVEX) { \
- Inst.setFlags(~(X86::IP_USE_EVEX) & Inst.getFlags()); \
- Inst.setOpcode(X86::TO); \
- Inst.addOperand(MCOperand::createImm(0)); \
- Inst.addOperand(MCOperand::createImm(10)); \
- return true; \
- } \
- return false; \
+ return replaceWithCCMP(X86::TO); \
}
FROM_TO(CMP64rr, CCMP64rr)
FROM_TO(CMP64mi32, CCMP64mi32)
More information about the llvm-commits
mailing list