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.

llvm-svn: 321324
This commit is contained in:
Erich Keane 2017-12-21 23:27:36 +00:00
parent 1db24196d1
commit e8192cc15f
1 changed files with 7 additions and 2 deletions

View 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)