diff options
author | Manman Ren <mren@apple.com> | 2012-10-11 00:59:55 +0000 |
---|---|---|
committer | Manman Ren <mren@apple.com> | 2012-10-11 00:59:55 +0000 |
commit | 146e5a4a787a2ebfe89a6b74e7c22d850bf1c858 (patch) | |
tree | 8774ff332c6f10959f86969bc5482cc847b4bc56 /lib/Basic/Targets.cpp | |
parent | 4145228b758892afd3545835a4caaea722f20510 (diff) |
X86: add F16C support in Clang
Support the following intrinsics:
_mm_cvtph_ps, _mm256_cvtph_ps, _mm_cvtps_ph, _mm256_cvtps_ph
rdar://12407875
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165685 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Targets.cpp')
-rw-r--r-- | lib/Basic/Targets.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 17f1a615f1..bc32d75d79 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -1360,6 +1360,7 @@ class X86TargetInfo : public TargetInfo { bool HasFMA4; bool HasFMA; bool HasXOP; + bool HasF16C; /// \brief Enumeration of all of the X86 CPUs supported by Clang. /// @@ -1506,7 +1507,8 @@ public: : TargetInfo(triple), SSELevel(NoSSE), MMX3DNowLevel(NoMMX3DNow), HasAES(false), HasPCLMUL(false), HasLZCNT(false), HasRDRND(false), HasBMI(false), HasBMI2(false), HasPOPCNT(false), HasSSE4a(false), - HasFMA4(false), HasFMA(false), HasXOP(false), CPU(CK_Generic) { + HasFMA4(false), HasFMA(false), HasXOP(false), HasF16C(false), + CPU(CK_Generic) { BigEndian = false; LongDoubleFormat = &llvm::APFloat::x87DoubleExtended; } @@ -1712,6 +1714,7 @@ void X86TargetInfo::getDefaultFeatures(llvm::StringMap<bool> &Features) const { Features["fma4"] = false; Features["fma"] = false; Features["xop"] = false; + Features["f16c"] = false; // FIXME: This *really* should not be here. @@ -1922,6 +1925,8 @@ bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features, Features["bmi2"] = true; else if (Name == "popcnt") Features["popcnt"] = true; + else if (Name == "f16c") + Features["f16c"] = true; } else { if (Name == "mmx") Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = false; @@ -1982,6 +1987,8 @@ bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features, Features["fma4"] = Features["xop"] = false; else if (Name == "xop") Features["xop"] = false; + else if (Name == "f16c") + Features["f16c"] = false; } return true; @@ -2053,6 +2060,11 @@ void X86TargetInfo::HandleTargetFeatures(std::vector<std::string> &Features) { continue; } + if (Feature == "f16c") { + HasF16C = true; + continue; + } + assert(Features[i][0] == '+' && "Invalid target feature!"); X86SSEEnum Level = llvm::StringSwitch<X86SSEEnum>(Feature) .Case("avx2", AVX2) @@ -2261,6 +2273,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, if (HasXOP) Builder.defineMacro("__XOP__"); + if (HasF16C) + Builder.defineMacro("__F16C__"); + // Each case falls through to the previous one here. switch (SSELevel) { case AVX2: @@ -2344,6 +2359,7 @@ bool X86TargetInfo::hasFeature(StringRef Feature) const { .Case("x86_32", PointerWidth == 32) .Case("x86_64", PointerWidth == 64) .Case("xop", HasXOP) + .Case("f16c", HasF16C) .Default(false); } |