summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorEvandro Menezes <e.menezes@samsung.com>2017-12-08 21:09:59 +0000
committerEvandro Menezes <e.menezes@samsung.com>2017-12-08 21:09:59 +0000
commit5d7a9e6e54f6ab7d290532f605be57e5b515e78a (patch)
treecb16521dda4d9e76b176dbd9ddbcf3944abc8529 /llvm/lib/Support
parentc40d9f2e5df4482eb036a6130e8f3ae30294f3b4 (diff)
downloadbcm5719-llvm-5d7a9e6e54f6ab7d290532f605be57e5b515e78a.tar.gz
bcm5719-llvm-5d7a9e6e54f6ab7d290532f605be57e5b515e78a.zip
[AArch64] Add Exynos to host detection
Differential revision: https://reviews.llvm.org/D40985 llvm-svn: 320195
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/Host.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp
index e307335f8bb..fac58ab365d 100644
--- a/llvm/lib/Support/Host.cpp
+++ b/llvm/lib/Support/Host.cpp
@@ -216,6 +216,37 @@ StringRef sys::detail::getHostCPUNameForARM(
.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(0, 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(0, Part);
+
+ unsigned Exynos = (Variant << 12) | Part;
+ switch (Exynos) {
+ default:
+ // Default by falling through to Exynos M1.
+ LLVM_FALLTHROUGH;
+
+ case 0x1001:
+ return "exynos-m1";
+
+ case 0x4001:
+ return "exynos-m2";
+ }
+ }
+
return "generic";
}
OpenPOWER on IntegriCloud