26 constexpr static uint32_t processor_type_OEM = 0;
27 constexpr static uint32_t processor_type_Intel_overdrive = 1;
28 constexpr static uint32_t processor_type_dual_processor = 2;
33 uint32_t stepping_id:4 = 0;
34 uint32_t model_id:8 = 0;
35 uint32_t family_id:9 = 0;
36 uint32_t processor_type:2 = 0;
38 uint64_t features = 0;
41 size_t cache_flush_size = 0;
54 hilet
leaf0 = get_leaf(0);
65 hilet
leaf1 = get_leaf(1);
67 stepping_id =
leaf1.a & 0xf;
68 model_id = (
leaf1.a >> 4) & 0xf;
69 family_id = (
leaf1.a >> 8) & 0xf;
70 processor_type = (
leaf1.a >> 12) & 0x3;
72 if (family_id == 0x6
or family_id == 0xf) {
74 model_id |= ((
leaf1.a >> 16) & 0xf) << 4;
76 if (family_id == 0xf) {
78 family_id += (
leaf1.a >> 20) & 0xff;
82 cache_flush_size = ((
leaf1.b >> 8) & 0xff) * 8;
93 return to_bool(instruction_set & instruction_set_aesni);
98 return to_bool(instruction_set & instruction_set_avx);
103 return to_bool(instruction_set & instruction_set_cmpxchg16b);
108 return to_bool(instruction_set & instruction_set_clfsh);
113 return to_bool(instruction_set & instruction_set_cmov);
118 return to_bool(instruction_set & instruction_set_cx8);
123 return to_bool(instruction_set & instruction_set_fma);
128 return to_bool(instruction_set & instruction_set_f16c);
133 return to_bool(instruction_set & instruction_set_fxsr);
138 return to_bool(instruction_set & instruction_set_sse);
143 return to_bool(instruction_set & instruction_set_sse2);
148 return to_bool(instruction_set & instruction_set_sse3);
153 return to_bool(instruction_set & instruction_set_ssse3);
158 return to_bool(instruction_set & instruction_set_sse4_1);
163 return to_bool(instruction_set & instruction_set_sse4_2);
168 return to_bool(instruction_set & instruction_set_movbe);
173 return to_bool(instruction_set & instruction_set_mmx);
178 return to_bool(instruction_set & instruction_set_msr);
183 return to_bool(instruction_set & instruction_set_osxsave);
188 return to_bool(instruction_set & instruction_set_pclmulqdq);
193 return to_bool(instruction_set & instruction_set_popcnt);
198 return to_bool(instruction_set & instruction_set_rdrand);
203 return to_bool(instruction_set & instruction_set_sep);
208 return to_bool(instruction_set & instruction_set_tsc);
213 return to_bool(instruction_set & instruction_set_xsave);
218 return to_bool(features & features_acpi);
223 return to_bool(features & features_apic);
228 return to_bool(features & features_cnxt_id);
233 return to_bool(features & features_dca);
238 return to_bool(features & features_de);
243 return to_bool(features & features_ds);
248 return to_bool(features & features_ds_cpl);
253 return to_bool(features & features_dtes64);
258 return to_bool(features & features_eist);
263 return to_bool(features & features_fpu);
268 return to_bool(features & features_htt);
273 return to_bool(features & features_mca);
278 return to_bool(features & features_mce);
283 return to_bool(features & features_monitor);
288 return to_bool(features & features_mttr);
293 return to_bool(features & features_pae);
298 return to_bool(features & features_pat);
303 return to_bool(features & features_pbe);
308 return to_bool(features & features_pcid);
313 return to_bool(features & features_pdcm);
318 return to_bool(features & features_pge);
323 return to_bool(features & features_pse);
328 return to_bool(features & features_pse_36);
338 return to_bool(features & features_sdbg);
343 return to_bool(features & features_smx);
348 return to_bool(features & features_ss);
353 return to_bool(features & features_tm);
358 return to_bool(features & features_tm2);
363 return to_bool(features & features_tsc_deadline);
368 return to_bool(features & features_vme);
373 return to_bool(features & features_vmx);
378 return to_bool(features & features_x2apic);
383 return to_bool(features & features_xtpr);
388 constexpr static uint64_t instruction_set_aesni = 0x0000'0000'0000'0001;
389 constexpr static uint64_t instruction_set_avx = 0x0000'0000'0000'0002;
390 constexpr static uint64_t instruction_set_cmpxchg16b = 0x0000'0000'0000'0004;
391 constexpr static uint64_t instruction_set_clfsh = 0x0000'0000'0000'0008;
392 constexpr static uint64_t instruction_set_cmov = 0x0000'0000'0000'0010;
393 constexpr static uint64_t instruction_set_cx8 = 0x0000'0000'0000'0020;
394 constexpr static uint64_t instruction_set_fma = 0x0000'0000'0000'0040;
395 constexpr static uint64_t instruction_set_f16c = 0x0000'0000'0000'0080;
396 constexpr static uint64_t instruction_set_fxsr = 0x0000'0000'0000'0100;
397 constexpr static uint64_t instruction_set_sse = 0x0000'0000'0000'0200;
398 constexpr static uint64_t instruction_set_sse2 = 0x0000'0000'0000'0300;
399 constexpr static uint64_t instruction_set_sse3 = 0x0000'0000'0000'0800;
400 constexpr static uint64_t instruction_set_ssse3 = 0x0000'0000'0000'1000;
401 constexpr static uint64_t instruction_set_sse4_1 = 0x0000'0000'0000'2000;
402 constexpr static uint64_t instruction_set_sse4_2 = 0x0000'0000'0000'4000;
403 constexpr static uint64_t instruction_set_movbe = 0x0000'0000'0000'8000;
404 constexpr static uint64_t instruction_set_mmx = 0x0000'0000'0001'0000;
405 constexpr static uint64_t instruction_set_msr = 0x0000'0000'0002'0000;
406 constexpr static uint64_t instruction_set_osxsave = 0x0000'0000'0004'0000;
407 constexpr static uint64_t instruction_set_pclmulqdq = 0x0000'0000'0008'0000;
408 constexpr static uint64_t instruction_set_popcnt = 0x0000'0000'0010'0000;
409 constexpr static uint64_t instruction_set_rdrand = 0x0000'0000'0020'0000;
410 constexpr static uint64_t instruction_set_sep = 0x0000'0000'0040'0000;
411 constexpr static uint64_t instruction_set_tsc = 0x0000'0000'0080'0000;
412 constexpr static uint64_t instruction_set_xsave = 0x0000'0000'0100'0000;
414 constexpr static uint64_t features_acpi = 0x0000'0000'0000'0001;
415 constexpr static uint64_t features_apic = 0x0000'0000'0000'0002;
416 constexpr static uint64_t features_cnxt_id = 0x0000'0000'0000'0004;
417 constexpr static uint64_t features_dca = 0x0000'0000'0000'0008;
418 constexpr static uint64_t features_de = 0x0000'0000'0000'0010;
419 constexpr static uint64_t features_ds = 0x0000'0000'0000'0020;
420 constexpr static uint64_t features_ds_cpl = 0x0000'0000'0000'0040;
421 constexpr static uint64_t features_dtes64 = 0x0000'0000'0000'0080;
422 constexpr static uint64_t features_eist = 0x0000'0000'0000'0100;
423 constexpr static uint64_t features_fpu = 0x0000'0000'0000'0200;
424 constexpr static uint64_t features_htt = 0x0000'0000'0000'0400;
425 constexpr static uint64_t features_mca = 0x0000'0000'0000'0800;
426 constexpr static uint64_t features_mce = 0x0000'0000'0000'1000;
427 constexpr static uint64_t features_monitor = 0x0000'0000'0000'2000;
428 constexpr static uint64_t features_mttr = 0x0000'0000'0000'4000;
429 constexpr static uint64_t features_pae = 0x0000'0000'0000'8000;
430 constexpr static uint64_t features_pat = 0x0000'0000'0001'0000;
431 constexpr static uint64_t features_pbe = 0x0000'0000'0002'0000;
432 constexpr static uint64_t features_pcid = 0x0000'0000'0004'0000;
433 constexpr static uint64_t features_pdcm = 0x0000'0000'0008'0000;
434 constexpr static uint64_t features_pge = 0x0000'0000'0010'0000;
435 constexpr static uint64_t features_pse = 0x0000'0000'0020'0000;
436 constexpr static uint64_t features_pse_36 = 0x0000'0000'0040'0000;
437 constexpr static uint64_t features_psn = 0x0000'0000'0080'0000;
438 constexpr static uint64_t features_sdbg = 0x0000'0000'0100'0000;
439 constexpr static uint64_t features_smx = 0x0000'0000'0200'0000;
440 constexpr static uint64_t features_ss = 0x0000'0000'0400'0000;
441 constexpr static uint64_t features_tm = 0x0000'0000'0800'0000;
442 constexpr static uint64_t features_tm2 = 0x0000'0000'1000'0000;
443 constexpr static uint64_t features_tsc_deadline = 0x0000'0000'2000'0000;
444 constexpr static uint64_t features_vme = 0x0000'0000'4000'0000;
445 constexpr static uint64_t features_vmx = 0x0000'0000'8000'0000;
446 constexpr static uint64_t features_x2apic = 0x0000'0001'0000'0000;
447 constexpr static uint64_t features_xtpr = 0x0000'0002'0000'0000;
450 uint32_t instruction_set = 0;
451 uint64_t features = 0;
460#if HI_COMPILER == HI_CC_MSVC
473#elif HI_COMPILER == HI_CC_GCC || HI_COMPILER == HI_CC_CLANG
483#error "Unsuported compiler for x64 cpu_id"