summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Targets.cpp
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2015-08-27 22:30:38 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2015-08-27 22:30:38 +0000
commit82b619ea680d46bf64f077dfe2041907a5dfc2be (patch)
treefbb9215e9619100493279a1662e54dc335045474 /clang/lib/Basic/Targets.cpp
parent68bf64e302b5fb87a1943101828a489b5ca1fc46 (diff)
downloadbcm5719-llvm-82b619ea680d46bf64f077dfe2041907a5dfc2be.tar.gz
bcm5719-llvm-82b619ea680d46bf64f077dfe2041907a5dfc2be.zip
[X86] Conditionalize Darwin MaxVectorAlign on the presence of AVX.
There's no point in using a larger alignment if we have no instructions that would benefit from it. Differential Revision: http://reviews.llvm.org/D12389 llvm-svn: 246229
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
-rw-r--r--clang/lib/Basic/Targets.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 985e991e601..503e529bfe2 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -3629,13 +3629,21 @@ public:
LongDoubleWidth = 128;
LongDoubleAlign = 128;
SuitableAlign = 128;
- MaxVectorAlign = 256;
SizeType = UnsignedLong;
IntPtrType = SignedLong;
DataLayoutString = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128";
HasAlignMac68kSupport = true;
}
+ bool handleTargetFeatures(std::vector<std::string> &Features,
+ DiagnosticsEngine &Diags) override {
+ if (!DarwinTargetInfo<X86_32TargetInfo>::handleTargetFeatures(Features,
+ Diags))
+ return false;
+ // Now that we know if we have AVX, we can decide how to align vectors.
+ MaxVectorAlign = hasFeature("avx") ? 256 : 128;
+ return true;
+ }
};
// x86-32 Windows target
@@ -3986,13 +3994,22 @@ public:
DarwinX86_64TargetInfo(const llvm::Triple &Triple)
: DarwinTargetInfo<X86_64TargetInfo>(Triple) {
Int64Type = SignedLongLong;
- MaxVectorAlign = 256;
// The 64-bit iOS simulator uses the builtin bool type for Objective-C.
llvm::Triple T = llvm::Triple(Triple);
if (T.isiOS())
UseSignedCharForObjCBool = false;
DataLayoutString = "e-m:o-i64:64-f80:128-n8:16:32:64-S128";
}
+
+ bool handleTargetFeatures(std::vector<std::string> &Features,
+ DiagnosticsEngine &Diags) override {
+ if (!DarwinTargetInfo<X86_64TargetInfo>::handleTargetFeatures(Features,
+ Diags))
+ return false;
+ // Now that we know if we have AVX, we can decide how to align vectors.
+ MaxVectorAlign = hasFeature("avx") ? 256 : 128;
+ return true;
+ }
};
class OpenBSDX86_64TargetInfo : public OpenBSDTargetInfo<X86_64TargetInfo> {
OpenPOWER on IntegriCloud