[llvm] f802c39 - [RISCV] Add more tests for RISCVISAInfo::checkDependency(). NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 00:07:07 PDT 2024
Author: Craig Topper
Date: 2024-08-18T23:59:25-07:00
New Revision: f802c39cea29d587ba4db6f71352e3f11a994a89
URL: https://github.com/llvm/llvm-project/commit/f802c39cea29d587ba4db6f71352e3f11a994a89
DIFF: https://github.com/llvm/llvm-project/commit/f802c39cea29d587ba4db6f71352e3f11a994a89.diff
LOG: [RISCV] Add more tests for RISCVISAInfo::checkDependency(). NFC
Added:
Modified:
llvm/unittests/TargetParser/RISCVISAInfoTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp b/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp
index 426dca50613511..4c5087b570fc93 100644
--- a/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp
+++ b/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp
@@ -620,6 +620,94 @@ TEST(ParseArchString, RejectsConflictingExtensions) {
EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
"'zcf' is only supported for 'rv32'");
}
+
+ for (StringRef Input : {"rv64i_xwchc"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'Xwchc' is only supported for 'rv32'");
+ }
+
+ for (StringRef Input : {"rv32id_xwchc"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'D' and 'Xwchc' extensions are incompatible");
+ }
+
+ for (StringRef Input : {"rv32i_zcb_xwchc"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'Xwchc' and 'Zcb' extensions are incompatible");
+ }
+}
+
+TEST(ParseArchString, MissingDepency) {
+ for (StringRef Input : {"rv32i_zvl32b", "rv64i_zvl128b"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'zvl*b' requires 'v' or 'zve*' extension to also be specified");
+ }
+
+ for (StringRef Input : {"rv32i_zvbb"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'zvbb' requires 'v' or 'zve*' extension to also be specified");
+ }
+
+ for (StringRef Input : {"rv32i_zvbc32e0p7"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'zvbc32e' requires 'v' or 'zve*' extension to also be specified");
+ }
+
+ for (StringRef Input : {"rv32i_zvbc"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'zvbc' requires 'v' or 'zve64*' extension to also be specified");
+ }
+
+ for (StringRef Input : {"rv32i_zvkb"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'zvk*' requires 'v' or 'zve*' extension to also be specified");
+ }
+
+ for (StringRef Input : {"rv32i_zvkg"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'zvk*' requires 'v' or 'zve*' extension to also be specified");
+ }
+
+ for (StringRef Input : {"rv32i_zvkgs0p7"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'zvk*' requires 'v' or 'zve*' extension to also be specified");
+ }
+
+ for (StringRef Input : {"rv32i_zvkned"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'zvk*' requires 'v' or 'zve*' extension to also be specified");
+ }
+
+ for (StringRef Input : {"rv32i_zvknha"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'zvk*' requires 'v' or 'zve*' extension to also be specified");
+ }
+
+ for (StringRef Input : {"rv32i_zvksed"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'zvk*' requires 'v' or 'zve*' extension to also be specified");
+ }
+
+ for (StringRef Input : {"rv32i_zvksh"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'zvk*' requires 'v' or 'zve*' extension to also be specified");
+ }
+
+ for (StringRef Input : {"rv32i_zvknhb"}) {
+ EXPECT_EQ(
+ toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'zvknhb' requires 'v' or 'zve64*' extension to also be specified");
+ }
+
+ for (StringRef Input : {"rv32i_zacas1p0"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'zacas' requires 'a' or 'zaamo' extension to also be specified");
+ }
+
+ for (StringRef Input : {"rv32i_zabha"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "'zabha' requires 'a' or 'zaamo' extension to also be specified");
+ }
}
TEST(ParseArchString, RejectsUnrecognizedProfileNames) {
More information about the llvm-commits
mailing list