diff --git a/libcpuid/cpuid_main.c b/libcpuid/cpuid_main.c index cd0d7c8..b13b30f 100644 --- a/libcpuid/cpuid_main.c +++ b/libcpuid/cpuid_main.c @@ -558,6 +558,7 @@ const char* cpu_feature_str(cpu_feature_t feature) { CPU_FEATURE_APERFMPERF, "aperfmperf" }, { CPU_FEATURE_PFI, "pfi" }, { CPU_FEATURE_PA, "pa" }, + { CPU_FEATURE_AVX2, "avx2" }, }; unsigned i, n = COUNT_OF(matchtable); if (n != NUM_CPU_FEATURES) { diff --git a/libcpuid/libcpuid.h b/libcpuid/libcpuid.h index 19311c1..f63b5a1 100644 --- a/libcpuid/libcpuid.h +++ b/libcpuid/libcpuid.h @@ -354,6 +354,7 @@ typedef enum { CPU_FEATURE_APERFMPERF, /*!< MPERF/APERF MSRs support */ CPU_FEATURE_PFI, /*!< Processor Feedback Interface support */ CPU_FEATURE_PA, /*!< Processor accumulator */ + CPU_FEATURE_AVX2, /*!< AVX2 instructions */ /* termination: */ NUM_CPU_FEATURES, } cpu_feature_t; diff --git a/libcpuid/recog_intel.c b/libcpuid/recog_intel.c index 717fafa..625b277 100644 --- a/libcpuid/recog_intel.c +++ b/libcpuid/recog_intel.c @@ -362,6 +362,9 @@ static void load_intel_features(struct cpu_raw_data_t* raw, struct cpu_id_t* dat { 28, CPU_FEATURE_AVX }, { 30, CPU_FEATURE_RDRAND }, }; + const struct feature_map_t matchtable_ebx7[] = { + { 5, CPU_FEATURE_AVX2 }, + }; const struct feature_map_t matchtable_edx81[] = { { 20, CPU_FEATURE_XD }, }; @@ -369,6 +372,9 @@ static void load_intel_features(struct cpu_raw_data_t* raw, struct cpu_id_t* dat 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); } + if (raw->basic_cpuid[0][0] >= 7) { + match_features(matchtable_ebx7, COUNT_OF(matchtable_ebx7), raw->basic_cpuid[7][1], data); + } if (raw->ext_cpuid[0][0] >= 1) { match_features(matchtable_edx81, COUNT_OF(matchtable_edx81), raw->ext_cpuid[1][3], data); } diff --git a/tests/intel/haswell/haswell-i3.test b/tests/intel/haswell/haswell-i3.test index 1cea92b..de0c83d 100644 --- a/tests/intel/haswell/haswell-i3.test +++ b/tests/intel/haswell/haswell-i3.test @@ -90,4 +90,4 @@ intel_fn11[3]=00000000 00000000 00000003 00000001 64 128 (non-authoritative) Haswell (Core i3) -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 syscall xd movbe popcnt aes xsave osxsave avx rdtscp lm lahf_lm constant_tsc fma3 f16c rdrand +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 syscall xd movbe popcnt aes xsave osxsave avx rdtscp lm lahf_lm constant_tsc fma3 f16c rdrand avx2