Skip to content

Commit

Permalink
[AArch64] Add native CPU detection for Microsoft Azure Cobalt 100. (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
labrinea committed Jan 16, 2024
1 parent 2b08de4 commit a690e86
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions llvm/lib/TargetParser/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,13 @@ StringRef sys::detail::getHostCPUNameForARM(StringRef ProcCpuinfoContent) {
}
}

if (Implementer == "0x6d") { // Microsoft Corporation.
// The Microsoft Azure Cobalt 100 CPU is handled as a Neoverse N2.
return StringSwitch<const char *>(Part)
.Case("0xd49", "neoverse-n2")
.Default("generic");
}

if (Implementer == "0xc0") { // Ampere Computing
return StringSwitch<const char *>(Part)
.Case("0xac3", "ampere1")
Expand Down
4 changes: 3 additions & 1 deletion llvm/unittests/TargetParser/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ TEST(getLinuxHostCPUName, AArch64) {
EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x51\n"
"CPU part : 0xc01"),
"saphira");

EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x6d\n"
"CPU part : 0xd49"),
"neoverse-n2");
EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0xc0\n"
"CPU part : 0xac3"),
"ampere1");
Expand Down

0 comments on commit a690e86

Please sign in to comment.