diff options
author | Yi Kong <yikong@google.com> | 2017-04-04 19:06:04 +0000 |
---|---|---|
committer | Yi Kong <yikong@google.com> | 2017-04-04 19:06:04 +0000 |
commit | 57019dc9b23e26ebe41fa48f6fa3557d3022f2b6 (patch) | |
tree | 3ac2ece1987f8738a8ea15ef6b9aef62e99bf152 /llvm/unittests | |
parent | 3333968771e5c58a8cdd7ab9ef3c2e1090c8c6b5 (diff) | |
download | bcm5719-llvm-57019dc9b23e26ebe41fa48f6fa3557d3022f2b6.tar.gz bcm5719-llvm-57019dc9b23e26ebe41fa48f6fa3557d3022f2b6.zip |
Implement host CPU detection for AArch64
This shares detection logic with ARM(32), since AArch64 capable CPUs may
also run in 32-bit system mode.
We observe weird /proc/cpuinfo output for MSM8992 and MSM8994, where
they report all CPU cores as one single model, depending on which CPU
core the kernel is running on. As a workaround, we hardcode the known
CPU part name for these SoCs.
For big.LITTLE systems, this patch would only return the part name of
the first core (usually the little core). Proper support will be added
in a follow-up change.
Differential Revision: D31675
llvm-svn: 299458
Diffstat (limited to 'llvm/unittests')
-rw-r--r-- | llvm/unittests/Support/Host.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/unittests/Support/Host.cpp b/llvm/unittests/Support/Host.cpp index 48f021e5427..fd53697793c 100644 --- a/llvm/unittests/Support/Host.cpp +++ b/llvm/unittests/Support/Host.cpp @@ -79,3 +79,38 @@ Serial : 0000000000000000 "CPU part : 0x06f"), "krait"); } + +TEST(getLinuxHostCPUName, AArch64) { + EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x41\n" + "CPU part : 0xd03"), + "cortex-a53"); + // Verify that both CPU implementer and CPU part are checked: + EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x40\n" + "CPU part : 0xd03"), + "generic"); + EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x51\n" + "CPU part : 0x201"), + "kryo"); + + // MSM8992/4 weirdness + StringRef MSM8992ProcCpuInfo = R"( +Processor : AArch64 Processor rev 3 (aarch64) +processor : 0 +processor : 1 +processor : 2 +processor : 3 +processor : 4 +processor : 5 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 +CPU implementer : 0x41 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0xd03 +CPU revision : 3 + +Hardware : Qualcomm Technologies, Inc MSM8992 +)"; + + EXPECT_EQ(sys::detail::getHostCPUNameForARM(MSM8992ProcCpuInfo), + "cortex-a53"); +} |