]> granicus.if.org Git - clang/commitdiff
Correct hasFeature/isValidFeatureName's handling of shstk/adx/mwaitx
authorErich Keane <erich.keane@intel.com>
Thu, 21 Dec 2017 23:27:36 +0000 (23:27 +0000)
committerErich Keane <erich.keane@intel.com>
Thu, 21 Dec 2017 23:27:36 +0000 (23:27 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321324 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets/X86.cpp

index 7fd9fd04781817212dace44597dd142b88db18b8..103916cf047e421614d172faaa4b6140ec3b1578 100644 (file)
@@ -1131,6 +1131,7 @@ bool X86TargetInfo::isValidFeatureName(StringRef Name) const {
   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(StringRef Name) const {
       .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(StringRef Name) const {
       .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(StringRef Name) const {
 
 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 Feature) const {
       .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 Feature) const {
       .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 Feature) const {
       .Case("rtm", HasRTM)
       .Case("sgx", HasSGX)
       .Case("sha", HasSHA)
+      .Case("shstk", HasSHSTK)
       .Case("sse", SSELevel >= SSE1)
       .Case("sse2", SSELevel >= SSE2)
       .Case("sse3", SSELevel >= SSE3)