[PATCH] D40985: [AArch64] Add Exynos to host detection
Evandro Menezes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 7 14:47:31 PST 2017
evandro updated this revision to Diff 126053.
evandro added a comment.
Thanks, @zturner.
https://reviews.llvm.org/D40985
Files:
llvm/lib/Support/Host.cpp
llvm/unittests/Support/Host.cpp
Index: llvm/unittests/Support/Host.cpp
===================================================================
--- llvm/unittests/Support/Host.cpp
+++ llvm/unittests/Support/Host.cpp
@@ -139,6 +139,35 @@
EXPECT_EQ(sys::detail::getHostCPUNameForARM(MSM8992ProcCpuInfo),
"cortex-a53");
+
+ // Exynos big.LITTLE weirdness
+ const std::string ExynosProcCpuInfo = R"(
+processor : 0
+Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
+CPU implementer : 0x41
+CPU architecture: 8
+CPU variant : 0x0
+CPU part : 0xd03
+
+processor : 1
+Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
+CPU implementer : 0x53
+CPU architecture: 8
+)";
+
+ EXPECT_EQ(sys::detail::getHostCPUNameForARM(ExynosProcCpuInfo +
+ "CPU variant : 0x1\n"
+ "CPU part : 0x001"),
+ "exynos-m1");
+ EXPECT_EQ(sys::detail::getHostCPUNameForARM(ExynosProcCpuInfo +
+ "CPU variant : 0x4\n"
+ "CPU part : 0x001"),
+ "exynos-m2");
+ // Verify default for Exynos.
+ EXPECT_EQ(sys::detail::getHostCPUNameForARM(ExynosProcCpuInfo +
+ "CPU variant : 0xc\n"
+ "CPU part : 0xafe"),
+ "exynos-m1");
}
#if defined(__APPLE__)
Index: llvm/lib/Support/Host.cpp
===================================================================
--- llvm/lib/Support/Host.cpp
+++ llvm/lib/Support/Host.cpp
@@ -216,6 +216,36 @@
.Case("0xc01", "saphira")
.Default("generic");
+ if (Implementer == "0x53") { // Samsung Electronics Co., Ltd.
+ // The Exynos chips have a convoluted ID scheme that doesn't seem to follow
+ // any predictive pattern across variants and parts.
+ unsigned Variant = 0, Part = 0;
+
+ // Look for the CPU variant line, whose value is a 1 digit hexadecimal
+ // number, corresponding to the Variant bits in the CP15/C0 register.
+ for (auto I : Lines)
+ if (I.consume_front("CPU variant"))
+ I.ltrim("\t :").getAsInteger(16, Variant);
+
+ // Look for the CPU part line, whose value is a 3 digit hexadecimal
+ // number, corresponding to the PartNum bits in the CP15/C0 register.
+ for (auto I : Lines)
+ if (I.consume_front("CPU part"))
+ I.ltrim("\t :").getAsInteger(16, Part);
+
+ unsigned Exynos = (Variant << 12) + Part;
+ switch (Exynos) {
+ default:
+ // Default to Exynos M1.
+
+ case 0x01001:
+ return "exynos-m1";
+
+ case 0x04001:
+ return "exynos-m2";
+ }
+ }
+
return "generic";
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40985.126053.patch
Type: text/x-patch
Size: 2771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171207/01951c8d/attachment.bin>
More information about the llvm-commits
mailing list