diff --git a/libcpuid/cpuid_main.c b/libcpuid/cpuid_main.c index 6765437..bb5d2a2 100644 --- a/libcpuid/cpuid_main.c +++ b/libcpuid/cpuid_main.c @@ -170,6 +170,7 @@ static void load_features_common(struct cpu_raw_data_t* raw, struct cpu_id_t* da { 0, CPU_FEATURE_PNI }, { 3, CPU_FEATURE_MONITOR }, { 9, CPU_FEATURE_SSSE3 }, + { 12, CPU_FEATURE_FMA3 }, { 13, CPU_FEATURE_CX16 }, { 19, CPU_FEATURE_SSE4_1 }, { 21, CPU_FEATURE_X2APIC }, diff --git a/libcpuid/recog_intel.c b/libcpuid/recog_intel.c index fd2c5ca..9e7fda0 100644 --- a/libcpuid/recog_intel.c +++ b/libcpuid/recog_intel.c @@ -68,6 +68,9 @@ enum _intel_code_t { CORE_IVY3, /* 22nm Core-iX */ CORE_IVY5, CORE_IVY7, + CORE_HASWELL3, /* 22nm Core-iX, Haswell */ + CORE_HASWELL5, + CORE_HASWELL7, }; typedef enum _intel_code_t intel_code_t; @@ -295,6 +298,10 @@ const struct match_entry_t cpudb_intel[] = { { 6, 10, -1, -1, 58, 4, -1, -1, CORE_IVY5 , 0, "Ivy Bridge (Core i5)" }, { 6, 10, -1, -1, 58, 2, -1, -1, CORE_IVY3 , 0, "Ivy Bridge (Core i3)" }, + { 6, 12, -1, -1, 60, 4, -1, -1, CORE_HASWELL7 , 0, "Haswell (Core i7)" }, + { 6, 12, -1, -1, 60, 4, -1, -1, CORE_HASWELL5 , 0, "Haswell (Core i5)" }, + { 6, 12, -1, -1, 60, 2, -1, -1, CORE_HASWELL3 , 0, "Haswell (Core i3)" }, + /* Core microarchitecture-based Xeons: */ { 6, 14, -1, -1, 14, 1, -1, -1, XEON , 0, "Xeon LV" }, @@ -576,7 +583,7 @@ static void decode_intel_number_of_cores(struct cpu_raw_data_t* raw, static intel_code_t get_brand_code(struct cpu_id_t* data) { intel_code_t code = NO_CODE; - int i, need_matchtable = 1, ivy_bridge = 0; + int i, need_matchtable = 1, core_ix_base = 0; const char* bs = data->brand_str; const char* s; const struct { intel_code_t c; const char *search; } matchtable[] = { @@ -607,12 +614,20 @@ static intel_code_t get_brand_code(struct cpu_id_t* data) if ((i = match_pattern(bs, "Core(TM) i[357]")) != 0) { /* Core i3, Core i5 or Core i7 */ need_matchtable = 0; + + core_ix_base = CORE_I3; + + /* if it has RdRand, then it is at least Ivy Bridge */ if (data->flags[CPU_FEATURE_RDRAND]) - ivy_bridge = 1; + core_ix_base = CORE_IVY3; + /* if it has FMA, then it is at least Haswell */ + if (data->flags[CPU_FEATURE_FMA3]) + core_ix_base = CORE_HASWELL3; + switch (bs[i + 9]) { - case '3': code = ivy_bridge ? CORE_IVY3 : CORE_I3; break; - case '5': code = ivy_bridge ? CORE_IVY5 : CORE_I5; break; - case '7': code = ivy_bridge ? CORE_IVY7 : CORE_I7; break; + case '3': code = core_ix_base + 0; break; + case '5': code = core_ix_base + 1; break; + case '7': code = core_ix_base + 2; break; } } if (need_matchtable) { diff --git a/tests/intel/haswell/haswell-i3.test b/tests/intel/haswell/haswell-i3.test new file mode 100644 index 0000000..6438ecd --- /dev/null +++ b/tests/intel/haswell/haswell-i3.test @@ -0,0 +1,93 @@ +basic_cpuid[0]=0000000d 756e6547 6c65746e 49656e69 +basic_cpuid[1]=000306c3 01100800 7fdafbbf bfebfbff +basic_cpuid[2]=76036301 00f0b5ff 00000000 00c10000 +basic_cpuid[3]=00000000 00000000 00000000 00000000 +basic_cpuid[4]=1c004121 01c0003f 0000003f 00000000 +basic_cpuid[5]=00000040 00000040 00000003 00042120 +basic_cpuid[6]=00000075 00000002 00000001 00000000 +basic_cpuid[7]=00000000 000027ab 00000000 00000000 +basic_cpuid[8]=00000000 00000000 00000000 00000000 +basic_cpuid[9]=00000000 00000000 00000000 00000000 +basic_cpuid[10]=07300403 00000000 00000000 00000603 +basic_cpuid[11]=00000001 00000002 00000100 00000001 +basic_cpuid[12]=00000000 00000000 00000000 00000000 +basic_cpuid[13]=00000007 00000340 00000340 00000000 +basic_cpuid[14]=00000007 00000340 00000340 00000000 +basic_cpuid[15]=00000007 00000340 00000340 00000000 +basic_cpuid[16]=00000007 00000340 00000340 00000000 +basic_cpuid[17]=00000007 00000340 00000340 00000000 +basic_cpuid[18]=00000007 00000340 00000340 00000000 +basic_cpuid[19]=00000007 00000340 00000340 00000000 +basic_cpuid[20]=00000007 00000340 00000340 00000000 +basic_cpuid[21]=00000007 00000340 00000340 00000000 +basic_cpuid[22]=00000007 00000340 00000340 00000000 +basic_cpuid[23]=00000007 00000340 00000340 00000000 +basic_cpuid[24]=00000007 00000340 00000340 00000000 +basic_cpuid[25]=00000007 00000340 00000340 00000000 +basic_cpuid[26]=00000007 00000340 00000340 00000000 +basic_cpuid[27]=00000007 00000340 00000340 00000000 +basic_cpuid[28]=00000007 00000340 00000340 00000000 +basic_cpuid[29]=00000007 00000340 00000340 00000000 +basic_cpuid[30]=00000007 00000340 00000340 00000000 +basic_cpuid[31]=00000007 00000340 00000340 00000000 +ext_cpuid[0]=80000008 00000000 00000000 00000000 +ext_cpuid[1]=00000000 00000000 00000021 2c100800 +ext_cpuid[2]=65746e49 2952286c 726f4320 4d542865 +ext_cpuid[3]=33692029 3331342d 50432030 20402055 +ext_cpuid[4]=30342e33 007a4847 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]=00000007 00000340 00000340 00000000 +ext_cpuid[10]=00000007 00000340 00000340 00000000 +ext_cpuid[11]=00000007 00000340 00000340 00000000 +ext_cpuid[12]=00000007 00000340 00000340 00000000 +ext_cpuid[13]=00000007 00000340 00000340 00000000 +ext_cpuid[14]=00000007 00000340 00000340 00000000 +ext_cpuid[15]=00000007 00000340 00000340 00000000 +ext_cpuid[16]=00000007 00000340 00000340 00000000 +ext_cpuid[17]=00000007 00000340 00000340 00000000 +ext_cpuid[18]=00000007 00000340 00000340 00000000 +ext_cpuid[19]=00000007 00000340 00000340 00000000 +ext_cpuid[20]=00000007 00000340 00000340 00000000 +ext_cpuid[21]=00000007 00000340 00000340 00000000 +ext_cpuid[22]=00000007 00000340 00000340 00000000 +ext_cpuid[23]=00000007 00000340 00000340 00000000 +ext_cpuid[24]=00000007 00000340 00000340 00000000 +ext_cpuid[25]=00000007 00000340 00000340 00000000 +ext_cpuid[26]=00000007 00000340 00000340 00000000 +ext_cpuid[27]=00000007 00000340 00000340 00000000 +ext_cpuid[28]=00000007 00000340 00000340 00000000 +ext_cpuid[29]=00000007 00000340 00000340 00000000 +ext_cpuid[30]=00000007 00000340 00000340 00000000 +ext_cpuid[31]=00000007 00000340 00000340 00000000 +intel_fn4[0]=1c004121 01c0003f 0000003f 00000000 +intel_fn4[1]=1c004122 01c0003f 0000003f 00000000 +intel_fn4[2]=1c004143 01c0003f 000001ff 00000000 +intel_fn4[3]=1c03c163 02c0003f 00000fff 00000006 +intel_fn11[0]=00000001 00000002 00000100 00000001 +intel_fn11[1]=00000004 00000004 00000201 00000001 +intel_fn11[2]=00000000 00000000 00000002 00000001 +intel_fn11[3]=00000000 00000000 00000003 00000001 +-------------------------------------------------------------------------------- +6 +12 +3 +6 +60 +2 +4 +32 +32 +256 +3072 +8 +8 +12 +64 +64 +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 lm lahf_lm constant_tsc fma3 f16c rdrand