diff options
| author | Erich Keane <erich.keane@intel.com> | 2017-11-22 00:54:01 +0000 |
|---|---|---|
| committer | Erich Keane <erich.keane@intel.com> | 2017-11-22 00:54:01 +0000 |
| commit | 0a340ab31c85b797b0d355dfcc1170aaf850822d (patch) | |
| tree | c32bb466f88fca8db31f03ec43e9eea5ecb51b64 /clang | |
| parent | 47c8739b08b443c652846656e9e068dfeb2f1cd8 (diff) | |
| download | bcm5719-llvm-0a340ab31c85b797b0d355dfcc1170aaf850822d.tar.gz bcm5719-llvm-0a340ab31c85b797b0d355dfcc1170aaf850822d.zip | |
[X86] Update CPUSupports code to reuse LLVM .def file [NFC]
llvm-svn: 318815
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Basic/Targets/X86.cpp | 33 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 76 |
2 files changed, 7 insertions, 102 deletions
diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index 0ad1c9bf314..af7e873e83d 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -1251,37 +1251,8 @@ bool X86TargetInfo::hasFeature(StringRef Feature) const { // X86TargetInfo::hasFeature for a somewhat comprehensive list). bool X86TargetInfo::validateCpuSupports(StringRef FeatureStr) const { return llvm::StringSwitch<bool>(FeatureStr) - .Case("cmov", true) - .Case("mmx", true) - .Case("popcnt", true) - .Case("sse", true) - .Case("sse2", true) - .Case("sse3", true) - .Case("ssse3", true) - .Case("sse4.1", true) - .Case("sse4.2", true) - .Case("avx", true) - .Case("avx2", true) - .Case("sse4a", true) - .Case("fma4", true) - .Case("xop", true) - .Case("fma", true) - .Case("avx512f", true) - .Case("bmi", true) - .Case("bmi2", true) - .Case("aes", true) - .Case("pclmul", true) - .Case("avx512vl", true) - .Case("avx512bw", true) - .Case("avx512dq", true) - .Case("avx512cd", true) - .Case("avx512er", true) - .Case("avx512pf", true) - .Case("avx512vbmi", true) - .Case("avx512ifma", true) - .Case("avx5124vnniw", true) - .Case("avx5124fmaps", true) - .Case("avx512vpopcntdq", true) +#define X86_FEATURE_COMPAT(VAL, ENUM, STR) .Case(STR, true) +#include "llvm/Support/X86TargetParser.def" .Default(false); } diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index add93268af8..809f7605991 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -7547,82 +7547,16 @@ Value *CodeGenFunction::EmitX86CpuSupports(const CallExpr *E) { } Value *CodeGenFunction::EmitX86CpuSupports(ArrayRef<StringRef> FeatureStrs) { - // TODO: When/if this becomes more than x86 specific then use a TargetInfo - // based mapping. // Processor features and mapping to processor feature value. - enum X86Features { - CMOV = 0, - MMX, - POPCNT, - SSE, - SSE2, - SSE3, - SSSE3, - SSE4_1, - SSE4_2, - AVX, - AVX2, - SSE4_A, - FMA4, - XOP, - FMA, - AVX512F, - BMI, - BMI2, - AES, - PCLMUL, - AVX512VL, - AVX512BW, - AVX512DQ, - AVX512CD, - AVX512ER, - AVX512PF, - AVX512VBMI, - AVX512IFMA, - AVX5124VNNIW, - AVX5124FMAPS, - AVX512VPOPCNTDQ, - MAX - }; uint32_t FeaturesMask = 0; for (const StringRef &FeatureStr : FeatureStrs) { - X86Features Feature = - StringSwitch<X86Features>(FeatureStr) - .Case("cmov", X86Features::CMOV) - .Case("mmx", X86Features::MMX) - .Case("popcnt", X86Features::POPCNT) - .Case("sse", X86Features::SSE) - .Case("sse2", X86Features::SSE2) - .Case("sse3", X86Features::SSE3) - .Case("ssse3", X86Features::SSSE3) - .Case("sse4.1", X86Features::SSE4_1) - .Case("sse4.2", X86Features::SSE4_2) - .Case("avx", X86Features::AVX) - .Case("avx2", X86Features::AVX2) - .Case("sse4a", X86Features::SSE4_A) - .Case("fma4", X86Features::FMA4) - .Case("xop", X86Features::XOP) - .Case("fma", X86Features::FMA) - .Case("avx512f", X86Features::AVX512F) - .Case("bmi", X86Features::BMI) - .Case("bmi2", X86Features::BMI2) - .Case("aes", X86Features::AES) - .Case("pclmul", X86Features::PCLMUL) - .Case("avx512vl", X86Features::AVX512VL) - .Case("avx512bw", X86Features::AVX512BW) - .Case("avx512dq", X86Features::AVX512DQ) - .Case("avx512cd", X86Features::AVX512CD) - .Case("avx512er", X86Features::AVX512ER) - .Case("avx512pf", X86Features::AVX512PF) - .Case("avx512vbmi", X86Features::AVX512VBMI) - .Case("avx512ifma", X86Features::AVX512IFMA) - .Case("avx5124vnniw", X86Features::AVX5124VNNIW) - .Case("avx5124fmaps", X86Features::AVX5124FMAPS) - .Case("avx512vpopcntdq", X86Features::AVX512VPOPCNTDQ) - .Default(X86Features::MAX); - assert(Feature != X86Features::MAX && "Invalid feature!"); + unsigned Feature = + StringSwitch<unsigned>(FeatureStr) +#define X86_FEATURE_COMPAT(VAL, ENUM, STR) .Case(STR, VAL) +#include "llvm/Support/X86TargetParser.def" + ; FeaturesMask |= (1U << Feature); } |

