[llvm] 7e02bc5 - [AArch64] Add native CPU detection for Ampere1
David Green via llvm-commits
llvm-commits at lists.llvm.org
Tue May 3 08:10:09 PDT 2022
Author: Philipp Tomsich
Date: 2022-05-03T16:10:02+01:00
New Revision: 7e02bc5237751118efe36c41b0caf004aeed022f
URL: https://github.com/llvm/llvm-project/commit/7e02bc5237751118efe36c41b0caf004aeed022f
DIFF: https://github.com/llvm/llvm-project/commit/7e02bc5237751118efe36c41b0caf004aeed022f.diff
LOG: [AArch64] Add native CPU detection for Ampere1
Map the IMPLEMENTOR ID 0xc0 (Ampere Computing) and CPU ID 0xac3
(Ampere1) to ampere1.
Differential Revision: https://reviews.llvm.org/D117111
Added:
Modified:
llvm/lib/Support/Host.cpp
llvm/unittests/Support/Host.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp
index 98272bb59ee27..976599f199f0f 100644
--- a/llvm/lib/Support/Host.cpp
+++ b/llvm/lib/Support/Host.cpp
@@ -296,6 +296,12 @@ StringRef sys::detail::getHostCPUNameForARM(StringRef ProcCpuinfoContent) {
}
}
+ if (Implementer == "0xc0") { // Ampere Computing
+ return StringSwitch<const char *>(Part)
+ .Case("0xac3", "ampere1")
+ .Default("generic");
+ }
+
return "generic";
}
diff --git a/llvm/unittests/Support/Host.cpp b/llvm/unittests/Support/Host.cpp
index 484c88bddb129..590d2d73b791b 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)
More information about the llvm-commits
mailing list