-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[X86][MC] Error out for CMPCCXADD on 32 bit targets. #88672
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This resolves issue llvm#88501.
Closed
Add test |
@llvm/pr-subscribers-mc @llvm/pr-subscribers-backend-x86 Author: Freddy Ye (FreddyLeaf) ChangesThis resolves issue #88501. Full diff: https://github.com/llvm/llvm-project/pull/88672.diff 6 Files Affected:
diff --git a/llvm/lib/Target/X86/X86InstrAsmAlias.td b/llvm/lib/Target/X86/X86InstrAsmAlias.td
index d06a0c79b46bbb..fbe95794a209f6 100644
--- a/llvm/lib/Target/X86/X86InstrAsmAlias.td
+++ b/llvm/lib/Target/X86/X86InstrAsmAlias.td
@@ -51,15 +51,17 @@ def : InstAlias<"invlpgb\t{%rax, %edx|rax, edx}", (INVLPGB64)>, Requires<[In64Bi
// CMPCCXADD Instructions Alias
multiclass CMPCCXADD_Aliases<string Cond, int CC> {
- def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
- (CMPCCXADDmr32 GR32:$dst, i32mem:$dstsrc2, GR32:$src3, CC), 0>;
- def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
- (CMPCCXADDmr64 GR64:$dst, i64mem:$dstsrc2, GR64:$src3, CC), 0>;
-
- def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
- (CMPCCXADDmr32_EVEX GR32:$dst, i32mem:$dstsrc2, GR32:$src3, CC), 0>;
- def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
- (CMPCCXADDmr64_EVEX GR64:$dst, i64mem:$dstsrc2, GR64:$src3, CC), 0>;
+ let Predicates = [In64BitMode] in {
+ def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
+ (CMPCCXADDmr32 GR32:$dst, i32mem:$dstsrc2, GR32:$src3, CC), 0>;
+ def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
+ (CMPCCXADDmr64 GR64:$dst, i64mem:$dstsrc2, GR64:$src3, CC), 0>;
+
+ def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
+ (CMPCCXADDmr32_EVEX GR32:$dst, i32mem:$dstsrc2, GR32:$src3, CC), 0>;
+ def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
+ (CMPCCXADDmr64_EVEX GR64:$dst, i64mem:$dstsrc2, GR64:$src3, CC), 0>;
+ }
}
// CCMP Instructions Alias
diff --git a/llvm/test/MC/X86/apx/cmpccxadd-att.s b/llvm/test/MC/X86/apx/cmpccxadd-att.s
index 0a21abbd0ed250..d6ade869ca1d26 100644
--- a/llvm/test/MC/X86/apx/cmpccxadd-att.s
+++ b/llvm/test/MC/X86/apx/cmpccxadd-att.s
@@ -3,9 +3,9 @@
# ERROR-COUNT-60: error:
# ERROR-NOT: error:
-# CHECK: {evex} cmpnbexadd %ecx, %edx, 123(%rax,%rbx,4)
-# CHECK: encoding: [0x62,0xf2,0x75,0x08,0xe7,0x54,0x98,0x7b]
- {evex} cmpnbexadd %ecx, %edx, 123(%rax,%rbx,4)
+# CHECK: {evex} cmpnbexadd %ecx, %edx, 123(%eax,%ebx,4)
+# CHECK: encoding: [0x67,0x62,0xf2,0x75,0x08,0xe7,0x54,0x98,0x7b]
+ {evex} cmpnbexadd %ecx, %edx, 123(%eax,%ebx,4)
# CHECK: {evex} cmpnbexadd %r9, %r15, 123(%rax,%rbx,4)
# CHECK: encoding: [0x62,0x72,0xb5,0x08,0xe7,0x7c,0x98,0x7b]
diff --git a/llvm/test/MC/X86/cmpccxadd-att-64-alias.s b/llvm/test/MC/X86/cmpccxadd-att-alias.s
similarity index 100%
rename from llvm/test/MC/X86/cmpccxadd-att-64-alias.s
rename to llvm/test/MC/X86/cmpccxadd-att-alias.s
diff --git a/llvm/test/MC/X86/cmpccxadd-att-64.s b/llvm/test/MC/X86/cmpccxadd-att.s
similarity index 99%
rename from llvm/test/MC/X86/cmpccxadd-att-64.s
rename to llvm/test/MC/X86/cmpccxadd-att.s
index 2ef49cba92e32c..c79cc55a15b81d 100644
--- a/llvm/test/MC/X86/cmpccxadd-att-64.s
+++ b/llvm/test/MC/X86/cmpccxadd-att.s
@@ -1,4 +1,8 @@
// 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-193: error:
+// ERROR-NOT: error:
// CHECK: cmpbexadd %eax, %ecx, 268435456(%rbp,%r14,8)
// CHECK: encoding: [0xc4,0xa2,0x79,0xe6,0x8c,0xf5,0x00,0x00,0x00,0x10]
@@ -20,9 +24,9 @@
// CHECK: encoding: [0xc4,0xe2,0x79,0xe6,0x89,0xfc,0x01,0x00,0x00]
cmpbexadd %eax, %ecx, 508(%rcx)
-// CHECK: cmpbexadd %eax, %ecx, -512(%rdx)
-// CHECK: encoding: [0xc4,0xe2,0x79,0xe6,0x8a,0x00,0xfe,0xff,0xff]
- cmpbexadd %eax, %ecx, -512(%rdx)
+// CHECK: cmpbexadd %eax, %ecx, -512(%edx)
+// CHECK: encoding: [0x67,0xc4,0xe2,0x79,0xe6,0x8a,0x00,0xfe,0xff,0xff]
+ cmpbexadd %eax, %ecx, -512(%edx)
// CHECK: cmpbexadd %r10, %r9, 268435456(%rbp,%r14,8)
// CHECK: encoding: [0xc4,0x22,0xa9,0xe6,0x8c,0xf5,0x00,0x00,0x00,0x10]
diff --git a/llvm/test/MC/X86/cmpccxadd-intel-64-alias.s b/llvm/test/MC/X86/cmpccxadd-intel-alias.s
similarity index 100%
rename from llvm/test/MC/X86/cmpccxadd-intel-64-alias.s
rename to llvm/test/MC/X86/cmpccxadd-intel-alias.s
diff --git a/llvm/test/MC/X86/cmpccxadd-intel-64.s b/llvm/test/MC/X86/cmpccxadd-intel.s
similarity index 100%
rename from llvm/test/MC/X86/cmpccxadd-intel-64.s
rename to llvm/test/MC/X86/cmpccxadd-intel.s
|
KanRobert
approved these changes
Apr 19, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This was referenced Apr 22, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This resolves issue #88501.