aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/Support')
-rw-r--r--llvm/unittests/Support/CommandLineTest.cpp32
-rw-r--r--llvm/unittests/Support/Host.cpp4
-rw-r--r--llvm/unittests/Support/TargetParserTest.cpp10
3 files changed, 44 insertions, 2 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp
index dd02d92..ec9901a 100644
--- a/llvm/unittests/Support/CommandLineTest.cpp
+++ b/llvm/unittests/Support/CommandLineTest.cpp
@@ -237,12 +237,42 @@ TEST(CommandLineTest, TokenizeWindowsCommandLine2) {
}
TEST(CommandLineTest, TokenizeWindowsCommandLineQuotedLastArgument) {
+ // Whitespace at the end of the command line doesn't cause an empty last word
+ const char Input0[] = R"(a b c d )";
+ const char *const Output0[] = {"a", "b", "c", "d"};
+ testCommandLineTokenizer(cl::TokenizeWindowsCommandLine, Input0, Output0);
+
+ // But an explicit "" does
const char Input1[] = R"(a b c d "")";
const char *const Output1[] = {"a", "b", "c", "d", ""};
testCommandLineTokenizer(cl::TokenizeWindowsCommandLine, Input1, Output1);
+
+ // An unterminated quoted string is also emitted as an argument word, empty
+ // or not
const char Input2[] = R"(a b c d ")";
- const char *const Output2[] = {"a", "b", "c", "d"};
+ const char *const Output2[] = {"a", "b", "c", "d", ""};
testCommandLineTokenizer(cl::TokenizeWindowsCommandLine, Input2, Output2);
+ const char Input3[] = R"(a b c d "text)";
+ const char *const Output3[] = {"a", "b", "c", "d", "text"};
+ testCommandLineTokenizer(cl::TokenizeWindowsCommandLine, Input3, Output3);
+}
+
+TEST(CommandLineTest, TokenizeWindowsCommandLineExeName) {
+ const char Input1[] =
+ R"("C:\Program Files\Whatever\"clang.exe z.c -DY=\"x\")";
+ const char *const Output1[] = {"C:\\Program Files\\Whatever\\clang.exe",
+ "z.c", "-DY=\"x\""};
+ testCommandLineTokenizer(cl::TokenizeWindowsCommandLineFull, Input1, Output1);
+
+ const char Input2[] = "\"a\\\"b c\\\"d\n\"e\\\"f g\\\"h\n";
+ const char *const Output2[] = {"a\\b", "c\"d", nullptr,
+ "e\\f", "g\"h", nullptr};
+ testCommandLineTokenizer(cl::TokenizeWindowsCommandLineFull, Input2, Output2,
+ /*MarkEOLs=*/true);
+
+ const char Input3[] = R"(\\server\share\subdir\clang.exe)";
+ const char *const Output3[] = {"\\\\server\\share\\subdir\\clang.exe"};
+ testCommandLineTokenizer(cl::TokenizeWindowsCommandLineFull, Input3, Output3);
}
TEST(CommandLineTest, TokenizeAndMarkEOLs) {
diff --git a/llvm/unittests/Support/Host.cpp b/llvm/unittests/Support/Host.cpp
index 484c88b..590d2d7 100644
--- a/llvm/unittests/Support/Host.cpp
+++ b/llvm/unittests/Support/Host.cpp
@@ -133,6 +133,10 @@ TEST(getLinuxHostCPUName, AArch64) {
"CPU part : 0xc01"),
"saphira");
+ EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0xc0\n"
+ "CPU part : 0xac3"),
+ "ampere1");
+
// MSM8992/4 weirdness
StringRef MSM8992ProcCpuInfo = R"(
Processor : AArch64 Processor rev 3 (aarch64)
diff --git a/llvm/unittests/Support/TargetParserTest.cpp b/llvm/unittests/Support/TargetParserTest.cpp
index 186fe57..e9d6a3f 100644
--- a/llvm/unittests/Support/TargetParserTest.cpp
+++ b/llvm/unittests/Support/TargetParserTest.cpp
@@ -1195,6 +1195,14 @@ INSTANTIATE_TEST_SUITE_P(
AArch64::AEK_SVE2 | AArch64::AEK_SVE2BITPERM |
AArch64::AEK_BF16 | AArch64::AEK_I8MM,
"8.5-A"),
+ ARMCPUTestParams("ampere1", "armv8.6-a", "crypto-neon-fp-armv8",
+ AArch64::AEK_CRC | AArch64::AEK_FP | AArch64::AEK_FP16 |
+ AArch64::AEK_SIMD | AArch64::AEK_RAS | AArch64::AEK_LSE |
+ AArch64::AEK_RDM | AArch64::AEK_RCPC | AArch64::AEK_DOTPROD |
+ AArch64::AEK_SM4 | AArch64::AEK_SHA3 | AArch64::AEK_BF16 |
+ AArch64::AEK_SHA2 | AArch64::AEK_AES | AArch64::AEK_I8MM |
+ AArch64::AEK_MTE | AArch64::AEK_SSBS | AArch64::AEK_SB,
+ "8.6-A"),
ARMCPUTestParams(
"neoverse-512tvb", "armv8.4-a", "crypto-neon-fp-armv8",
AArch64::AEK_RAS | AArch64::AEK_SVE | AArch64::AEK_SSBS |
@@ -1256,7 +1264,7 @@ INSTANTIATE_TEST_SUITE_P(
AArch64::AEK_LSE | AArch64::AEK_RDM,
"8.2-A")));
-static constexpr unsigned NumAArch64CPUArchs = 53;
+static constexpr unsigned NumAArch64CPUArchs = 54;
TEST(TargetParserTest, testAArch64CPUArchList) {
SmallVector<StringRef, NumAArch64CPUArchs> List;