aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-10-31 12:14:17 +0000
committerRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-10-31 12:14:17 +0000
commit793ce99ea79b2a51a9ace18adcae60678efaae9e (patch)
tree9db9d8bfdd4739b5beffb57093e91d28dfe7825f /lib/Target
parentc2884320feebc543d2ce51151d5418dfc18da9e4 (diff)
downloadexternal_llvm-793ce99ea79b2a51a9ace18adcae60678efaae9e.zip
external_llvm-793ce99ea79b2a51a9ace18adcae60678efaae9e.tar.gz
external_llvm-793ce99ea79b2a51a9ace18adcae60678efaae9e.tar.bz2
[SystemZ] Automatically detect zEC12 and z196 hosts
As on other hosts, the CPU identification instruction is priveleged, so we need to look through /proc/cpuinfo. I copied the PowerPC way of handling "generic". Several tests were implicitly assuming z10 and so failed on z196. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193742 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/SystemZ/SystemZProcessors.td5
-rw-r--r--lib/Target/SystemZ/SystemZSubtarget.cpp7
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/Target/SystemZ/SystemZProcessors.td b/lib/Target/SystemZ/SystemZProcessors.td
index 00d4338..f241fb0 100644
--- a/lib/Target/SystemZ/SystemZProcessors.td
+++ b/lib/Target/SystemZ/SystemZProcessors.td
@@ -36,8 +36,9 @@ def FeatureFPExtension : SystemZFeature<
"Assume that the floating-point extension facility is installed"
>;
-def : Processor<"z10", NoItineraries, []>;
-def : Processor<"z196", NoItineraries,
+def : Processor<"generic", NoItineraries, []>;
+def : Processor<"z10", NoItineraries, []>;
+def : Processor<"z196", NoItineraries,
[FeatureDistinctOps, FeatureLoadStoreOnCond, FeatureHighWord,
FeatureFPExtension]>;
def : Processor<"zEC12", NoItineraries,
diff --git a/lib/Target/SystemZ/SystemZSubtarget.cpp b/lib/Target/SystemZ/SystemZSubtarget.cpp
index b6a6392..4741920 100644
--- a/lib/Target/SystemZ/SystemZSubtarget.cpp
+++ b/lib/Target/SystemZ/SystemZSubtarget.cpp
@@ -9,6 +9,7 @@
#include "SystemZSubtarget.h"
#include "llvm/IR/GlobalValue.h"
+#include "llvm/Support/Host.h"
#include "MCTargetDesc/SystemZMCTargetDesc.h"
#define GET_SUBTARGETINFO_TARGET_DESC
@@ -25,7 +26,11 @@ SystemZSubtarget::SystemZSubtarget(const std::string &TT,
TargetTriple(TT) {
std::string CPUName = CPU;
if (CPUName.empty())
- CPUName = "z10";
+ CPUName = "generic";
+#if defined(__linux__) && defined(__s390x__)
+ if (CPUName == "generic")
+ CPUName = sys::getHostCPUName();
+#endif
// Parse features string.
ParseSubtargetFeatures(CPUName, FS);