aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2013-06-11 21:45:01 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2013-06-11 21:45:01 +0000
commita85644459ce0d63c92eaf2b6b35440b37c2b5364 (patch)
treee52f0862b0ce4721c980d74a476d4efd283420d0
parent1a4f2a33fbd94c840d620ff572dd25540c650f70 (diff)
downloadexternal_llvm-a85644459ce0d63c92eaf2b6b35440b37c2b5364.zip
external_llvm-a85644459ce0d63c92eaf2b6b35440b37c2b5364.tar.gz
external_llvm-a85644459ce0d63c92eaf2b6b35440b37c2b5364.tar.bz2
Make host ARM CPU feature detection independent of the vendor
For ARM on linux we use /proc/cpuinfo to detect the host CPU's features. Linux derives these values without ever looking at the vendor of the specific CPU implementation. Hence, it adds little value, if we parse the output of /proc/cpuinfo only for certain vendors. This patch enables us to derive the correct feature flags e.g. for Qualcomm CPUs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183790 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Support/Host.cpp50
1 files changed, 20 insertions, 30 deletions
diff --git a/lib/Support/Host.cpp b/lib/Support/Host.cpp
index a7c7a95..20942a5 100644
--- a/lib/Support/Host.cpp
+++ b/lib/Support/Host.cpp
@@ -570,41 +570,31 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features) {
SmallVector<StringRef, 32> Lines;
Str.split(Lines, "\n");
- // Look for the CPU implementer line.
- StringRef Implementer;
- for (unsigned I = 0, E = Lines.size(); I != E; ++I)
- if (Lines[I].startswith("CPU implementer"))
- Implementer = Lines[I].substr(15).ltrim("\t :");
-
- if (Implementer == "0x41") { // ARM Ltd.
- SmallVector<StringRef, 32> CPUFeatures;
+ SmallVector<StringRef, 32> CPUFeatures;
- // Look for the CPU features.
- for (unsigned I = 0, E = Lines.size(); I != E; ++I)
- if (Lines[I].startswith("Features")) {
- Lines[I].split(CPUFeatures, " ");
- break;
- }
-
- for (unsigned I = 0, E = CPUFeatures.size(); I != E; ++I) {
- StringRef LLVMFeatureStr = StringSwitch<StringRef>(CPUFeatures[I])
- .Case("half", "fp16")
- .Case("neon", "neon")
- .Case("vfpv3", "vfp3")
- .Case("vfpv3d16", "d16")
- .Case("vfpv4", "vfp4")
- .Case("idiva", "hwdiv-arm")
- .Case("idivt", "hwdiv")
- .Default("");
-
- if (LLVMFeatureStr != "")
- Features.GetOrCreateValue(LLVMFeatureStr).setValue(true);
+ // Look for the CPU features.
+ for (unsigned I = 0, E = Lines.size(); I != E; ++I)
+ if (Lines[I].startswith("Features")) {
+ Lines[I].split(CPUFeatures, " ");
+ break;
}
- return true;
+ for (unsigned I = 0, E = CPUFeatures.size(); I != E; ++I) {
+ StringRef LLVMFeatureStr = StringSwitch<StringRef>(CPUFeatures[I])
+ .Case("half", "fp16")
+ .Case("neon", "neon")
+ .Case("vfpv3", "vfp3")
+ .Case("vfpv3d16", "d16")
+ .Case("vfpv4", "vfp4")
+ .Case("idiva", "hwdiv-arm")
+ .Case("idivt", "hwdiv")
+ .Default("");
+
+ if (LLVMFeatureStr != "")
+ Features.GetOrCreateValue(LLVMFeatureStr).setValue(true);
}
- return false;
+ return true;
}
#else
bool sys::getHostCPUFeatures(StringMap<bool> &Features){