Skip to content

Commit 7e02bc5

Browse files
ptomsichdavemgreen
authored andcommitted
[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
1 parent e6cb64a commit 7e02bc5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

llvm/lib/Support/Host.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,12 @@ StringRef sys::detail::getHostCPUNameForARM(StringRef ProcCpuinfoContent) {
296296
}
297297
}
298298

299+
if (Implementer == "0xc0") { // Ampere Computing
300+
return StringSwitch<const char *>(Part)
301+
.Case("0xac3", "ampere1")
302+
.Default("generic");
303+
}
304+
299305
return "generic";
300306
}
301307

llvm/unittests/Support/Host.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ TEST(getLinuxHostCPUName, AArch64) {
133133
"CPU part : 0xc01"),
134134
"saphira");
135135

136+
EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0xc0\n"
137+
"CPU part : 0xac3"),
138+
"ampere1");
139+
136140
// MSM8992/4 weirdness
137141
StringRef MSM8992ProcCpuInfo = R"(
138142
Processor : AArch64 Processor rev 3 (aarch64)

0 commit comments

Comments
 (0)