aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/TargetParser/TargetParserTest.cpp
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2023-09-13 10:10:57 +0100
committerGitHub <noreply@github.com>2023-09-13 10:10:57 +0100
commit99594ba30aaba7ad7c0850923bac474e4676af8e (patch)
tree0a50c487b5d28c318c4cc21990d5a511b1c3a6ff /llvm/unittests/TargetParser/TargetParserTest.cpp
parent11de4c724c8e875f75c2d1c733c38051bc818601 (diff)
downloadllvm-99594ba30aaba7ad7c0850923bac474e4676af8e.zip
llvm-99594ba30aaba7ad7c0850923bac474e4676af8e.tar.gz
llvm-99594ba30aaba7ad7c0850923bac474e4676af8e.tar.bz2
[clang][ARM] Enable --print-supported-extensions for ARM (#66083)
``` $ ./bin/clang --target=arm-linux-gnueabihf --print-supported-extensions <...> All available -march extensions for ARM crc crypto sha2 aes dotprod <...> ``` This follows the format set by RISC-V and AArch64. As for AArch64, ARM doesn't have versioned extensions like RISC-V does. So there is only 1 column, which contains the name. Any extension without a "feature" is hidden as these cannot be used with -march.
Diffstat (limited to 'llvm/unittests/TargetParser/TargetParserTest.cpp')
-rw-r--r--llvm/unittests/TargetParser/TargetParserTest.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/unittests/TargetParser/TargetParserTest.cpp b/llvm/unittests/TargetParser/TargetParserTest.cpp
index d551eb9..8223f9f 100644
--- a/llvm/unittests/TargetParser/TargetParserTest.cpp
+++ b/llvm/unittests/TargetParser/TargetParserTest.cpp
@@ -1010,6 +1010,29 @@ TEST(TargetParserTest, getARMCPUForArch) {
}
}
+TEST(TargetParserTest, ARMPrintSupportedExtensions) {
+ std::string expected = "All available -march extensions for ARM\n\n"
+ "\tcrc\n\tcrypto\n\tsha2";
+
+ outs().flush();
+ testing::internal::CaptureStdout();
+ ARM::PrintSupportedExtensions();
+ outs().flush();
+ std::string captured = testing::internal::GetCapturedStdout();
+
+ // Check that the start of the output is as expected.
+ EXPECT_EQ(0ULL, captured.find(expected));
+
+ // Should not include "none" or "invalid".
+ EXPECT_EQ(std::string::npos, captured.find("none"));
+ EXPECT_EQ(std::string::npos, captured.find("invalid"));
+ // Should not include anything that lacks a feature name. Checking a few here
+ // but not all as if one is hidden correctly the rest should be.
+ EXPECT_EQ(std::string::npos, captured.find("simd"));
+ EXPECT_EQ(std::string::npos, captured.find("maverick"));
+ EXPECT_EQ(std::string::npos, captured.find("xscale"));
+}
+
class AArch64CPUTestFixture
: public ::testing::TestWithParam<
ARMCPUTestParams<AArch64::ExtensionBitset>> {};