Skip to content

[X86][MC] Add assembly alias for CCMP, CTEST, SETZUCC, CMPCCXADD #102284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

FreddyLeaf
Copy link
Contributor

No description provided.

FreddyLeaf added a commit to FreddyLeaf/llvm-project that referenced this pull request Aug 12, 2024
FreddyLeaf added a commit that referenced this pull request Aug 13, 2024
@FreddyLeaf FreddyLeaf changed the title [X86][TMP] Add missing assembly alias for CCMP, CTEST, SETZUCC, CMPCCXADD [X86][MC] Add assembly alias for CCMP, CTEST, SETZUCC, CMPCCXADD Aug 13, 2024
@FreddyLeaf FreddyLeaf requested a review from KanRobert August 13, 2024 01:01
@FreddyLeaf FreddyLeaf marked this pull request as ready for review August 13, 2024 01:01
@llvmbot llvmbot added backend:X86 mc Machine (object) code labels Aug 13, 2024
@llvmbot
Copy link
Member

llvmbot commented Aug 13, 2024

@llvm/pr-subscribers-mc

Author: Freddy Ye (FreddyLeaf)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/102284.diff

9 Files Affected:

  • (modified) llvm/lib/Target/X86/X86InstrAsmAlias.td (+28-6)
  • (modified) llvm/test/MC/X86/apx/ccmp-att.s (+40-1)
  • (modified) llvm/test/MC/X86/apx/ccmp-intel.s (+39)
  • (modified) llvm/test/MC/X86/apx/ctest-att.s (+40-1)
  • (modified) llvm/test/MC/X86/apx/ctest-intel.s (+39)
  • (modified) llvm/test/MC/X86/apx/setzucc-att.s (+45-1)
  • (modified) llvm/test/MC/X86/apx/setzucc-intel.s (+44)
  • (modified) llvm/test/MC/X86/cmpccxadd-att-alias.s (+32)
  • (modified) llvm/test/MC/X86/cmpccxadd-intel-alias.s (+32)
diff --git a/llvm/lib/Target/X86/X86InstrAsmAlias.td b/llvm/lib/Target/X86/X86InstrAsmAlias.td
index 423ee0e8c9bda2..5a4c3f61672b3f 100644
--- a/llvm/lib/Target/X86/X86InstrAsmAlias.td
+++ b/llvm/lib/Target/X86/X86InstrAsmAlias.td
@@ -124,19 +124,31 @@ def : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
 defm : CCMP_Aliases<"o" ,  0>;
 defm : CCMP_Aliases<"no",  1>;
 defm : CCMP_Aliases<"b" ,  2>;
+defm : CCMP_Aliases<"c" ,  2>;
+defm : CCMP_Aliases<"nae", 2>;
+defm : CCMP_Aliases<"nb",  3>;
+defm : CCMP_Aliases<"nc",  3>;
 defm : CCMP_Aliases<"ae",  3>;
 defm : CCMP_Aliases<"e" ,  4>;
+defm : CCMP_Aliases<"z" ,  4>;
 defm : CCMP_Aliases<"ne",  5>;
+defm : CCMP_Aliases<"nz",  5>;
 defm : CCMP_Aliases<"be",  6>;
+defm : CCMP_Aliases<"na",  6>;
+defm : CCMP_Aliases<"nbe", 7>;
 defm : CCMP_Aliases<"a" ,  7>;
 defm : CCMP_Aliases<"s" ,  8>;
 defm : CCMP_Aliases<"ns",  9>;
 defm : CCMP_Aliases<"t" , 10>;
 defm : CCMP_Aliases<"f", 11>;
 defm : CCMP_Aliases<"l" , 12>;
+defm : CCMP_Aliases<"nge",12>;
+defm : CCMP_Aliases<"nl", 13>;
 defm : CCMP_Aliases<"ge", 13>;
 defm : CCMP_Aliases<"le", 14>;
+defm : CCMP_Aliases<"ng", 14>;
 defm : CCMP_Aliases<"g" , 15>;
