diff options
author | Michael Liao <michael.liao@intel.com> | 2013-03-26 17:52:08 +0000 |
---|---|---|
committer | Michael Liao <michael.liao@intel.com> | 2013-03-26 17:52:08 +0000 |
commit | 72339a0d160720c6301d629761e701e5fad56f5e (patch) | |
tree | 34f742914855c4d7709d8619c3e9cb72dd6c24ef /lib/Basic | |
parent | c56fff7fd231aebf4b152f60f8f11ef91835c48a (diff) |
Add PRFCHW intrinsic support
- Add head 'prfchwintrin.h' to define '_m_prefetchw' which is mapped to
LLVM/clang prefetch builtin
- Add option '-mprfchw' to enable PRFCHW feature and pre-define '__PRFCHW__'
macro
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178041 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic')
-rw-r--r-- | lib/Basic/Targets.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index b7cd3dce7c..09d8be682f 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -1701,6 +1701,7 @@ class X86TargetInfo : public TargetInfo { bool HasBMI2; bool HasPOPCNT; bool HasRTM; + bool HasPRFCHW; bool HasSSE4a; bool HasFMA4; bool HasFMA; @@ -1852,8 +1853,8 @@ public: : TargetInfo(triple), SSELevel(NoSSE), MMX3DNowLevel(NoMMX3DNow), HasAES(false), HasPCLMUL(false), HasLZCNT(false), HasRDRND(false), HasBMI(false), HasBMI2(false), HasPOPCNT(false), HasRTM(false), - HasSSE4a(false), HasFMA4(false), HasFMA(false), HasXOP(false), - HasF16C(false), CPU(CK_Generic) { + HasPRFCHW(false), HasSSE4a(false), HasFMA4(false), + HasFMA(false), HasXOP(false), HasF16C(false), CPU(CK_Generic) { BigEndian = false; LongDoubleFormat = &llvm::APFloat::x87DoubleExtended; } @@ -2059,6 +2060,7 @@ void X86TargetInfo::getDefaultFeatures(llvm::StringMap<bool> &Features) const { Features["bmi2"] = false; Features["popcnt"] = false; Features["rtm"] = false; + Features["prfchw"] = false; Features["fma4"] = false; Features["fma"] = false; Features["xop"] = false; @@ -2281,6 +2283,8 @@ bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features, Features["f16c"] = true; else if (Name == "rtm") Features["rtm"] = true; + else if (Name == "prfchw") + Features["prfchw"] = true; } else { if (Name == "mmx") Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = false; @@ -2345,6 +2349,8 @@ bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features, Features["f16c"] = false; else if (Name == "rtm") Features["rtm"] = false; + else if (Name == "prfchw") + Features["prfchw"] = false; } return true; @@ -2401,6 +2407,11 @@ void X86TargetInfo::HandleTargetFeatures(std::vector<std::string> &Features) { continue; } + if (Feature == "prfchw") { + HasPRFCHW = true; + continue; + } + if (Feature == "sse4a") { HasSSE4a = true; continue; @@ -2625,6 +2636,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, if (HasRTM) Builder.defineMacro("__RTM__"); + if (HasPRFCHW) + Builder.defineMacro("__PRFCHW__"); + if (HasSSE4a) Builder.defineMacro("__SSE4A__"); @@ -2713,6 +2727,7 @@ bool X86TargetInfo::hasFeature(StringRef Feature) const { .Case("pclmul", HasPCLMUL) .Case("popcnt", HasPOPCNT) .Case("rtm", HasRTM) + .Case("prfchw", HasPRFCHW) .Case("sse", SSELevel >= SSE1) .Case("sse2", SSELevel >= SSE2) .Case("sse3", SSELevel >= SSE3) |