Skip to content

Commit

Permalink
[X86][MC] Support case insenstive for dfv,sf,cf,of,zf for CCMP/CTEST (
Browse files Browse the repository at this point in the history
  • Loading branch information
FreddyLeaf authored Jun 19, 2024
1 parent 0c02811 commit 728fb23
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2318,7 +2318,7 @@ bool X86AsmParser::parseCFlagsOp(OperandVector &Operands) {
return Error(Tok.getLoc(), "Expected { at this point");
Parser.Lex(); // Eat "{"
Tok = Parser.getTok();
if (Tok.getIdentifier() != "dfv")
if (Tok.getIdentifier().lower() != "dfv")
return Error(Tok.getLoc(), "Expected dfv at this point");
Parser.Lex(); // Eat "dfv"
Tok = Parser.getTok();
Expand All @@ -2338,7 +2338,7 @@ bool X86AsmParser::parseCFlagsOp(OperandVector &Operands) {
unsigned CFlags = 0;
for (unsigned I = 0; I < 4; ++I) {
Tok = Parser.getTok();
unsigned CFlag = StringSwitch<unsigned>(Tok.getIdentifier())
unsigned CFlag = StringSwitch<unsigned>(Tok.getIdentifier().lower())
.Case("of", 0x8)
.Case("sf", 0x4)
.Case("zf", 0x2)
Expand Down
8 changes: 7 additions & 1 deletion llvm/test/MC/X86/apx/ccmp-att.s
Original file line number Diff line number Diff line change
@@ -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-401: error:
# ERROR-COUNT-402: error:
# ERROR-NOT: error:
## Condition flags

Expand Down Expand Up @@ -1211,3 +1211,9 @@
# CHECK: ccmpeq {dfv=of} %r9, %r15
# CHECK: encoding: [0x62,0x54,0xc4,0x04,0x39,0xcf]
ccmpeq {dfv=of} %r9, %r15

## Case sensitive

# 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
6 changes: 6 additions & 0 deletions llvm/test/MC/X86/apx/ccmp-intel.s
Original file line number Diff line number Diff line change
Expand Up @@ -1208,3 +1208,9 @@
# CHECK: ccmpe {dfv=of} r15, r9
# CHECK: encoding: [0x62,0x54,0xc4,0x04,0x39,0xcf]
ccmpe {dfv=of} r15, r9

## Case sensitive

# 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

0 comments on commit 728fb23

Please sign in to comment.