From 1f6aeebe7691024d05b914a96003ff11df5f861a Mon Sep 17 00:00:00 2001 From: Yunzhong Gao Date: Tue, 24 Sep 2013 19:00:58 +0000 Subject: Adding -mtbm and -mno-tbm command line options to the clang front end for the x86 TBM instruction set. Also adding a __TBM__ macro if the TBM feature is enabled. Otherwise there should be no functionality change to existing features. Phabricator code review is located here: http://llvm-reviews.chandlerc.com/D1693 llvm-svn: 191326 --- clang/lib/Basic/Targets.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'clang/lib/Basic/Targets.cpp') diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index a9512d2fe1f..f1a14544104 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -1586,6 +1586,7 @@ class X86TargetInfo : public TargetInfo { bool HasRTM; bool HasPRFCHW; bool HasRDSEED; + bool HasTBM; bool HasFMA; bool HasF16C; bool HasAVX512CD, HasAVX512ER, HasAVX512PF; @@ -1748,8 +1749,8 @@ public: : TargetInfo(Triple), SSELevel(NoSSE), MMX3DNowLevel(NoMMX3DNow), XOPLevel(NoXOP), HasAES(false), HasPCLMUL(false), HasLZCNT(false), HasRDRND(false), HasBMI(false), HasBMI2(false), HasPOPCNT(false), - HasRTM(false), HasPRFCHW(false), HasRDSEED(false), HasFMA(false), - HasF16C(false), HasAVX512CD(false), HasAVX512ER(false), + HasRTM(false), HasPRFCHW(false), HasRDSEED(false), HasTBM(false), + HasFMA(false), HasF16C(false), HasAVX512CD(false), HasAVX512ER(false), HasAVX512PF(false), HasSHA(false), CPU(CK_Generic), FPMath(FP_Default) { BigEndian = false; LongDoubleFormat = &llvm::APFloat::x87DoubleExtended; @@ -2127,6 +2128,7 @@ void X86TargetInfo::getDefaultFeatures(llvm::StringMap &Features) const { setFeatureEnabledImpl(Features, "bmi", true); setFeatureEnabledImpl(Features, "fma", true); setFeatureEnabledImpl(Features, "f16c", true); + setFeatureEnabledImpl(Features, "tbm", true); break; case CK_C3_2: setFeatureEnabledImpl(Features, "sse", true); @@ -2367,6 +2369,11 @@ bool X86TargetInfo::HandleTargetFeatures(std::vector &Features, continue; } + if (Feature == "tbm") { + HasTBM = true; + continue; + } + if (Feature == "fma") { HasFMA = true; continue; @@ -2642,6 +2649,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, if (HasRDSEED) Builder.defineMacro("__RDSEED__"); + if (HasTBM) + Builder.defineMacro("__TBM__"); + switch (XOPLevel) { case XOP: Builder.defineMacro("__XOP__"); @@ -2749,6 +2759,7 @@ bool X86TargetInfo::hasFeature(StringRef Feature) const { .Case("bmi2", HasBMI2) .Case("fma", HasFMA) .Case("fma4", XOPLevel >= FMA4) + .Case("tbm", HasTBM) .Case("lzcnt", HasLZCNT) .Case("rdrnd", HasRDRND) .Case("mm3dnow", MMX3DNowLevel >= AMD3DNow) -- cgit v1.2.3