diff options
author | Eric Christopher <echristo@gmail.com> | 2015-10-08 20:10:14 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2015-10-08 20:10:14 +0000 |
commit | bbd746db9ed5b52ea00a1ec72ee67f15660e0921 (patch) | |
tree | 367ea8098ff295820dbac221dcc3466cb79ccf56 /clang/lib/Basic/Targets.cpp | |
parent | 11e5983658ce90495804e7016bc95a3913c22d22 (diff) | |
download | bcm5719-llvm-bbd746db9ed5b52ea00a1ec72ee67f15660e0921.tar.gz bcm5719-llvm-bbd746db9ed5b52ea00a1ec72ee67f15660e0921.zip |
Migrate most feature map inclusion to initFeatureMap for the x86 target so
that we can build up an accurate set of features rather than relying on
TargetInfo initialization via handleTargetFeatures to munge the list
of features.
llvm-svn: 249732
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
-rw-r--r-- | clang/lib/Basic/Targets.cpp | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 1f576d96220..0f900db7531 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -2705,7 +2705,27 @@ bool X86TargetInfo::initFeatureMap( setFeatureEnabledImpl(Features, "cx16", true); break; } - return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); + if (!TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec)) + return false; + + // Can't do this earlier because we need to be able to explicitly enable + // or disable these features and the things that they depend upon. + + // Enable popcnt if sse4.2 is enabled and popcnt is not explicitly disabled. + auto I = Features.find("sse4.2"); + if (I != Features.end() && I->getValue() == true && + std::find(FeaturesVec.begin(), FeaturesVec.end(), "-popcnt") == + FeaturesVec.end()) + Features["popcnt"] = true; + + // Enable prfchw if 3DNow! is enabled and prfchw is not explicitly disabled. + I = Features.find("3dnow"); + if (I != Features.end() && I->getValue() == true && + std::find(FeaturesVec.begin(), FeaturesVec.end(), "-prfchw") == + FeaturesVec.end()) + Features["prfchw"] = true; + + return true; } void X86TargetInfo::setSSELevel(llvm::StringMap<bool> &Features, @@ -2974,22 +2994,6 @@ bool X86TargetInfo::handleTargetFeatures(std::vector<std::string> &Features, XOPLevel = std::max(XOPLevel, XLevel); } - // Enable popcnt if sse4.2 is enabled and popcnt is not explicitly disabled. - // Can't do this earlier because we need to be able to explicitly enable - // popcnt and still disable sse4.2. - if (!HasPOPCNT && SSELevel >= SSE42 && - std::find(Features.begin(), Features.end(), "-popcnt") == Features.end()){ - HasPOPCNT = true; - Features.push_back("+popcnt"); - } - - // Enable prfchw if 3DNow! is enabled and prfchw is not explicitly disabled. - if (!HasPRFCHW && MMX3DNowLevel >= AMD3DNow && - std::find(Features.begin(), Features.end(), "-prfchw") == Features.end()){ - HasPRFCHW = true; - Features.push_back("+prfchw"); - } - // LLVM doesn't have a separate switch for fpmath, so only accept it if it // matches the selected sse level. if (FPMath == FP_SSE && SSELevel < SSE1) { |