-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[RISCV] Add an error that Xqccmp, Xqciac, and Xqcicm are not compatible with C+D or Zcd. #130816
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
Conversation
…+D or Zcd. I was reviewing encodings to put the disassembling of vendor instructions after after standard instructions and found that these overlap with c.fldsp and c.fsdsp.
|
@llvm/pr-subscribers-backend-risc-v Author: Craig Topper (topperc) ChangesI was reviewing encodings to put the disassembling of vendor instructions after after standard instructions and found that these overlap with c.fldsp and c.fsdsp. Full diff: https://github.com/llvm/llvm-project/pull/130816.diff 2 Files Affected:
diff --git a/llvm/lib/TargetParser/RISCVISAInfo.cpp b/llvm/lib/TargetParser/RISCVISAInfo.cpp
index dd74f79f04b92..4276e94ec9b3e 100644
--- a/llvm/lib/TargetParser/RISCVISAInfo.cpp
+++ b/llvm/lib/TargetParser/RISCVISAInfo.cpp
@@ -740,13 +740,16 @@ Error RISCVISAInfo::checkDependency() {
bool HasZfinx = Exts.count("zfinx") != 0;
bool HasVector = Exts.count("zve32x") != 0;
bool HasZvl = MinVLen != 0;
- bool HasZcmt = Exts.count("zcmt") != 0;
+ bool HasZcmp = Exts.count("zcmp") != 0;
+ bool HasXqccmp = Exts.count("xqccmp") != 0;
+
static constexpr StringLiteral XqciExts[] = {
{"xqcia"}, {"xqciac"}, {"xqcibm"}, {"xqcicli"},
{"xqcicm"}, {"xqcics"}, {"xqcicsr"}, {"xqciint"},
{"xqcilia"}, {"xqcilo"}, {"xqcilsm"}, {"xqcisls"}};
- bool HasZcmp = Exts.count("zcmp") != 0;
- bool HasXqccmp = Exts.count("xqccmp") != 0;
+ static constexpr StringLiteral ZcdOverlaps[] = {
+ {"zcmt"}, {"zcmp"}, {"xqciac"}, {"xqcicm"}
+ };
if (HasI && HasE)
return getIncompatibleError("i", "e");
@@ -757,11 +760,13 @@ Error RISCVISAInfo::checkDependency() {
if (HasZvl && !HasVector)
return getExtensionRequiresError("zvl*b", "v' or 'zve*");
- if ((HasZcmt || Exts.count("zcmp")) && HasD && (HasC || Exts.count("zcd")))
- return getError(Twine("'") + (HasZcmt ? "zcmt" : "zcmp") +
- "' extension is incompatible with '" +
- (HasC ? "c" : "zcd") +
- "' extension when 'd' extension is enabled");
+ if (HasD && (HasC || Exts.count("zcd")))
+ for (auto Ext : ZcdOverlaps)
+ if (Exts.count(Ext.str()))
+ return getError(Twine("'") + Ext +
+ "' extension is incompatible with '" +
+ (HasC ? "c" : "zcd") +
+ "' extension when 'd' extension is enabled");
if (XLen != 32 && Exts.count("zcf"))
return getError("'zcf' is only supported for 'rv32'");
diff --git a/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp b/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp
index e24b2d47f6bc4..c86108193fd9a 100644
--- a/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp
+++ b/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp
@@ -663,6 +663,30 @@ TEST(ParseArchString, RejectsConflictingExtensions) {
::testing::EndsWith(" is only supported for 'rv32'"));
}
+ for (StringRef Input : {"rv32idc_xqciac0p3"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'xqciac' extension is incompatible with 'c' extension when 'd' "
+ "extension is enabled");
+ }
+
+ for (StringRef Input : {"rv32i_zcd_xqciac0p3"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'xqciac' extension is incompatible with 'zcd' extension when 'd' "
+ "extension is enabled");
+ }
+
+ for (StringRef Input : {"rv32idc_xqcicm0p2"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'xqcicm' extension is incompatible with 'c' extension when 'd' "
+ "extension is enabled");
+ }
+
+ for (StringRef Input : {"rv32i_zcd_xqcicm0p2"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'xqcicm' extension is incompatible with 'zcd' extension when 'd' "
+ "extension is enabled");
+ }
+
for (StringRef Input : {"rv32i_zcmp_xqccmp0p1", "rv64i_zcmp_xqccmp0p1"}) {
EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
"'zcmp' and 'xqccmp' extensions are incompatible");
|
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
hchandel
left a comment
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! Thanks
I was reviewing encodings to put the disassembling of vendor instructions after after standard instructions and found that these overlap with c.fldsp and c.fsdsp.