[clang] [llvm] [RISCV] Add ability to list extensions enabled for a target (PR #98207)

Michael Maitland via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 9 13:12:19 PDT 2024


================
@@ -1061,11 +1061,40 @@ For example, clang -march=rv32i_v1p0)";
 
   outs().flush();
   testing::internal::CaptureStdout();
-  riscvExtensionsHelp(DummyMap);
+  RISCVISAInfo::printSupportedExtensions(DummyMap);
   outs().flush();
 
   std::string CapturedOutput = testing::internal::GetCapturedStdout();
   EXPECT_TRUE([](std::string &Captured, std::string &Expected) {
                 return Captured.find(Expected) != std::string::npos;
               }(CapturedOutput, ExpectedOutput));
 }
+
+TEST(TargetParserTest, RISCVPrintEnabledExtensions) {
+  // clang-format off
+  std::string ExpectedOutput =
+R"(Extensions enabled for the given RISC-V target
+
+    Name                 Version   Description
+    i                    2.1       'I' (Base Integer Instruction Set)
+
+Experimental extensions
+    ztso                 0.1       'Ztso' (Memory Model - Total Store Order)
----------------
michaelmaitland wrote:

is there an extension you'd like me to use?

https://github.com/llvm/llvm-project/pull/98207


More information about the cfe-commits mailing list