diff options
author | Craig Topper <craig.topper@gmail.com> | 2011-12-30 07:33:42 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2011-12-30 07:33:42 +0000 |
commit | 6a511e14074e186328020fce78fe0c33deb64d1b (patch) | |
tree | 12a44dadb22454ad682379d7128282c6fc3af5bd /lib/Basic/Targets.cpp | |
parent | 68045b1d4de4b332b7c478e81b5c4383891ba593 (diff) |
Add FMA4 feature flag. Intrinsics coming soon. Also make sse4a feature flag imply sse3. Matches gcc behavior.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147370 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Targets.cpp')
-rw-r--r-- | lib/Basic/Targets.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index a768226b40..aebb28a68e 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -1199,6 +1199,7 @@ class X86TargetInfo : public TargetInfo { bool HasBMI; bool HasBMI2; bool HasPOPCNT; + bool HasFMA4; /// \brief Enumeration of all of the X86 CPUs supported by Clang. /// @@ -1336,7 +1337,8 @@ public: X86TargetInfo(const std::string& triple) : TargetInfo(triple), SSELevel(NoSSE), MMX3DNowLevel(NoMMX3DNow), HasAES(false), HasAVX(false), HasAVX2(false), HasLZCNT(false), - HasBMI(false), HasBMI2(false), HasPOPCNT(false), CPU(CK_Generic) { + HasBMI(false), HasBMI2(false), HasPOPCNT(false), HasFMA4(false), + CPU(CK_Generic) { BigEndian = false; LongDoubleFormat = &llvm::APFloat::x87DoubleExtended; } @@ -1521,6 +1523,7 @@ void X86TargetInfo::getDefaultFeatures(llvm::StringMap<bool> &Features) const { Features["bmi"] = false; Features["bmi2"] = false; Features["popcnt"] = false; + Features["fma4"] = false; // FIXME: This *really* should not be here. @@ -1690,8 +1693,13 @@ bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features, Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = Features["ssse3"] = Features["sse41"] = Features["sse42"] = Features["popcnt"] = Features["avx"] = Features["avx2"] = true; + else if (Name == "fma4") + Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["ssse3"] = Features["sse41"] = Features["sse42"] = + Features["popcnt"] = Features["avx"] = Features["fma4"] = true; else if (Name == "sse4a") - Features["mmx"] = Features["sse4a"] = true; + Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["sse4a"] = true; else if (Name == "lzcnt") Features["lzcnt"] = true; else if (Name == "bmi") @@ -1705,13 +1713,14 @@ bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features, Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = false; else if (Name == "sse") Features["sse"] = Features["sse2"] = Features["sse3"] = - Features["ssse3"] = Features["sse41"] = Features["sse42"] = false; + Features["ssse3"] = Features["sse41"] = Features["sse42"] = + Features["sse4a"] = false; else if (Name == "sse2") Features["sse2"] = Features["sse3"] = Features["ssse3"] = - Features["sse41"] = Features["sse42"] = false; + Features["sse41"] = Features["sse42"] = Features["sse4a"] = false; else if (Name == "sse3") Features["sse3"] = Features["ssse3"] = Features["sse41"] = - Features["sse42"] = false; + Features["sse42"] = Features["sse4a"] = false; else if (Name == "ssse3") Features["ssse3"] = Features["sse41"] = Features["sse42"] = false; else if (Name == "sse4" || Name == "sse4.1") @@ -1725,7 +1734,7 @@ bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features, else if (Name == "aes") Features["aes"] = false; else if (Name == "avx") - Features["avx"] = Features["avx2"] = false; + Features["avx"] = Features["avx2"] = Features["fma4"] = false; else if (Name == "avx2") Features["avx2"] = false; else if (Name == "sse4a") @@ -1738,6 +1747,8 @@ bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features, Features["bmi2"] = false; else if (Name == "popcnt") Features["popcnt"] = false; + else if (Name == "fma4") + Features["fma4"] = false; } return true; @@ -1777,10 +1788,14 @@ void X86TargetInfo::HandleTargetFeatures(std::vector<std::string> &Features) { continue; } + if (Features[i].substr(1) == "fma4") { + HasFMA4 = true; + continue; + } + // FIXME: Not sure yet how to treat AVX in regard to SSE levels. // For now let it be enabled together with other SSE levels. if (Features[i].substr(1) == "avx2") { - HasAVX = true; HasAVX2 = true; continue; } @@ -2011,6 +2026,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, if (HasPOPCNT) Builder.defineMacro("__POPCNT__"); + if (HasFMA4) + Builder.defineMacro("__FMA4__"); + // Each case falls through to the previous one here. switch (SSELevel) { case SSE42: |