r321324 - Correct hasFeature/isValidFeatureName's handling of shstk/adx/mwaitx

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 21 15:27:37 PST 2017


Author: erichkeane
Date: Thu Dec 21 15:27:36 2017
New Revision: 321324

URL: http://llvm.org/viewvc/llvm-project?rev=321324&view=rev
Log:
Correct hasFeature/isValidFeatureName's handling of shstk/adx/mwaitx

https://bugs.llvm.org/show_bug.cgi?id=35721 reports that x86intrin.h
is issuing a few warnings. This is because attribute target is using
isValidFeatureName for its source. It was also discovered that two of
these were missing from hasFeature.  

Additionally, shstk is and ibu are reordered alphabetically, as came
up during code review.

Modified:
    cfe/trunk/lib/Basic/Targets/X86.cpp

Modified: cfe/trunk/lib/Basic/Targets/X86.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.cpp?rev=321324&r1=321323&r2=321324&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/X86.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/X86.cpp Thu Dec 21 15:27:36 2017
@@ -1131,6 +1131,7 @@ bool X86TargetInfo::isValidFeatureName(S
   return llvm::StringSwitch<bool>(Name)
       .Case("3dnow", true)
       .Case("3dnowa", true)
+      .Case("adx", true)
       .Case("aes", true)
       .Case("avx", true)
       .Case("avx2", true)
@@ -1160,6 +1161,7 @@ bool X86TargetInfo::isValidFeatureName(S
       .Case("mmx", true)
       .Case("movbe", true)
       .Case("mpx", true)
+      .Case("mwaitx", true)
       .Case("pclmul", true)
       .Case("pku", true)
       .Case("popcnt", true)
@@ -1170,6 +1172,7 @@ bool X86TargetInfo::isValidFeatureName(S
       .Case("rtm", true)
       .Case("sgx", true)
       .Case("sha", true)
+      .Case("shstk", true)
       .Case("sse", true)
       .Case("sse2", true)
       .Case("sse3", true)
@@ -1190,6 +1193,7 @@ bool X86TargetInfo::isValidFeatureName(S
 
 bool X86TargetInfo::hasFeature(StringRef Feature) const {
   return llvm::StringSwitch<bool>(Feature)
+      .Case("adx", HasADX)
       .Case("aes", HasAES)
       .Case("avx", SSELevel >= AVX)
       .Case("avx2", SSELevel >= AVX2)
@@ -1214,6 +1218,7 @@ bool X86TargetInfo::hasFeature(StringRef
       .Case("fma4", XOPLevel >= FMA4)
       .Case("fsgsbase", HasFSGSBASE)
       .Case("fxsr", HasFXSR)
+      .Case("ibt", HasIBT)
       .Case("lwp", HasLWP)
       .Case("lzcnt", HasLZCNT)
       .Case("mm3dnow", MMX3DNowLevel >= AMD3DNow)
@@ -1221,8 +1226,7 @@ bool X86TargetInfo::hasFeature(StringRef
       .Case("mmx", MMX3DNowLevel >= MMX)
       .Case("movbe", HasMOVBE)
       .Case("mpx", HasMPX)
-      .Case("shstk", HasSHSTK)
-      .Case("ibt", HasIBT)
+      .Case("mwaitx", HasMWAITX)
       .Case("pclmul", HasPCLMUL)
       .Case("pku", HasPKU)
       .Case("popcnt", HasPOPCNT)
@@ -1233,6 +1237,7 @@ bool X86TargetInfo::hasFeature(StringRef
       .Case("rtm", HasRTM)
       .Case("sgx", HasSGX)
       .Case("sha", HasSHA)
+      .Case("shstk", HasSHSTK)
       .Case("sse", SSELevel >= SSE1)
       .Case("sse2", SSELevel >= SSE2)
       .Case("sse3", SSELevel >= SSE3)




More information about the cfe-commits mailing list