@@ -380,7 +380,9 @@ enum ProcessorFeatures {
380
380
// Only one bit free left in the first 32 features.
381
381
FEATURE_MOVBE = 32 ,
382
382
FEATURE_ADX,
383
- FEATURE_EM64T
383
+ FEATURE_EM64T,
384
+ FEATURE_CLFLUSHOPT,
385
+ FEATURE_SHA,
384
386
};
385
387
386
388
// The check below for i386 was copied from clang's cpuid.h (__get_cpuid_max).
@@ -714,7 +716,21 @@ getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
714
716
715
717
default : // Unknown family 6 CPU, try to guess.
716
718
if (Features & (1 << FEATURE_AVX512F)) {
717
- *Type = INTEL_KNL; // knl
719
+ if (Features & (1 << FEATURE_AVX512VL)) {
720
+ *Type = INTEL_COREI7;
721
+ *Subtype = INTEL_COREI7_SKYLAKE_AVX512;
722
+ } else {
723
+ *Type = INTEL_KNL; // knl
724
+ }
725
+ break ;
726
+ }
727
+ if (Features2 & (1 << (FEATURE_CLFLUSHOPT - 32 ))) {
728
+ if (Features2 & (1 << (FEATURE_SHA - 32 ))) {
729
+ *Type = INTEL_GOLDMONT;
730
+ } else {
731
+ *Type = INTEL_COREI7;
732
+ *Subtype = INTEL_COREI7_SKYLAKE;
733
+ }
718
734
break ;
719
735
}
720
736
if (Features2 & (1 << (FEATURE_ADX - 32 ))) {
@@ -974,12 +990,16 @@ static void getAvailableFeatures(unsigned ECX, unsigned EDX, unsigned MaxLeaf,
974
990
Features2 |= 1 << (FEATURE_ADX - 32 );
975
991
if (HasLeaf7 && ((EBX >> 21 ) & 1 ) && HasAVX512Save)
976
992
Features |= 1 << FEATURE_AVX512IFMA;
993
+ if (HasLeaf7 && ((EBX >> 23 ) & 1 ))
994
+ Features2 |= 1 << (FEATURE_CLFLUSHOPT - 32 );
977
995
if (HasLeaf7 && ((EBX >> 26 ) & 1 ) && HasAVX512Save)
978
996
Features |= 1 << FEATURE_AVX512PF;
979
997
if (HasLeaf7 && ((EBX >> 27 ) & 1 ) && HasAVX512Save)
980
998
Features |= 1 << FEATURE_AVX512ER;
981
999
if (HasLeaf7 && ((EBX >> 28 ) & 1 ) && HasAVX512Save)
982
1000
Features |= 1 << FEATURE_AVX512CD;
1001
+ if (HasLeaf7 && ((EBX >> 29 ) & 1 ))
1002
+ Features2 |= 1 << (FEATURE_SHA - 32 );
983
1003
if (HasLeaf7 && ((EBX >> 30 ) & 1 ) && HasAVX512Save)
984
1004
Features |= 1 << FEATURE_AVX512BW;
985
1005
if (HasLeaf7 && ((EBX >> 31 ) & 1 ) && HasAVX512Save)
0 commit comments