[PATCH] D145954: [RISCV] Reject 'g' with explicit version in parseArchString
Alex Bradbury via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 14 05:47:20 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe9a03f360fa9: [RISCV] Reject 'g' with explicit version in parseArchString (authored by asb).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145954/new/
https://reviews.llvm.org/D145954
Files:
llvm/lib/Support/RISCVISAInfo.cpp
llvm/unittests/Support/RISCVISAInfoTest.cpp
Index: llvm/unittests/Support/RISCVISAInfoTest.cpp
===================================================================
--- llvm/unittests/Support/RISCVISAInfoTest.cpp
+++ llvm/unittests/Support/RISCVISAInfoTest.cpp
@@ -397,14 +397,11 @@
"(this compiler supports 0.2)");
}
-TEST(ParseArchString, AcceptsExtensionVersionForG) {
- // FIXME: As there is no versioning scheme for G, arguably an error should
- // be produced.
- auto MaybeISAInfo = RISCVISAInfo::parseArchString("rv64g9p9", true, false);
- ASSERT_THAT_EXPECTED(MaybeISAInfo, Succeeded());
- RISCVISAInfo::OrderedExtensionMap Exts = (*MaybeISAInfo)->getExtensions();
- EXPECT_EQ(Exts.size(), 5UL);
- EXPECT_TRUE(Exts.at("i") == (RISCVExtensionInfo{"i", 2, 0}));
+TEST(ParseArchString, RejectsExtensionVersionForG) {
+ for (StringRef Input : {"rv32g1c", "rv64g2p0"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "version not supported for 'g'");
+ }
}
TEST(ParseArchString, AddsImpliedExtensions) {
Index: llvm/lib/Support/RISCVISAInfo.cpp
===================================================================
--- llvm/lib/Support/RISCVISAInfo.cpp
+++ llvm/lib/Support/RISCVISAInfo.cpp
@@ -622,6 +622,9 @@
break;
case 'g':
// g = imafd
+ if (Arch.size() > 5 && isdigit(Arch[5]))
+ return createStringError(errc::invalid_argument,
+ "version not supported for 'g'");
StdExts = StdExts.drop_front(4);
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145954.505056.patch
Type: text/x-patch
Size: 1505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230314/3c27bfce/attachment.bin>
More information about the llvm-commits
mailing list