+defm : CCMP_Aliases<"nle",15>;
 
 // CTEST Instructions Alias
 multiclass CTEST_Aliases<string Cond, int CC> {
@@ -186,19 +198,31 @@ def : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
 defm : CTEST_Aliases<"o" ,  0>;
 defm : CTEST_Aliases<"no",  1>;
 defm : CTEST_Aliases<"b" ,  2>;
+defm : CTEST_Aliases<"c" ,  2>;
+defm : CTEST_Aliases<"nae", 2>;
+defm : CTEST_Aliases<"nb",  3>;
+defm : CTEST_Aliases<"nc",  3>;
 defm : CTEST_Aliases<"ae",  3>;
 defm : CTEST_Aliases<"e" ,  4>;
+defm : CTEST_Aliases<"z" ,  4>;
 defm : CTEST_Aliases<"ne",  5>;
+defm : CTEST_Aliases<"nz",  5>;
 defm : CTEST_Aliases<"be",  6>;
+defm : CTEST_Aliases<"na",  6>;
+defm : CTEST_Aliases<"nbe", 7>;
 defm : CTEST_Aliases<"a" ,  7>;
 defm : CTEST_Aliases<"s" ,  8>;
 defm : CTEST_Aliases<"ns",  9>;
 defm : CTEST_Aliases<"t" , 10>;
 defm : CTEST_Aliases<"f", 11>;
 defm : CTEST_Aliases<"l" , 12>;
+defm : CTEST_Aliases<"nge",12>;
+defm : CTEST_Aliases<"nl", 13>;
 defm : CTEST_Aliases<"ge", 13>;
 defm : CTEST_Aliases<"le", 14>;
+defm : CTEST_Aliases<"ng", 14>;
 defm : CTEST_Aliases<"g" , 15>;
+defm : CTEST_Aliases<"nle",15>;
 
 //===----------------------------------------------------------------------===//
 // Assembler Mnemonic Aliases
@@ -208,13 +232,9 @@ defm : CMPCCXADD_Aliases<"o" ,  0>;
 defm : CMPCCXADD_Aliases<"no",  1>;
 defm : CMPCCXADD_Aliases<"b" ,  2>;
 defm : CMPCCXADD_Aliases<"ae",  3>;
-defm : CMPCCXADD_Aliases<"nb",  3>;
 defm : CMPCCXADD_Aliases<"e" ,  4>;
-defm : CMPCCXADD_Aliases<"z" ,  4>;
 defm : CMPCCXADD_Aliases<"ne",  5>;
-defm : CMPCCXADD_Aliases<"nz",  5>;
 defm : CMPCCXADD_Aliases<"be",  6>;
-defm : CMPCCXADD_Aliases<"nbe", 7>;
 defm : CMPCCXADD_Aliases<"a",   7>;
 defm : CMPCCXADD_Aliases<"s" ,  8>;
 defm : CMPCCXADD_Aliases<"ns",  9>;
@@ -222,10 +242,8 @@ defm : CMPCCXADD_Aliases<"p" , 10>;
 defm : CMPCCXADD_Aliases<"np", 11>;
 defm : CMPCCXADD_Aliases<"l" , 12>;
 defm : CMPCCXADD_Aliases<"ge", 13>;
-defm : CMPCCXADD_Aliases<"nl", 13>;
 defm : CMPCCXADD_Aliases<"le", 14>;
 defm : CMPCCXADD_Aliases<"g",  15>;
-defm : CMPCCXADD_Aliases<"nle",15>;
 
 
 def : MnemonicAlias<"call", "callw", "att">, Requires<[In16BitMode]>;
@@ -403,6 +421,7 @@ multiclass IntegerCondCodeMnemonicAlias<string Prefix, string Suffix,
 
 // Aliases for set<CC>
 defm : IntegerCondCodeMnemonicAlias<"set", "">;
+defm : IntegerCondCodeMnemonicAlias<"setzu", "">;
 // Aliases for j<CC>
 defm : IntegerCondCodeMnemonicAlias<"j", "">;
 // Aliases for cmov<CC>{w,l,q}
@@ -418,6 +437,9 @@ defm : IntegerCondCodeMnemonicAlias<"cfcmov", "l", "att">;
 defm : IntegerCondCodeMnemonicAlias<"cfcmov", "q", "att">;
 // No size suffix for intel-style asm.
 defm : IntegerCondCodeMnemonicAlias<"cfcmov", "", "intel">;
+
+// Aliases for cmp<CC>xadd
+defm : IntegerCondCodeMnemonicAlias<"cmp", "xadd", "">;
 //===----------------------------------------------------------------------===//
 // Assembler Instruction Aliases
 //===----------------------------------------------------------------------===//
diff --git a/llvm/test/MC/X86/apx/ccmp-att.s b/llvm/test/MC/X86/apx/ccmp-att.s
index e7dd91d7da66cc..6e919bcd7f57fe 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-454: error:
+# ERROR-COUNT-466: error:
 # ERROR-NOT: error:
 ## Condition flags
 
@@ -1376,3 +1376,42 @@
 # CHECK: ccmptq	{dfv=}	%r9, %r15
 # CHECK: encoding: [0x62,0x54,0x84,0x0a,0x39,0xcf]
          {evex} cmpq	%r9, %r15
+
+## Condition Code Aliases
+
+# CHECK: ccmpbl {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x39,0xca]
+         ccmpcl {dfv=of} %ecx, %edx
+# CHECK: ccmpbl {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x39,0xca]
+         ccmpnael {dfv=of} %ecx, %edx
+# CHECK: ccmpael {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x39,0xca]
+         ccmpnbl {dfv=of} %ecx, %edx
+# CHECK: ccmpael {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x39,0xca]
+         ccmpncl {dfv=of} %ecx, %edx
+# CHECK: ccmpel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x04,0x39,0xca]
+         ccmpzl {dfv=of} %ecx, %edx
+# CHECK: ccmpnel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x05,0x39,0xca]
+         ccmpnzl {dfv=of} %ecx, %edx
+# CHECK: ccmpal {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x07,0x39,0xca]
+         ccmpnbel {dfv=of} %ecx, %edx
+# CHECK: ccmpll {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0c,0x39,0xca]
+         ccmpngel {dfv=of} %ecx, %edx
+# CHECK: ccmpgel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0d,0x39,0xca]
+         ccmpnll {dfv=of} %ecx, %edx
+# CHECK: ccmplel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0e,0x39,0xca]
+         ccmpngl {dfv=of} %ecx, %edx
+# CHECK: ccmpgl {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0f,0x39,0xca]
+         ccmpnlel {dfv=of} %ecx, %edx
+# CHECK: ccmpbel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x06,0x39,0xca]
+         ccmpnal {dfv=of} %ecx, %edx
\ No newline at end of file
diff --git a/llvm/test/MC/X86/apx/ccmp-intel.s b/llvm/test/MC/X86/apx/ccmp-intel.s
index ec3f72b8a0a8d1..c537633487294f 100644
--- a/llvm/test/MC/X86/apx/ccmp-intel.s
+++ b/llvm/test/MC/X86/apx/ccmp-intel.s
@@ -1373,3 +1373,42 @@
 # CHECK: ccmpt	{dfv=}	r15, r9
 # CHECK: encoding: [0x62,0x54,0x84,0x0a,0x39,0xcf]
          {evex} cmp	r15, r9
+
+## Condition Code Aliases
+
+# CHECK: ccmpb {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x39,0xca]
+         ccmpc {dfv=of} edx, ecx
+# CHECK: ccmpb {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x39,0xca]
+         ccmpnae {dfv=of} edx, ecx
+# CHECK: ccmpae {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x39,0xca]
+         ccmpnb {dfv=of} edx, ecx
+# CHECK: ccmpae {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x39,0xca]
+         ccmpnc {dfv=of} edx, ecx
+# CHECK: ccmpe {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x04,0x39,0xca]
+         ccmpz {dfv=of} edx, ecx
+# CHECK: ccmpne {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x05,0x39,0xca]
+         ccmpnz {dfv=of} edx, ecx
+# CHECK: ccmpa {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x07,0x39,0xca]
+         ccmpnbe {dfv=of} edx, ecx
+# CHECK: ccmpl {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0c,0x39,0xca]
+         ccmpnge {dfv=of} edx, ecx
+# CHECK: ccmpge {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0d,0x39,0xca]
+         ccmpnl {dfv=of} edx, ecx
+# CHECK: ccmple {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0e,0x39,0xca]
+         ccmpng {dfv=of} edx, ecx
+# CHECK: ccmpg {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0f,0x39,0xca]
+         ccmpnle {dfv=of} edx, ecx
+# CHECK: ccmpbe {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x06,0x39,0xca]
+         ccmpna {dfv=of} edx, ecx
diff --git a/llvm/test/MC/X86/apx/ctest-att.s b/llvm/test/MC/X86/apx/ctest-att.s
index 4cb928748a1d26..3b6e0b4508432f 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-276: error:
+# ERROR-COUNT-288: error:
 # ERROR-NOT: error:
 # CHECK: ctestbb {dfv=of} $123, 123(%r8,%rax,4)
 # CHECK: encoding: [0x62,0xd4,0x44,0x02,0xf6,0x44,0x80,0x7b,0x7b]
@@ -835,3 +835,42 @@
 # CHECK: ctesttq	{dfv=}	%r9, %r15
 # CHECK: encoding: [0x62,0x54,0x84,0x0a,0x85,0xcf]
          {evex} testq	%r9, %r15
+
+## Condition Code Aliases
+
+# CHECK: ctestbl {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x85,0xca]
+         ctestcl {dfv=of} %ecx, %edx
+# CHECK: ctestbl {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x85,0xca]
+         ctestnael {dfv=of} %ecx, %edx
+# CHECK: ctestael {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x85,0xca]
+         ctestnbl {dfv=of} %ecx, %edx
+# CHECK: ctestael {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x85,0xca]
+         ctestncl {dfv=of} %ecx, %edx
+# CHECK: ctestel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x04,0x85,0xca]
+         ctestzl {dfv=of} %ecx, %edx
+# CHECK: ctestnel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x05,0x85,0xca]
+         ctestnzl {dfv=of} %ecx, %edx
+# CHECK: ctestal {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x07,0x85,0xca]
+         ctestnbel {dfv=of} %ecx, %edx
+# CHECK: ctestll {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0c,0x85,0xca]
+         ctestngel {dfv=of} %ecx, %edx
+# CHECK: ctestgel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0d,0x85,0xca]
+         ctestnll {dfv=of} %ecx, %edx
+# CHECK: ctestlel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0e,0x85,0xca]
+         ctestngl {dfv=of} %ecx, %edx
+# CHECK: ctestgl {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0f,0x85,0xca]
+         ctestnlel {dfv=of} %ecx, %edx
+# CHECK: ctestbel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x06,0x85,0xca]
+         ctestnal {dfv=of} %ecx, %edx
diff --git a/llvm/test/MC/X86/apx/ctest-intel.s b/llvm/test/MC/X86/apx/ctest-intel.s
index 701c517e27a798..ad065f8d767360 100644
--- a/llvm/test/MC/X86/apx/ctest-intel.s
+++ b/llvm/test/MC/X86/apx/ctest-intel.s
@@ -831,3 +831,42 @@
 # CHECK: ctestt	{dfv=}	r15, r9
 # CHECK: encoding: [0x62,0x54,0x84,0x0a,0x85,0xcf]
          {evex} test	r15, r9
+
+## Condition Code Aliases
+
+# CHECK: ctestb {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x85,0xca]
+         ctestc {dfv=of} edx, ecx
+# CHECK: ctestb {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x85,0xca]
+         ctestnae {dfv=of} edx, ecx
+# CHECK: ctestae {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x85,0xca]
+         ctestnb {dfv=of} edx, ecx
+# CHECK: ctestae {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x85,0xca]
+         ctestnc {dfv=of} edx, ecx
+# CHECK: cteste {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x04,0x85,0xca]
+         ctestz {dfv=of} edx, ecx
+# CHECK: ctestne {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x05,0x85,0xca]
+         ctestnz {dfv=of} edx, ecx
+# CHECK: ctesta {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x07,0x85,0xca]
+         ctestnbe {dfv=of} edx, ecx
+# CHECK: ctestl {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0c,0x85,0xca]
+         ctestnge {dfv=of} edx, ecx
+# CHECK: ctestge {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0d,0x85,0xca]
+         ctestnl {dfv=of} edx, ecx
+# CHECK: ctestle {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0e,0x85,0xca]
+         ctestng {dfv=of} edx, ecx
+# CHECK: ctestg {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0f,0x85,0xca]
+         ctestnle {dfv=of} edx, ecx
+# CHECK: ctestbe {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x06,0x85,0xca]
+         ctestna {dfv=of} edx, ecx
diff --git a/llvm/test/MC/X86/apx/setzucc-att.s b/llvm/test/MC/X86/apx/setzucc-att.s
index b4b7a633fa319a..941057b1e72fc6 100644
--- a/llvm/test/MC/X86/apx/setzucc-att.s
+++ b/llvm/test/MC/X86/apx/setzucc-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-32: error:
+# ERROR-COUNT-46: error:
 # ERROR-NOT: error:
 # CHECK: setzuo	%al
 # CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x40,0xc0]
@@ -99,3 +99,47 @@
 # CHECK: setzug	(%rax)
 # CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4f,0x00]
          setzug	(%rax)
+
+# Alias tests:
+# CHECK: setzub	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x42,0xc0]
+         setzunae	%al
+# CHECK: setzub	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x42,0xc0]
+         setzuc	%al
+# CHECK: setzuae	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x43,0xc0]
+         setzunb	%al
+# CHECK: setzuae	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x43,0xc0]
+         setzunc	%al
+# CHECK: setzue	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x44,0xc0]
+         setzuz	%al
+# CHECK: setzune	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x45,0xc0]
+         setzunz	%al
+# CHECK: setzube	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x46,0xc0]
+         setzuna	%al
+# CHECK: setzua	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x47,0xc0]
+         setzunbe	%al
+# CHECK: setzup	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4a,0xc0]
+         setzupe	%al
+# CHECK: setzunp	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4b,0xc0]
+         setzupo	%al
+# CHECK: setzul	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4c,0xc0]
+         setzunge	%al
+# CHECK: setzuge	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4d,0xc0]
+         setzunl	%al
+# CHECK: setzule	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4e,0xc0]
+         setzung	%al
+# CHECK: setzug	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4f,0xc0]
+         setzunle	%al
diff --git a/llvm/test/MC/X86/apx/setzucc-intel.s b/llvm/test/MC/X86/apx/setzucc-intel.s
index bdefba6ac8d30a..d5476e5c1534f5 100644
--- a/llvm/test/MC/X86/apx/setzucc-intel.s
+++ b/llvm/test/MC/X86/apx/setzucc-intel.s
@@ -96,3 +96,47 @@
 # CHECK: setzug	byte ptr [rax]
 # CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4f,0x00]
          setzug	byte ptr [rax]
+
+# Alias tests:
+# CHECK: setzub	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x42,0xc0]
+         setzunae	al
+# CHECK: setzub	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x42,0xc0]
+         setzuc	al
+# CHECK: setzuae	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x43,0xc0]
+         setzunb	al
+# CHECK: setzuae	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x43,0xc0]
+         setzunc	al
+# CHECK: setzue	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x44,0xc0]
+         setzuz	al
+# CHECK: setzune	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x45,0xc0]
+         setzunz	al
+# CHECK: setzube	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x46,0xc0]
+         setzuna	al
+# CHECK: setzua	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x47,0xc0]
+         setzunbe	al
+# CHECK: setzup	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4a,0xc0]
+         setzupe	al
+# CHECK: setzunp	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4b,0xc0]
+         setzupo	al
+# CHECK: setzul	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4c,0xc0]
+         setzunge	al
+# CHECK: setzuge	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4d,0xc0]
+         setzunl	al
+# CHECK: setzule	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4e,0xc0]
+         setzung	al
+# CHECK: setzug	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4f,0xc0]
+         setzunle	al
\ No newline at end of file
diff --git a/llvm/test/MC/X86/cmpccxadd-att-alias.s b/llvm/test/MC/X86/cmpccxadd-att-alias.s
index e4d8fff0a38962..dcc0f105d7abc1 100644
--- a/llvm/test/MC/X86/cmpccxadd-att-alias.s
+++ b/llvm/test/MC/X86/cmpccxadd-att-alias.s
@@ -24,3 +24,35 @@
 // CHECK: encoding: [0xc4,0xe2,0x79,0xef,0x0d,0x00,0x00,0x00,0x00]
           cmpgxadd  %eax, %ecx, (%rip)
 
+// CHECK: cmpbxadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe2,0x0d,0x00,0x00,0x00,0x00]
+          cmpcxadd  %eax, %ecx, (%rip)
+
+// CHECK: cmpbxadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe2,0x0d,0x00,0x00,0x00,0x00]
+          cmpnaexadd  %eax, %ecx, (%rip)
+
+// CHECK: cmpnbxadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe3,0x0d,0x00,0x00,0x00,0x00]
+          cmpncxadd  %eax, %ecx, (%rip)
+
+// CHECK: cmpbexadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe6,0x0d,0x00,0x00,0x00,0x00]
+          cmpnaxadd  %eax, %ecx, (%rip)
+
+// CHECK: cmplexadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xee,0x0d,0x00,0x00,0x00,0x00]
+          cmpngxadd  %eax, %ecx, (%rip)
+
+// CHECK: cmppxadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xea,0x0d,0x00,0x00,0x00,0x00]
+          cmppexadd  %eax, %ecx, (%rip)
+
+// CHECK: cmpnpxadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xeb,0x0d,0x00,0x00,0x00,0x00]
+          cmppoxadd  %eax, %ecx, (%rip)
+
+// CHECK: cmplxadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xec,0x0d,0x00,0x00,0x00,0x00]
+          cmpngexadd  %eax, %ecx, (%rip)
+
diff --git a/llvm/test/MC/X86/cmpccxadd-intel-alias.s b/llvm/test/MC/X86/cmpccxadd-intel-alias.s
index 68a8736a3b688c..f5c7a6b6a2e0a5 100644
--- a/llvm/test/MC/X86/cmpccxadd-intel-alias.s
+++ b/llvm/test/MC/X86/cmpccxadd-intel-alias.s
@@ -23,3 +23,35 @@
 // CHECK: cmpnlexadd dword ptr [rip], ecx, eax
 // CHECK: encoding: [0xc4,0xe2,0x79,0xef,0x0d,0x00,0x00,0x00,0x00]
           cmpgxadd dword ptr [rip], ecx, eax
+
+// CHECK: cmpbxadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe2,0x0d,0x00,0x00,0x00,0x00]
+          cmpcxadd  dword ptr [rip], ecx, eax
+
+// CHECK: cmpbxadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe2,0x0d,0x00,0x00,0x00,0x00]
+          cmpnaexadd  dword ptr [rip], ecx, eax
+
+// CHECK: cmpnbxadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe3,0x0d,0x00,0x00,0x00,0x00]
+          cmpncxadd  dword ptr [rip], ecx, eax
+
+// CHECK: cmpbexadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe6,0x0d,0x00,0x00,0x00,0x00]
+          cmpnaxadd  dword ptr [rip], ecx, eax
+
+// CHECK: cmplexadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xee,0x0d,0x00,0x00,0x00,0x00]
+          cmpngxadd  dword ptr [rip], ecx, eax
+
+// CHECK: cmppxadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xea,0x0d,0x00,0x00,0x00,0x00]
+          cmppexadd  dword ptr [rip], ecx, eax
+
+// CHECK: cmpnpxadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xeb,0x0d,0x00,0x00,0x00,0x00]
+          cmppoxadd  dword ptr [rip], ecx, eax
+
+// CHECK: cmplxadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xec,0x0d,0x00,0x00,0x00,0x00]
+          cmpngexadd  dword ptr [rip], ecx, eax

@llvmbot
Copy link
Member

llvmbot commented Aug 13, 2024

@llvm/pr-subscribers-backend-x86

Author: Freddy Ye (FreddyLeaf)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/102284.diff

9 Files Affected:

  • (modified) llvm/lib/Target/X86/X86InstrAsmAlias.td (+28-6)
  • (modified) llvm/test/MC/X86/apx/ccmp-att.s (+40-1)
  • (modified) llvm/test/MC/X86/apx/ccmp-intel.s (+39)
  • (modified) llvm/test/MC/X86/apx/ctest-att.s (+40-1)
  • (modified) llvm/test/MC/X86/apx/ctest-intel.s (+39)
  • (modified) llvm/test/MC/X86/apx/setzucc-att.s (+45-1)
  • (modified) llvm/test/MC/X86/apx/setzucc-intel.s (+44)
  • (modified) llvm/test/MC/X86/cmpccxadd-att-alias.s (+32)
  • (modified) llvm/test/MC/X86/cmpccxadd-intel-alias.s (+32)
diff --git a/llvm/lib/Target/X86/X86InstrAsmAlias.td b/llvm/lib/Target/X86/X86InstrAsmAlias.td
index 423ee0e8c9bda2..5a4c3f61672b3f 100644
--- a/llvm/lib/Target/X86/X86InstrAsmAlias.td
+++ b/llvm/lib/Target/X86/X86InstrAsmAlias.td
@@ -124,19 +124,31 @@ def : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
 defm : CCMP_Aliases<"o" ,  0>;
 defm : CCMP_Aliases<"no",  1>;
 defm : CCMP_Aliases<"b" ,  2>;
+defm : CCMP_Aliases<"c" ,  2>;
+defm : CCMP_Aliases<"nae", 2>;
+defm : CCMP_Aliases<"nb",  3>;
+defm : CCMP_Aliases<"nc",  3>;
 defm : CCMP_Aliases<"ae",  3>;
 defm : CCMP_Aliases<"e" ,  4>;
+defm : CCMP_Aliases<"z" ,  4>;
 defm : CCMP_Aliases<"ne",  5>;
+defm : CCMP_Aliases<"nz",  5>;
 defm : CCMP_Aliases<"be",  6>;
+defm : CCMP_Aliases<"na",  6>;
+defm : CCMP_Aliases<"nbe", 7>;
 defm : CCMP_Aliases<"a" ,  7>;
 defm : CCMP_Aliases<"s" ,  8>;
 defm : CCMP_Aliases<"ns",  9>;
 defm : CCMP_Aliases<"t" , 10>;
 defm : CCMP_Aliases<"f", 11>;
 defm : CCMP_Aliases<"l" , 12>;
+defm : CCMP_Aliases<"nge",12>;
+defm : CCMP_Aliases<"nl", 13>;
 defm : CCMP_Aliases<"ge", 13>;
 defm : CCMP_Aliases<"le", 14>;
+defm : CCMP_Aliases<"ng", 14>;
 defm : CCMP_Aliases<"g" , 15>;
+defm : CCMP_Aliases<"nle",15>;
 
 // CTEST Instructions Alias
 multiclass CTEST_Aliases<string Cond, int CC> {
@@ -186,19 +198,31 @@ def : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
 defm : CTEST_Aliases<"o" ,  0>;
 defm : CTEST_Aliases<"no",  1>;
 defm : CTEST_Aliases<"b" ,  2>;
+defm : CTEST_Aliases<"c" ,  2>;
+defm : CTEST_Aliases<"nae", 2>;
+defm : CTEST_Aliases<"nb",  3>;
+defm : CTEST_Aliases<"nc",  3>;
 defm : CTEST_Aliases<"ae",  3>;
 defm : CTEST_Aliases<"e" ,  4>;
+defm : CTEST_Aliases<"z" ,  4>;
 defm : CTEST_Aliases<"ne",  5>;
+defm : CTEST_Aliases<"nz",  5>;
 defm : CTEST_Aliases<"be",  6>;
+defm : CTEST_Aliases<"na",  6>;
+defm : CTEST_Aliases<"nbe", 7>;
 defm : CTEST_Aliases<"a" ,  7>;
 defm : CTEST_Aliases<"s" ,  8>;
 defm : CTEST_Aliases<"ns",  9>;
 defm : CTEST_Aliases<"t" , 10>;
 defm : CTEST_Aliases<"f", 11>;
 defm : CTEST_Aliases<"l" , 12>;
+defm : CTEST_Aliases<"nge",12>;
+defm : CTEST_Aliases<"nl", 13>;
 defm : CTEST_Aliases<"ge", 13>;
 defm : CTEST_Aliases<"le", 14>;
+defm : CTEST_Aliases<"ng", 14>;
 defm : CTEST_Aliases<"g" , 15>;
+defm : CTEST_Aliases<"nle",15>;
 
 //===----------------------------------------------------------------------===//
 // Assembler Mnemonic Aliases
@@ -208,13 +232,9 @@ defm : CMPCCXADD_Aliases<"o" ,  0>;
 defm : CMPCCXADD_Aliases<"no",  1>;
 defm : CMPCCXADD_Aliases<"b" ,  2>;
 defm : CMPCCXADD_Aliases<"ae",  3>;
-defm : CMPCCXADD_Aliases<"nb",  3>;
 defm : CMPCCXADD_Aliases<"e" ,  4>;
-defm : CMPCCXADD_Aliases<"z" ,  4>;
 defm : CMPCCXADD_Aliases<"ne",  5>;
-defm : CMPCCXADD_Aliases<"nz",  5>;
 defm : CMPCCXADD_Aliases<"be",  6>;
-defm : CMPCCXADD_Aliases<"nbe", 7>;
 defm : CMPCCXADD_Aliases<"a",   7>;
 defm : CMPCCXADD_Aliases<"s" ,  8>;
 defm : CMPCCXADD_Aliases<"ns",  9>;
@@ -222,10 +242,8 @@ defm : CMPCCXADD_Aliases<"p" , 10>;
 defm : CMPCCXADD_Aliases<"np", 11>;
 defm : CMPCCXADD_Aliases<"l" , 12>;
 defm : CMPCCXADD_Aliases<"ge", 13>;
-defm : CMPCCXADD_Aliases<"nl", 13>;
 defm : CMPCCXADD_Aliases<"le", 14>;
 defm : CMPCCXADD_Aliases<"g",  15>;
-defm : CMPCCXADD_Aliases<"nle",15>;
 
 
 def : MnemonicAlias<"call", "callw", "att">, Requires<[In16BitMode]>;
@@ -403,6 +421,7 @@ multiclass IntegerCondCodeMnemonicAlias<string Prefix, string Suffix,
 
 // Aliases for set<CC>
 defm : IntegerCondCodeMnemonicAlias<"set", "">;
+defm : IntegerCondCodeMnemonicAlias<"setzu", "">;
 // Aliases for j<CC>
 defm : IntegerCondCodeMnemonicAlias<"j", "">;
 // Aliases for cmov<CC>{w,l,q}
@@ -418,6 +437,9 @@ defm : IntegerCondCodeMnemonicAlias<"cfcmov", "l", "att">;
 defm : IntegerCondCodeMnemonicAlias<"cfcmov", "q", "att">;
 // No size suffix for intel-style asm.
 defm : IntegerCondCodeMnemonicAlias<"cfcmov", "", "intel">;
+
+// Aliases for cmp<CC>xadd
+defm : IntegerCondCodeMnemonicAlias<"cmp", "xadd", "">;
 //===----------------------------------------------------------------------===//
 // Assembler Instruction Aliases
 //===----------------------------------------------------------------------===//
diff --git a/llvm/test/MC/X86/apx/ccmp-att.s b/llvm/test/MC/X86/apx/ccmp-att.s
index e7dd91d7da66cc..6e919bcd7f57fe 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-454: error:
+# ERROR-COUNT-466: error:
 # ERROR-NOT: error:
 ## Condition flags
 
@@ -1376,3 +1376,42 @@
 # CHECK: ccmptq	{dfv=}	%r9, %r15
 # CHECK: encoding: [0x62,0x54,0x84,0x0a,0x39,0xcf]
          {evex} cmpq	%r9, %r15
+
+## Condition Code Aliases
+
+# CHECK: ccmpbl {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x39,0xca]
+         ccmpcl {dfv=of} %ecx, %edx
+# CHECK: ccmpbl {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x39,0xca]
+         ccmpnael {dfv=of} %ecx, %edx
+# CHECK: ccmpael {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x39,0xca]
+         ccmpnbl {dfv=of} %ecx, %edx
+# CHECK: ccmpael {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x39,0xca]
+         ccmpncl {dfv=of} %ecx, %edx
+# CHECK: ccmpel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x04,0x39,0xca]
+         ccmpzl {dfv=of} %ecx, %edx
+# CHECK: ccmpnel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x05,0x39,0xca]
+         ccmpnzl {dfv=of} %ecx, %edx
+# CHECK: ccmpal {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x07,0x39,0xca]
+         ccmpnbel {dfv=of} %ecx, %edx
+# CHECK: ccmpll {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0c,0x39,0xca]
+         ccmpngel {dfv=of} %ecx, %edx
+# CHECK: ccmpgel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0d,0x39,0xca]
+         ccmpnll {dfv=of} %ecx, %edx
+# CHECK: ccmplel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0e,0x39,0xca]
+         ccmpngl {dfv=of} %ecx, %edx
+# CHECK: ccmpgl {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0f,0x39,0xca]
+         ccmpnlel {dfv=of} %ecx, %edx
+# CHECK: ccmpbel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x06,0x39,0xca]
+         ccmpnal {dfv=of} %ecx, %edx
\ No newline at end of file
diff --git a/llvm/test/MC/X86/apx/ccmp-intel.s b/llvm/test/MC/X86/apx/ccmp-intel.s
index ec3f72b8a0a8d1..c537633487294f 100644
--- a/llvm/test/MC/X86/apx/ccmp-intel.s
+++ b/llvm/test/MC/X86/apx/ccmp-intel.s
@@ -1373,3 +1373,42 @@
 # CHECK: ccmpt	{dfv=}	r15, r9
 # CHECK: encoding: [0x62,0x54,0x84,0x0a,0x39,0xcf]
          {evex} cmp	r15, r9
+
+## Condition Code Aliases
+
+# CHECK: ccmpb {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x39,0xca]
+         ccmpc {dfv=of} edx, ecx
+# CHECK: ccmpb {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x39,0xca]
+         ccmpnae {dfv=of} edx, ecx
+# CHECK: ccmpae {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x39,0xca]
+         ccmpnb {dfv=of} edx, ecx
+# CHECK: ccmpae {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x39,0xca]
+         ccmpnc {dfv=of} edx, ecx
+# CHECK: ccmpe {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x04,0x39,0xca]
+         ccmpz {dfv=of} edx, ecx
+# CHECK: ccmpne {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x05,0x39,0xca]
+         ccmpnz {dfv=of} edx, ecx
+# CHECK: ccmpa {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x07,0x39,0xca]
+         ccmpnbe {dfv=of} edx, ecx
+# CHECK: ccmpl {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0c,0x39,0xca]
+         ccmpnge {dfv=of} edx, ecx
+# CHECK: ccmpge {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0d,0x39,0xca]
+         ccmpnl {dfv=of} edx, ecx
+# CHECK: ccmple {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0e,0x39,0xca]
+         ccmpng {dfv=of} edx, ecx
+# CHECK: ccmpg {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0f,0x39,0xca]
+         ccmpnle {dfv=of} edx, ecx
+# CHECK: ccmpbe {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x06,0x39,0xca]
+         ccmpna {dfv=of} edx, ecx
diff --git a/llvm/test/MC/X86/apx/ctest-att.s b/llvm/test/MC/X86/apx/ctest-att.s
index 4cb928748a1d26..3b6e0b4508432f 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-276: error:
+# ERROR-COUNT-288: error:
 # ERROR-NOT: error:
 # CHECK: ctestbb {dfv=of} $123, 123(%r8,%rax,4)
 # CHECK: encoding: [0x62,0xd4,0x44,0x02,0xf6,0x44,0x80,0x7b,0x7b]
@@ -835,3 +835,42 @@
 # CHECK: ctesttq	{dfv=}	%r9, %r15
 # CHECK: encoding: [0x62,0x54,0x84,0x0a,0x85,0xcf]
          {evex} testq	%r9, %r15
+
+## Condition Code Aliases
+
+# CHECK: ctestbl {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x85,0xca]
+         ctestcl {dfv=of} %ecx, %edx
+# CHECK: ctestbl {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x85,0xca]
+         ctestnael {dfv=of} %ecx, %edx
+# CHECK: ctestael {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x85,0xca]
+         ctestnbl {dfv=of} %ecx, %edx
+# CHECK: ctestael {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x85,0xca]
+         ctestncl {dfv=of} %ecx, %edx
+# CHECK: ctestel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x04,0x85,0xca]
+         ctestzl {dfv=of} %ecx, %edx
+# CHECK: ctestnel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x05,0x85,0xca]
+         ctestnzl {dfv=of} %ecx, %edx
+# CHECK: ctestal {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x07,0x85,0xca]
+         ctestnbel {dfv=of} %ecx, %edx
+# CHECK: ctestll {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0c,0x85,0xca]
+         ctestngel {dfv=of} %ecx, %edx
+# CHECK: ctestgel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0d,0x85,0xca]
+         ctestnll {dfv=of} %ecx, %edx
+# CHECK: ctestlel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0e,0x85,0xca]
+         ctestngl {dfv=of} %ecx, %edx
+# CHECK: ctestgl {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0f,0x85,0xca]
+         ctestnlel {dfv=of} %ecx, %edx
+# CHECK: ctestbel {dfv=of} %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x44,0x06,0x85,0xca]
+         ctestnal {dfv=of} %ecx, %edx
diff --git a/llvm/test/MC/X86/apx/ctest-intel.s b/llvm/test/MC/X86/apx/ctest-intel.s
index 701c517e27a798..ad065f8d767360 100644
--- a/llvm/test/MC/X86/apx/ctest-intel.s
+++ b/llvm/test/MC/X86/apx/ctest-intel.s
@@ -831,3 +831,42 @@
 # CHECK: ctestt	{dfv=}	r15, r9
 # CHECK: encoding: [0x62,0x54,0x84,0x0a,0x85,0xcf]
          {evex} test	r15, r9
+
+## Condition Code Aliases
+
+# CHECK: ctestb {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x85,0xca]
+         ctestc {dfv=of} edx, ecx
+# CHECK: ctestb {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x02,0x85,0xca]
+         ctestnae {dfv=of} edx, ecx
+# CHECK: ctestae {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x85,0xca]
+         ctestnb {dfv=of} edx, ecx
+# CHECK: ctestae {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x03,0x85,0xca]
+         ctestnc {dfv=of} edx, ecx
+# CHECK: cteste {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x04,0x85,0xca]
+         ctestz {dfv=of} edx, ecx
+# CHECK: ctestne {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x05,0x85,0xca]
+         ctestnz {dfv=of} edx, ecx
+# CHECK: ctesta {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x07,0x85,0xca]
+         ctestnbe {dfv=of} edx, ecx
+# CHECK: ctestl {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0c,0x85,0xca]
+         ctestnge {dfv=of} edx, ecx
+# CHECK: ctestge {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0d,0x85,0xca]
+         ctestnl {dfv=of} edx, ecx
+# CHECK: ctestle {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0e,0x85,0xca]
+         ctestng {dfv=of} edx, ecx
+# CHECK: ctestg {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x0f,0x85,0xca]
+         ctestnle {dfv=of} edx, ecx
+# CHECK: ctestbe {dfv=of} edx, ecx
+# CHECK: encoding: [0x62,0xf4,0x44,0x06,0x85,0xca]
+         ctestna {dfv=of} edx, ecx
diff --git a/llvm/test/MC/X86/apx/setzucc-att.s b/llvm/test/MC/X86/apx/setzucc-att.s
index b4b7a633fa319a..941057b1e72fc6 100644
--- a/llvm/test/MC/X86/apx/setzucc-att.s
+++ b/llvm/test/MC/X86/apx/setzucc-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-32: error:
+# ERROR-COUNT-46: error:
 # ERROR-NOT: error:
 # CHECK: setzuo	%al
 # CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x40,0xc0]
@@ -99,3 +99,47 @@
 # CHECK: setzug	(%rax)
 # CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4f,0x00]
          setzug	(%rax)
+
+# Alias tests:
+# CHECK: setzub	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x42,0xc0]
+         setzunae	%al
+# CHECK: setzub	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x42,0xc0]
+         setzuc	%al
+# CHECK: setzuae	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x43,0xc0]
+         setzunb	%al
+# CHECK: setzuae	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x43,0xc0]
+         setzunc	%al
+# CHECK: setzue	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x44,0xc0]
+         setzuz	%al
+# CHECK: setzune	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x45,0xc0]
+         setzunz	%al
+# CHECK: setzube	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x46,0xc0]
+         setzuna	%al
+# CHECK: setzua	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x47,0xc0]
+         setzunbe	%al
+# CHECK: setzup	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4a,0xc0]
+         setzupe	%al
+# CHECK: setzunp	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4b,0xc0]
+         setzupo	%al
+# CHECK: setzul	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4c,0xc0]
+         setzunge	%al
+# CHECK: setzuge	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4d,0xc0]
+         setzunl	%al
+# CHECK: setzule	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4e,0xc0]
+         setzung	%al
+# CHECK: setzug	%al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4f,0xc0]
+         setzunle	%al
diff --git a/llvm/test/MC/X86/apx/setzucc-intel.s b/llvm/test/MC/X86/apx/setzucc-intel.s
index bdefba6ac8d30a..d5476e5c1534f5 100644
--- a/llvm/test/MC/X86/apx/setzucc-intel.s
+++ b/llvm/test/MC/X86/apx/setzucc-intel.s
@@ -96,3 +96,47 @@
 # CHECK: setzug	byte ptr [rax]
 # CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4f,0x00]
          setzug	byte ptr [rax]
+
+# Alias tests:
+# CHECK: setzub	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x42,0xc0]
+         setzunae	al
+# CHECK: setzub	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x42,0xc0]
+         setzuc	al
+# CHECK: setzuae	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x43,0xc0]
+         setzunb	al
+# CHECK: setzuae	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x43,0xc0]
+         setzunc	al
+# CHECK: setzue	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x44,0xc0]
+         setzuz	al
+# CHECK: setzune	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x45,0xc0]
+         setzunz	al
+# CHECK: setzube	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x46,0xc0]
+         setzuna	al
+# CHECK: setzua	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x47,0xc0]
+         setzunbe	al
+# CHECK: setzup	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4a,0xc0]
+         setzupe	al
+# CHECK: setzunp	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4b,0xc0]
+         setzupo	al
+# CHECK: setzul	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4c,0xc0]
+         setzunge	al
+# CHECK: setzuge	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4d,0xc0]
+         setzunl	al
+# CHECK: setzule	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4e,0xc0]
+         setzung	al
+# CHECK: setzug	al
+# CHECK: encoding: [0x62,0xf4,0x7f,0x18,0x4f,0xc0]
+         setzunle	al
\ No newline at end of file
diff --git a/llvm/test/MC/X86/cmpccxadd-att-alias.s b/llvm/test/MC/X86/cmpccxadd-att-alias.s
index e4d8fff0a38962..dcc0f105d7abc1 100644
--- a/llvm/test/MC/X86/cmpccxadd-att-alias.s
+++ b/llvm/test/MC/X86/cmpccxadd-att-alias.s
@@ -24,3 +24,35 @@
 // CHECK: encoding: [0xc4,0xe2,0x79,0xef,0x0d,0x00,0x00,0x00,0x00]
           cmpgxadd  %eax, %ecx, (%rip)
 
+// CHECK: cmpbxadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe2,0x0d,0x00,0x00,0x00,0x00]
+          cmpcxadd  %eax, %ecx, (%rip)
+
+// CHECK: cmpbxadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe2,0x0d,0x00,0x00,0x00,0x00]
+          cmpnaexadd  %eax, %ecx, (%rip)
+
+// CHECK: cmpnbxadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe3,0x0d,0x00,0x00,0x00,0x00]
+          cmpncxadd  %eax, %ecx, (%rip)
+
+// CHECK: cmpbexadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe6,0x0d,0x00,0x00,0x00,0x00]
+          cmpnaxadd  %eax, %ecx, (%rip)
+
+// CHECK: cmplexadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xee,0x0d,0x00,0x00,0x00,0x00]
+          cmpngxadd  %eax, %ecx, (%rip)
+
+// CHECK: cmppxadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xea,0x0d,0x00,0x00,0x00,0x00]
+          cmppexadd  %eax, %ecx, (%rip)
+
+// CHECK: cmpnpxadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xeb,0x0d,0x00,0x00,0x00,0x00]
+          cmppoxadd  %eax, %ecx, (%rip)
+
+// CHECK: cmplxadd  %eax, %ecx, (%rip)
+// CHECK: encoding: [0xc4,0xe2,0x79,0xec,0x0d,0x00,0x00,0x00,0x00]
+          cmpngexadd  %eax, %ecx, (%rip)
+
diff --git a/llvm/test/MC/X86/cmpccxadd-intel-alias.s b/llvm/test/MC/X86/cmpccxadd-intel-alias.s
index 68a8736a3b688c..f5c7a6b6a2e0a5 100644
--- a/llvm/test/MC/X86/cmpccxadd-intel-alias.s
+++ b/llvm/test/MC/X86/cmpccxadd-intel-alias.s
@@ -23,3 +23,35 @@
 // CHECK: cmpnlexadd dword ptr [rip], ecx, eax
 // CHECK: encoding: [0xc4,0xe2,0x79,0xef,0x0d,0x00,0x00,0x00,0x00]
           cmpgxadd dword ptr [rip], ecx, eax
+
+// CHECK: cmpbxadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe2,0x0d,0x00,0x00,0x00,0x00]
+          cmpcxadd  dword ptr [rip], ecx, eax
+
+// CHECK: cmpbxadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe2,0x0d,0x00,0x00,0x00,0x00]
+          cmpnaexadd  dword ptr [rip], ecx, eax
+
+// CHECK: cmpnbxadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe3,0x0d,0x00,0x00,0x00,0x00]
+          cmpncxadd  dword ptr [rip], ecx, eax
+
+// CHECK: cmpbexadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xe6,0x0d,0x00,0x00,0x00,0x00]
+          cmpnaxadd  dword ptr [rip], ecx, eax
+
+// CHECK: cmplexadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xee,0x0d,0x00,0x00,0x00,0x00]
+          cmpngxadd  dword ptr [rip], ecx, eax
+
+// CHECK: cmppxadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xea,0x0d,0x00,0x00,0x00,0x00]
+          cmppexadd  dword ptr [rip], ecx, eax
+
+// CHECK: cmpnpxadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xeb,0x0d,0x00,0x00,0x00,0x00]
+          cmppoxadd  dword ptr [rip], ecx, eax
+
+// CHECK: cmplxadd  dword ptr [rip], ecx, eax
+// CHECK: encoding: [0xc4,0xe2,0x79,0xec,0x0d,0x00,0x00,0x00,0x00]
+          cmpngexadd  dword ptr [rip], ecx, eax

Copy link
Contributor

@KanRobert KanRobert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@FreddyLeaf FreddyLeaf merged commit 2c62d08 into llvm:main Aug 13, 2024
12 checks passed
@FreddyLeaf FreddyLeaf deleted the missing_alias branch August 13, 2024 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 mc Machine (object) code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants