diff options
author | Craig Topper <craig.topper@intel.com> | 2017-07-27 03:26:52 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2017-07-27 03:26:52 +0000 |
commit | 4eda7561b3f8c8ec6f909adbcda80a4479e93e70 (patch) | |
tree | 599af33b970f9fe255e8de22810a1d4f7ef6a86a /llvm/lib | |
parent | d73696480e1c64c13c339fb201e10bd4f99c7a42 (diff) | |
download | bcm5719-llvm-4eda7561b3f8c8ec6f909adbcda80a4479e93e70.tar.gz bcm5719-llvm-4eda7561b3f8c8ec6f909adbcda80a4479e93e70.zip |
[X86] Improve the unknown stepping support for Intel CPUs in getHostCPUName
This patch improves our guessing of unknown Intel CPUs to support Goldmont and skylake-avx512.
Differential Revision: https://reviews.llvm.org/D35161
llvm-svn: 309246
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Support/Host.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp index 5cf0316d4d7..ac2af7ba567 100644 --- a/llvm/lib/Support/Host.cpp +++ b/llvm/lib/Support/Host.cpp @@ -380,7 +380,9 @@ enum ProcessorFeatures { // Only one bit free left in the first 32 features. FEATURE_MOVBE = 32, FEATURE_ADX, - FEATURE_EM64T + FEATURE_EM64T, + FEATURE_CLFLUSHOPT, + FEATURE_SHA, }; // The check below for i386 was copied from clang's cpuid.h (__get_cpuid_max). @@ -714,7 +716,21 @@ getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model, default: // Unknown family 6 CPU, try to guess. if (Features & (1 << FEATURE_AVX512F)) { - *Type = INTEL_KNL; // knl + if (Features & (1 << FEATURE_AVX512VL)) { + *Type = INTEL_COREI7; + *Subtype = INTEL_COREI7_SKYLAKE_AVX512; + } else { + *Type = INTEL_KNL; // knl + } + break; + } + if (Features2 & (1 << (FEATURE_CLFLUSHOPT - 32))) { + if (Features2 & (1 << (FEATURE_SHA - 32))) { + *Type = INTEL_GOLDMONT; + } else { + *Type = INTEL_COREI7; + *Subtype = INTEL_COREI7_SKYLAKE; + } break; } if (Features2 & (1 << (FEATURE_ADX - 32))) { @@ -974,12 +990,16 @@ static void getAvailableFeatures(unsigned ECX, unsigned EDX, unsigned MaxLeaf, Features2 |= 1 << (FEATURE_ADX - 32); if (HasLeaf7 && ((EBX >> 21) & 1) && HasAVX512Save) Features |= 1 << FEATURE_AVX512IFMA; + if (HasLeaf7 && ((EBX >> 23) & 1)) + Features2 |= 1 << (FEATURE_CLFLUSHOPT - 32); if (HasLeaf7 && ((EBX >> 26) & 1) && HasAVX512Save) Features |= 1 << FEATURE_AVX512PF; if (HasLeaf7 && ((EBX >> 27) & 1) && HasAVX512Save) Features |= 1 << FEATURE_AVX512ER; if (HasLeaf7 && ((EBX >> 28) & 1) && HasAVX512Save) Features |= 1 << FEATURE_AVX512CD; + if (HasLeaf7 && ((EBX >> 29) & 1)) + Features2 |= 1 << (FEATURE_SHA - 32); if (HasLeaf7 && ((EBX >> 30) & 1) && HasAVX512Save) Features |= 1 << FEATURE_AVX512BW; if (HasLeaf7 && ((EBX >> 31) & 1) && HasAVX512Save) |