[llvm] [X86][MC] Support case insenstive for `dfv, sf, cf, of, zf`. (PR #95910)
Freddy Ye via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 18 19:43:51 PDT 2024
https://github.com/FreddyLeaf updated https://github.com/llvm/llvm-project/pull/95910
>From 2d153308ec5cb840ba8c3607e529e97d3abb7de3 Mon Sep 17 00:00:00 2001
From: Freddy Ye <freddy.ye at intel.com>
Date: Tue, 18 Jun 2024 20:08:16 +0800
Subject: [PATCH 1/2] [X86][MC] Support case insenstive for `dfv,sf,cf,of,zf`.
---
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp | 4 ++--
llvm/test/MC/X86/apx/ccmp-att.s | 8 +++++++-
llvm/test/MC/X86/apx/ccmp-intel.s | 6 ++++++
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index c0f54b223877c..dbea42d55b5fc 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -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();
@@ -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)
diff --git a/llvm/test/MC/X86/apx/ccmp-att.s b/llvm/test/MC/X86/apx/ccmp-att.s
index 0b78562f32e18..faf84f206a329 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-401: error:
+# ERROR-COUNT-402: error:
# ERROR-NOT: error:
## Condition flags
@@ -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
diff --git a/llvm/test/MC/X86/apx/ccmp-intel.s b/llvm/test/MC/X86/apx/ccmp-intel.s
index 095f7fb71b7c8..42155efeff401 100644
--- a/llvm/test/MC/X86/apx/ccmp-intel.s
+++ b/llvm/test/MC/X86/apx/ccmp-intel.s
@@ -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
>From a46ebb7970fa03524cfa065dae6d5b1f34c59946 Mon Sep 17 00:00:00 2001
From: Freddy Ye <freddy.ye at intel.com>
Date: Wed, 19 Jun 2024 10:43:31 +0800
Subject: [PATCH 2/2] address comments.
---
llvm/test/MC/X86/apx/ccmp-att.s | 2 +-
llvm/test/MC/X86/apx/ccmp-intel.s | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/test/MC/X86/apx/ccmp-att.s b/llvm/test/MC/X86/apx/ccmp-att.s
index faf84f206a329..405071b0f4310 100644
--- a/llvm/test/MC/X86/apx/ccmp-att.s
+++ b/llvm/test/MC/X86/apx/ccmp-att.s
@@ -1212,7 +1212,7 @@
# CHECK: encoding: [0x62,0x54,0xc4,0x04,0x39,0xcf]
ccmpeq {dfv=of} %r9, %r15
-## Case Sensitive
+## Case sensitive
# CHECK: ccmpoq {dfv=of,sf,zf,cf} %rax, %rbx
# CHECK: encoding: [0x62,0xf4,0xfc,0x00,0x39,0xc3]
diff --git a/llvm/test/MC/X86/apx/ccmp-intel.s b/llvm/test/MC/X86/apx/ccmp-intel.s
index 42155efeff401..2d446b053d94e 100644
--- a/llvm/test/MC/X86/apx/ccmp-intel.s
+++ b/llvm/test/MC/X86/apx/ccmp-intel.s
@@ -1209,7 +1209,7 @@
# CHECK: encoding: [0x62,0x54,0xc4,0x04,0x39,0xcf]
ccmpe {dfv=of} r15, r9
-## Case Sensitive
+## Case sensitive
# CHECK: ccmpo {dfv=of,sf,zf,cf} rbx, rax
# CHECK: encoding: [0x62,0xf4,0xfc,0x00,0x39,0xc3]
More information about the llvm-commits
mailing list