[llvm] b92102a - [AArch64] Add native CPU detection for Neoverse-V1.

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 13 04:59:40 PST 2022


Author: Sander de Smalen
Date: 2022-01-13T12:58:54Z
New Revision: b92102a6d79f401c1cc8bf7cd0d56e4a6cf90115

URL: https://github.com/llvm/llvm-project/commit/b92102a6d79f401c1cc8bf7cd0d56e4a6cf90115
DIFF: https://github.com/llvm/llvm-project/commit/b92102a6d79f401c1cc8bf7cd0d56e4a6cf90115.diff

LOG: [AArch64] Add native CPU detection for Neoverse-V1.

Map Main ID part number 0xd40 to neoverse-v1, as described in the
Neoverse-V1 Technical Reference Manual:

https://developer.arm.com/documentation/101427/0101/Register-descriptions/AArch64-system-registers/MIDR-EL1--Main-ID-Register--EL1

Differential Revision: https://reviews.llvm.org/D117207

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 66d21a6ec859..9a4470289bcf 100644
--- a/llvm/lib/Support/Host.cpp
+++ b/llvm/lib/Support/Host.cpp
@@ -213,6 +213,7 @@ StringRef sys::detail::getHostCPUNameForARM(StringRef ProcCpuinfoContent) {
         .Case("0xd44", "cortex-x1")
         .Case("0xd0c", "neoverse-n1")
         .Case("0xd49", "neoverse-n2")
+        .Case("0xd40", "neoverse-v1")
         .Default("generic");
   }
 

diff  --git a/llvm/unittests/Support/Host.cpp b/llvm/unittests/Support/Host.cpp
index 98e83a3ecd77..f5434b138abc 100644
--- a/llvm/unittests/Support/Host.cpp
+++ b/llvm/unittests/Support/Host.cpp
@@ -102,6 +102,9 @@ TEST(getLinuxHostCPUName, AArch64) {
                                               "CPU part        : 0xd03"),
             "cortex-a53");
 
+  EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x41\n"
+                                              "CPU part        : 0xd40"),
+            "neoverse-v1");
   EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x41\n"
                                               "CPU part        : 0xd0c"),
             "neoverse-n1");


        


More information about the llvm-commits mailing list