mirror of
https://github.com/anrieff/libcpuid
synced 2024-12-16 16:35:45 +00:00
Support for Skylake.
- Detection of hle, rtm, avx512* and sha-ni instructions - Detection for Skylake - Add test with Skylake i5
This commit is contained in:
parent
3a977a4f99
commit
7b9fe29cef
4 changed files with 132 additions and 0 deletions
|
@ -604,6 +604,16 @@ const char* cpu_feature_str(cpu_feature_t feature)
|
|||
{ CPU_FEATURE_AVX2, "avx2" },
|
||||
{ CPU_FEATURE_BMI1, "bmi1" },
|
||||
{ CPU_FEATURE_BMI2, "bmi2" },
|
||||
{ CPU_FEATURE_HLE, "hle" },
|
||||
{ CPU_FEATURE_RTM, "rtm" },
|
||||
{ CPU_FEATURE_AVX512F, "avx512f" },
|
||||
{ CPU_FEATURE_AVX512DQ, "avx512dq" },
|
||||
{ CPU_FEATURE_AVX512PF, "avx512pf" },
|
||||
{ CPU_FEATURE_AVX512ER, "avx512er" },
|
||||
{ CPU_FEATURE_AVX512CD, "avx512cd" },
|
||||
{ CPU_FEATURE_SHA_NI, "sha_ni" },
|
||||
{ CPU_FEATURE_AVX512BW, "avx512bw" },
|
||||
{ CPU_FEATURE_AVX512VL, "avx512vl" },
|
||||
};
|
||||
unsigned i, n = COUNT_OF(matchtable);
|
||||
if (n != NUM_CPU_FEATURES) {
|
||||
|
|
|
@ -361,6 +361,16 @@ typedef enum {
|
|||
CPU_FEATURE_AVX2, /*!< AVX2 instructions */
|
||||
CPU_FEATURE_BMI1, /*!< BMI1 instructions */
|
||||
CPU_FEATURE_BMI2, /*!< BMI2 instructions */
|
||||
CPU_FEATURE_HLE, /*!< Hardware Lock Elision prefixes */
|
||||
CPU_FEATURE_RTM, /*!< Restricted Transactional Memory instructions */
|
||||
CPU_FEATURE_AVX512F, /*!< AVX-512 Foundation */
|
||||
CPU_FEATURE_AVX512DQ, /*!< AVX-512 Double/Quad granular insns */
|
||||
CPU_FEATURE_AVX512PF, /*!< AVX-512 Prefetch */
|
||||
CPU_FEATURE_AVX512ER, /*!< AVX-512 Exponential/Reciprocal */
|
||||
CPU_FEATURE_AVX512CD, /*!< AVX-512 Conflict detection */
|
||||
CPU_FEATURE_SHA_NI, /*!< SHA-1/SHA-256 instructions */
|
||||
CPU_FEATURE_AVX512BW, /*!< AVX-512 Byte/Word granular insns */
|
||||
CPU_FEATURE_AVX512VL, /*!< AVX-512 128/256 vector length extensions */
|
||||
/* termination: */
|
||||
NUM_CPU_FEATURES,
|
||||
} cpu_feature_t;
|
||||
|
|
|
@ -349,6 +349,18 @@ static void load_intel_features(struct cpu_raw_data_t* raw, struct cpu_id_t* dat
|
|||
const struct feature_map_t matchtable_edx81[] = {
|
||||
{ 20, CPU_FEATURE_XD },
|
||||
};
|
||||
const struct feature_map_t matchtable_ebx7[] = {
|
||||
{ 4, CPU_FEATURE_HLE },
|
||||
{ 11, CPU_FEATURE_RTM },
|
||||
{ 16, CPU_FEATURE_AVX512F },
|
||||
{ 17, CPU_FEATURE_AVX512DQ },
|
||||
{ 26, CPU_FEATURE_AVX512PF },
|
||||
{ 27, CPU_FEATURE_AVX512ER },
|
||||
{ 28, CPU_FEATURE_AVX512CD },
|
||||
{ 29, CPU_FEATURE_SHA_NI },
|
||||
{ 30, CPU_FEATURE_AVX512BW },
|
||||
{ 31, CPU_FEATURE_AVX512VL },
|
||||
};
|
||||
if (raw->basic_cpuid[0][0] >= 1) {
|
||||
match_features(matchtable_edx1, COUNT_OF(matchtable_edx1), raw->basic_cpuid[1][3], data);
|
||||
match_features(matchtable_ecx1, COUNT_OF(matchtable_ecx1), raw->basic_cpuid[1][2], data);
|
||||
|
@ -356,6 +368,10 @@ static void load_intel_features(struct cpu_raw_data_t* raw, struct cpu_id_t* dat
|
|||
if (raw->ext_cpuid[0][0] >= 1) {
|
||||
match_features(matchtable_edx81, COUNT_OF(matchtable_edx81), raw->ext_cpuid[1][3], data);
|
||||
}
|
||||
// detect TSX/AVX512:
|
||||
if (raw->basic_cpuid[0][0] >= 7) {
|
||||
match_features(matchtable_ebx7, COUNT_OF(matchtable_ebx7), raw->basic_cpuid[7][1], data);
|
||||
}
|
||||
}
|
||||
|
||||
enum _cache_type_t {
|
||||
|
@ -618,6 +634,9 @@ static intel_code_t get_brand_code(struct cpu_id_t* data)
|
|||
/* if it has FMA, then it is at least Haswell */
|
||||
if (data->flags[CPU_FEATURE_FMA3])
|
||||
core_ix_base = CORE_HASWELL3;
|
||||
/* if it has RTM, then it is at least Skylake */
|
||||
if (data->flags[CPU_FEATURE_RTM])
|
||||
core_ix_base = CORE_SKYLAKE3;
|
||||
|
||||
switch (bs[i + 9]) {
|
||||
case '3': code = core_ix_base + 0; break;
|
||||
|
|
93
tests/intel/skylake/skylake-i5.test
Normal file
93
tests/intel/skylake/skylake-i5.test
Normal file
|
@ -0,0 +1,93 @@
|
|||
basic_cpuid[0]=00000016 756e6547 6c65746e 49656e69
|
||||
basic_cpuid[1]=000506e3 00100800 7ffafbbf bfebfbff
|
||||
basic_cpuid[2]=76036301 00f0b6ff 00000000 00c30000
|
||||
basic_cpuid[3]=00000000 00000000 00000000 00000000
|
||||
basic_cpuid[4]=1c004121 01c0003f 0000003f 00000000
|
||||
basic_cpuid[5]=00000040 00000040 00000003 00142120
|
||||
basic_cpuid[6]=000027f7 00000002 00000009 00000000
|
||||
basic_cpuid[7]=00000000 029c6fbb 00000000 00000000
|
||||
basic_cpuid[8]=00000000 00000000 00000000 00000000
|
||||
basic_cpuid[9]=00000000 00000000 00000000 00000000
|
||||
basic_cpuid[10]=07300804 00000000 00000000 00000603
|
||||
basic_cpuid[11]=00000001 00000001 00000100 00000000
|
||||
basic_cpuid[12]=00000000 00000000 00000000 00000000
|
||||
basic_cpuid[13]=0000001f 00000340 00000440 00000000
|
||||
basic_cpuid[14]=00000000 00000000 00000000 00000000
|
||||
basic_cpuid[15]=00000000 00000000 00000000 00000000
|
||||
basic_cpuid[16]=00000000 00000000 00000000 00000000
|
||||
basic_cpuid[17]=00000000 00000000 00000000 00000000
|
||||
basic_cpuid[18]=00000000 00000000 00000000 00000000
|
||||
basic_cpuid[19]=00000000 00000000 00000000 00000000
|
||||
basic_cpuid[20]=00000001 0000000f 00000007 00000000
|
||||
basic_cpuid[21]=00000002 00000124 00000000 00000000
|
||||
basic_cpuid[22]=00000dac 00000f3c 00000064 00000000
|
||||
basic_cpuid[23]=00000dac 00000f3c 00000064 00000000
|
||||
basic_cpuid[24]=00000dac 00000f3c 00000064 00000000
|
||||
basic_cpuid[25]=00000dac 00000f3c 00000064 00000000
|
||||
basic_cpuid[26]=00000dac 00000f3c 00000064 00000000
|
||||
basic_cpuid[27]=00000dac 00000f3c 00000064 00000000
|
||||
basic_cpuid[28]=00000dac 00000f3c 00000064 00000000
|
||||
basic_cpuid[29]=00000dac 00000f3c 00000064 00000000
|
||||
basic_cpuid[30]=00000dac 00000f3c 00000064 00000000
|
||||
basic_cpuid[31]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[0]=80000008 00000000 00000000 00000000
|
||||
ext_cpuid[1]=00000000 00000000 00000121 2c100000
|
||||
ext_cpuid[2]=65746e49 2952286c 726f4320 4d542865
|
||||
ext_cpuid[3]=35692029 3036362d 43204b30 40205550
|
||||
ext_cpuid[4]=352e3320 7a484730 00000000 00000000
|
||||
ext_cpuid[5]=00000000 00000000 00000000 00000000
|
||||
ext_cpuid[6]=00000000 00000000 01006040 00000000
|
||||
ext_cpuid[7]=00000000 00000000 00000000 00000100
|
||||
ext_cpuid[8]=00003027 00000000 00000000 00000000
|
||||
ext_cpuid[9]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[10]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[11]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[12]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[13]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[14]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[15]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[16]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[17]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[18]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[19]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[20]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[21]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[22]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[23]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[24]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[25]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[26]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[27]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[28]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[29]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[30]=00000dac 00000f3c 00000064 00000000
|
||||
ext_cpuid[31]=00000dac 00000f3c 00000064 00000000
|
||||
intel_fn4[0]=1c004121 01c0003f 0000003f 00000000
|
||||
intel_fn4[1]=1c004122 01c0003f 0000003f 00000000
|
||||
intel_fn4[2]=1c004143 00c0003f 000003ff 00000000
|
||||
intel_fn4[3]=1c03c163 02c0003f 00001fff 00000006
|
||||
intel_fn11[0]=00000001 00000001 00000100 00000000
|
||||
intel_fn11[1]=00000004 00000004 00000201 00000000
|
||||
intel_fn11[2]=00000000 00000000 00000002 00000000
|
||||
intel_fn11[3]=00000000 00000000 00000003 00000000
|
||||
--------------------------------------------------------------------------------
|
||||
6
|
||||
14
|
||||
3
|
||||
6
|
||||
94
|
||||
4
|
||||
4
|
||||
32
|
||||
32
|
||||
256
|
||||
6144
|
||||
8
|
||||
4
|
||||
12
|
||||
64
|
||||
64
|
||||
64
|
||||
128 (non-authoritative)
|
||||
Skylake (Core i5)
|
||||
fpu vme de pse tsc msr pae mce cx8 apic mtrr sep pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni pclmul dts64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 xd movbe popcnt aes xsave osxsave avx rdtscp lm lahf_lm constant_tsc fma3 f16c rdrand x2apic avx2 bmi1 bmi2 hle rtm
|
Loading…
Reference in a new issue