Skip to content

Commit a690e86

Browse files
authored
[AArch64] Add native CPU detection for Microsoft Azure Cobalt 100. (#77793)
This patch extends the -mcpu/mtune=native support to handle the Microsoft Azure Cobalt 100 CPU as a Neoverse N2. We expect users to use -mcpu=neoverse-n2 when targeting this CPU and all the architecture and codegen decisions to be identical. The only difference is that the Microsoft Azure Cobalt 100 has a different Implementer ID in the /proc/cpuinfo entry that needs to be detected in getHostCPUNameForARM appropriately.
1 parent 2b08de4 commit a690e86

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

llvm/lib/TargetParser/Host.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,13 @@ StringRef sys::detail::getHostCPUNameForARM(StringRef ProcCpuinfoContent) {
310310
}
311311
}
312312

313+
if (Implementer == "0x6d") { // Microsoft Corporation.
314+
// The Microsoft Azure Cobalt 100 CPU is handled as a Neoverse N2.
315+
return StringSwitch<const char *>(Part)
316+
.Case("0xd49", "neoverse-n2")
317+
.Default("generic");
318+
}
319+
313320
if (Implementer == "0xc0") { // Ampere Computing
314321
return StringSwitch<const char *>(Part)
315322
.Case("0xac3", "ampere1")

llvm/unittests/TargetParser/Host.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ TEST(getLinuxHostCPUName, AArch64) {
113113
EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x51\n"
114114
"CPU part : 0xc01"),
115115
"saphira");
116-
116+
EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x6d\n"
117+
"CPU part : 0xd49"),
118+
"neoverse-n2");
117119
EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0xc0\n"
118120
"CPU part : 0xac3"),
119121
"ampere1");

0 commit comments

Comments
 (0)