From 05a54a3ef8af7878dda2e804b75b4424c2c8944f Mon Sep 17 00:00:00 2001 From: Erich Keane Date: Thu, 21 Dec 2017 23:27:36 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321324 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/Targets/X86.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Basic/Targets/X86.cpp b/lib/Basic/Targets/X86.cpp index 7fd9fd0478..103916cf04 100644 --- a/lib/Basic/Targets/X86.cpp +++ b/lib/Basic/Targets/X86.cpp @@ -1131,6 +1131,7 @@ bool X86TargetInfo::isValidFeatureName(StringRef Name) const { return llvm::StringSwitch(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(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) -- 2.40.0