summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Targets.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2015-07-01 00:08:32 +0000
committerEric Christopher <echristo@gmail.com>2015-07-01 00:08:32 +0000
commit298ac300b24c4efe5fb5e1738f663b1a9744a657 (patch)
tree888e47a8f90f317a4d74d9626aab0af201f1ba87 /clang/lib/Basic/Targets.cpp
parent2249b8169729d1816365d8069caa342c98068760 (diff)
downloadbcm5719-llvm-298ac300b24c4efe5fb5e1738f663b1a9744a657.tar.gz
bcm5719-llvm-298ac300b24c4efe5fb5e1738f663b1a9744a657.zip
Fix sse4 for target attribute feature additions.
This reinstates part of the hack removed in r233223, by special casing sse4 as part of the feature additions. The notable change here is that we consider it only as part of setting the SSE level and not as part of the actual target features set which handles setting the rest of the masks. llvm-svn: 241130
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
-rw-r--r--clang/lib/Basic/Targets.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index e496a1f6cd7..395f452ea83 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -2728,7 +2728,11 @@ void X86TargetInfo::setXOPLevel(llvm::StringMap<bool> &Features, XOPEnum Level,
void X86TargetInfo::setFeatureEnabledImpl(llvm::StringMap<bool> &Features,
StringRef Name, bool Enabled) {
- Features[Name] = Enabled;
+ // This is a bit of a hack to deal with the sse4 target feature when used
+ // as part of the target attribute. We handle sse4 correctly everywhere
+ // else. See below for more information on how we handle the sse4 options.
+ if (Name != "sse4")
+ Features[Name] = Enabled;
if (Name == "mmx") {
setMMXLevel(Features, MMX, Enabled);
@@ -2779,6 +2783,15 @@ void X86TargetInfo::setFeatureEnabledImpl(llvm::StringMap<bool> &Features,
} else if (Name == "sha") {
if (Enabled)
setSSELevel(Features, SSE2, Enabled);
+ } else if (Name == "sse4") {
+ // We can get here via the __target__ attribute since that's not controlled
+ // via the -msse4/-mno-sse4 command line alias. Handle this the same way
+ // here - turn on the sse4.2 if enabled, turn off the sse4.1 level if
+ // disabled.
+ if (Enabled)
+ setSSELevel(Features, SSE42, Enabled);
+ else
+ setSSELevel(Features, SSE41, Enabled);
}
}
OpenPOWER on IntegriCloud