Report a bug
If you spot a problem with this page, click here to create a GitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

cpuid.x86_any

Common information for all x86 and x86_64 vendors.

This module is compatible with betterC compilation mode.

Note T.max value value is used to represent fully-associative Cache/TLB.

References wikipedia:CPUID

Authors:
Ilya Yaroshenko
export nothrow @nogc void mir_cpuid_x86_any_init();
Initialize basic x86 CPU information. It is safe to call this function multiple times.
union Leaf1Information;

alias cpuid_x86_any_init = mir_cpuid_x86_any_init;
Basic information about CPU.
CpuInfo info;
CPUID payload
const pure nothrow @nogc @property @trusted uint stepping();
Stepping ID
const pure nothrow @nogc @property @trusted uint model();
Model
const pure nothrow @nogc @property @trusted uint family();
Family ID
const pure nothrow @nogc @property @trusted uint type();
Processor Type, Specification: Intel
const pure nothrow @nogc @property @trusted uint extendedModel();
Extended Model ID
const pure nothrow @nogc @property @trusted uint extendedFamily();
Extended Family ID
const ubyte brandIndex;
Brand Index
const ubyte clflushLineSize;
clflush line size
const ubyte maxLogicalProcessors;
maximal number of logical processors
const ubyte initialAPIC;
initial APIC
const pure nothrow @nogc @property @trusted bool sse3();
SSE3 Extensions
const pure nothrow @nogc @property @trusted bool pclmulqdq();
Carryless Multiplication
const pure nothrow @nogc @property @trusted bool dtes64();
64-bit DS Area
const pure nothrow @nogc @property @trusted bool monitor();
MONITOR/MWAIT
const pure nothrow @nogc @property @trusted bool ds_cpl();
(); /// CPL Qualified Debug Store
const pure nothrow @nogc @property @trusted bool vmx();
Virtual Machine Extensions
const pure nothrow @nogc @property @trusted bool smx();
Safer Mode Extensions
const pure nothrow @nogc @property @trusted bool eist();
Enhanced Intel SpeedStep® Technology
const pure nothrow @nogc @property @trusted bool therm_monitor2();
Thermal Monitor 2
const pure nothrow @nogc @property @trusted bool ssse3();
SSSE3 Extensions
const pure nothrow @nogc @property @trusted bool cnxt_id();
L1 Context ID
const pure nothrow @nogc @property @trusted bool sdbg();
const pure nothrow @nogc @property @trusted bool fma();
Fused Multiply Add
const pure nothrow @nogc @property @trusted bool cmpxchg16b();
const pure nothrow @nogc @property @trusted bool xtpr();
TPR Update Control
const pure nothrow @nogc @property @trusted bool pdcm();
Perf/Debug Capability MSR xTPR Update Control
const pure nothrow @nogc @property @trusted bool pcid();
Process-context Identifiers
const pure nothrow @nogc @property @trusted bool dca();
Direct Cache Access
const pure nothrow @nogc @property @trusted bool sse41();
SSE4.1
const pure nothrow @nogc @property @trusted bool sse42();
SSE4.2
const pure nothrow @nogc @property @trusted bool x2apic();
const pure nothrow @nogc @property @trusted bool movbe();
const pure nothrow @nogc @property @trusted bool popcnt();
const pure nothrow @nogc @property @trusted bool tsc_deadline();
const pure nothrow @nogc @property @trusted bool aes();
const pure nothrow @nogc @property @trusted bool xsave();
const pure nothrow @nogc @property @trusted bool osxsave();
const pure nothrow @nogc @property @trusted bool avx();
const pure nothrow @nogc @property @trusted bool f16c();
const pure nothrow @nogc @property @trusted bool rdrand();
const pure nothrow @nogc @property @trusted bool virtual();
const pure nothrow @nogc @property @trusted bool fpu();
x87 FPU on Chip
const pure nothrow @nogc @property @trusted bool vme();
Virtual-8086 Mode Enhancement
const pure nothrow @nogc @property @trusted bool de();
Debugging Extensions
const pure nothrow @nogc @property @trusted bool pse();
Page Size Extensions
const pure nothrow @nogc @property @trusted bool tsc();
Time Stamp Counter
const pure nothrow @nogc @property @trusted bool msr();
RDMSR and WRMSR Support
const pure nothrow @nogc @property @trusted bool pae();
Physical Address Extensions
const pure nothrow @nogc @property @trusted bool mce();
Machine Check Exception
const pure nothrow @nogc @property @trusted bool cx8();
CMPXCHG8B Inst.
const pure nothrow @nogc @property @trusted bool apic();
APIC on Chip
const pure nothrow @nogc @property @trusted bool sep();
SYSENTER and SYSEXIT
const pure nothrow @nogc @property @trusted bool mtrr();
Memory Type Range Registers
const pure nothrow @nogc @property @trusted bool pge();
PTE Global Bit
const pure nothrow @nogc @property @trusted bool mca();
Machine Check Architecture
const pure nothrow @nogc @property @trusted bool cmov();
Conditional Move/Compare Instruction
const pure nothrow @nogc @property @trusted bool pat();
Page Attribute Table
const pure nothrow @nogc @property @trusted bool pse36();
Page Size Extension
const pure nothrow @nogc @property @trusted bool psn();
Processor Serial Number
const pure nothrow @nogc @property @trusted bool clfsh();
CLFLUSH instruction
const pure nothrow @nogc @property @trusted bool ds();
Debug Store
const pure nothrow @nogc @property @trusted bool acpi();
Thermal Monitor and Clock Ctrl
const pure nothrow @nogc @property @trusted bool mmx();
MMX Technology
const pure nothrow @nogc @property @trusted bool fxsr();
FXSAVE/FXRSTOR
const pure nothrow @nogc @property @trusted bool sse();
SSE Extensions
const pure nothrow @nogc @property @trusted bool sse2();
SSE2 Extensions
const pure nothrow @nogc @property @trusted bool self_snoop();
Self Snoop
const pure nothrow @nogc @property @trusted bool htt();
Multi-threading
const pure nothrow @nogc @property @trusted bool therm_monitor();
Therm. Monitor
const pure nothrow @nogc @property @trusted bool pbe();
Pend. Brk. EN.
union Leaf7Information;
Extended information about CPU.
CpuInfo info;
CPUID payload
uint max7SubLeafs;
Reports the maximum input value for supported leaf 7 sub-leaves
const pure nothrow @nogc @property @trusted bool fsgsbase();
Supports RDFSBASE/RDGSBASE/WRFSBASE/WRGSBASE if 1.
const pure nothrow @nogc @property @trusted bool ia32_tsc_adjust();
MSR is supported if 1.
const pure nothrow @nogc @property @trusted bool sgx();
Supports Intel® Software Guard Extensions (Intel® SGX Extensions) if 1.
const pure nothrow @nogc @property @trusted bool bmi1();
Bit Manipulation Instruction Set 1
const pure nothrow @nogc @property @trusted bool hle();
Transactional Synchronization Extensions
const pure nothrow @nogc @property @trusted bool avx2();
Advanced Vector Extensions 2
const pure nothrow @nogc @property @trusted bool fdp_excptn_only();
x87 FPU Data Pointer updated only on x87 exceptions if 1.
const pure nothrow @nogc @property @trusted bool smep();
Supports Supervisor-Mode Execution Prevention if 1.
const pure nothrow @nogc @property @trusted bool bmi2();
Bit Manipulation Instruction Set 2
const pure nothrow @nogc @property @trusted bool supports();
Enhanced REP MOVSB/STOSB if 1.
const pure nothrow @nogc @property @trusted bool invpcid();
If 1, supports INVPCID instruction for system software that manages process-context identifiers.
const pure nothrow @nogc @property @trusted bool rtm();
Transactional Synchronization Extensions
const pure nothrow @nogc @property @trusted bool rdt_m();
Supports Intel® Resource Director Technology (Intel® RDT) Monitoring capability if 1.
const pure nothrow @nogc @property @trusted bool deprecates();
FPU CS and FPU DS values if 1.
const pure nothrow @nogc @property @trusted bool mpx();
Supports Intel® Memory Protection Extensions if 1.
const pure nothrow @nogc @property @trusted bool rdt_a();
Supports Intel® Resource Director Technology (Intel® RDT) Allocation capability if 1.
const pure nothrow @nogc @property @trusted bool avx512f();
AVX-512 Foundation
const pure nothrow @nogc @property @trusted bool avx512dq();
AVX-512 Doubleword and Quadword Instructions
const pure nothrow @nogc @property @trusted bool rdseed();
RDSEED instruction
const pure nothrow @nogc @property @trusted bool adx();
Intel ADX (Multi-Precision Add-Carry Instruction Extensions)
const pure nothrow @nogc @property @trusted bool smap();
Supports Supervisor-Mode Access Prevention (and the CLAC/STAC instructions) if 1.
const pure nothrow @nogc @property @trusted bool avx512ifma();
AVX-512 Integer Fused Multiply-Add Instructions
const pure nothrow @nogc @property @trusted bool pcommit();
PCOMMIT instruction
const pure nothrow @nogc @property @trusted bool clflushopt();
CLFLUSHOPT instruction
const pure nothrow @nogc @property @trusted bool clwb();
CLWB instruction
const pure nothrow @nogc @property @trusted bool intel_pt();
Intel Processor Trace.
const pure nothrow @nogc @property @trusted bool avx512pf();
AVX-512 Prefetch Instructions
const pure nothrow @nogc @property @trusted bool avx512er();
AVX-512 Exponential and Reciprocal Instructions
const pure nothrow @nogc @property @trusted bool avx512cd();
AVX-512 Conflict Detection Instructions
const pure nothrow @nogc @property @trusted bool sha();
supports Intel® Secure Hash Algorithm Extens
const pure nothrow @nogc @property @trusted bool avx512bw();
AVX-512 Byte and Word Instructions
const pure nothrow @nogc @property @trusted bool avx512vl();
AVX-512 Vector Length Extensions
const pure nothrow @nogc @property @trusted bool prefetchwt1();
PREFETCHWT1 instruction
const pure nothrow @nogc @property @trusted bool avx512vbmi();
AVX-512 Vector Bit Manipulation Instructions
const pure nothrow @nogc @property @trusted bool umip();
Supports user-mode instruction prevention if 1
const pure nothrow @nogc @property @trusted bool pku();
Memory Protection Keys for User-mode pages
const pure nothrow @nogc @property @trusted bool ospke();
If 1, OS has set CR4.PKE to enable protection keys (and the RDPKRU/WRPKRU instructions).
const pure nothrow @nogc @property @trusted bool waitpkg();
const pure nothrow @nogc @property @trusted bool avx512vbmi2();
const pure nothrow @nogc @property @trusted bool cet_ss();
Supports CET shadow stack features if 1.
const pure nothrow @nogc @property @trusted bool gfni();
const pure nothrow @nogc @property @trusted bool vaes();
const pure nothrow @nogc @property @trusted bool vpclmulqdq();
const pure nothrow @nogc @property @trusted bool avx512vnni();
const pure nothrow @nogc @property @trusted bool avx512bitalg();
const pure nothrow @nogc @property @trusted bool avx512vpopcntdq();
const pure nothrow @nogc @property @trusted uint mawau();
The value of MAWAU used by the BNDLDX and BNDSTX instructions in 64-bit mode.
const pure nothrow @nogc @property @trusted bool rdpid();
RDPID and IA32_TSC_AUX are available if 1.
const pure nothrow @nogc @property @trusted bool cldemote();
Supports cache line demote if 1.
const pure nothrow @nogc @property @trusted bool movdiri();
Supports MOVDIRI if 1.
const pure nothrow @nogc @property @trusted bool movdir64b();
Supports MOVDIR64B if 1.
const pure nothrow @nogc @property @trusted bool sgx_lc();
Supports SGX Launch Configuration if 1.
struct CpuInfo;
x86 CPU information
uint a;
EAX
uint b;
EBX
uint c;
ECX
uint d;
EDX
pure nothrow @nogc @trusted CpuInfo _cpuid()(uint eax, uint ecx = 0);
Parameters:
uint eax function id
uint ecx sub-function id
immutable(char)[12][] vendors()();
VendorIndex name
Examples:
assert(vendors[VendorIndex.intel] == "GenuineIntel");
VendorIndex vendorIndex()();
VendorIndex encoded value.
VendorIndex virtualVendorIndex()();
VendorIndex encoded value for virtual machine.
uint maxBasicLeaf()();
Maximum Input Value for Basic CPUID Information
uint maxExtendedLeaf()();
Maximum Input Value for Extended CPUID Information
uint max7SubLeafs()();
Reports the maximum input value for supported leaf 7 sub-leaves.
enum VendorIndex: int;
Encoded vendors
intel
Intel
amd
AMD
sis
SiS
umc
UMC
via
VIA
amd_old
early engineering samples of AMD K5 processor
centaur
Centaur (Including some VIA CPU)
cyrix
Cyrix
hygon
Hygon CPU (AMD like)
transmeta
Transmeta
nsc
National Semiconductor
nexgen
NexGen
rise
Rise
transmeta_old
Transmeta
vortex
Vortex
undefined
undefined
kvm
KVM
parallels
Parallels
microsoft
Microsoft Hyper-V or Windows Virtual PC
vmware
VMware
xen
Xen HVM
undefinedvm
undefined virtual machine
size_t brand()(ref char[48] brand);
Brand, e.g. Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz.
Returns:
brand length
Parameters:
char[48] brand fixed length string to initiate
string vendor()();
Vendor, e.g. GenuineIntel.
string virtualVendor()();
Virtual vendor, e.g. GenuineIntel or VMwareVMware.
ubyte brandIndex()();
Brand Index
ubyte clflushLineSize()();
CLFLUSH line size

Note Value ∗ 8 = cache line size in bytes; used also by CLFLUSHOPT.

ubyte maxLogicalProcessors()();
Maximum number of addressable IDs for logical processors in this physical package.
ubyte initialAPIC()();
Initial APIC ID
uint stepping()();
Stepping ID
uint model()();
Model
uint family()();
Family ID
uint type()();
Processor Type, Specification: Intel
uint extendedModel()();
Extended Model ID
uint extendedFamily()();
Extended Family ID
bool sse3()();
SSE3 Extensions
bool pclmulqdq()();
Carryless Multiplication
bool dtes64()();
64-bit DS Area
bool monitor()();
MONITOR/MWAIT
bool ds_cpl()();
CPL Qualified Debug Store
bool vmx()();
Virtual Machine Extensions
bool smx()();
Safer Mode Extensions
bool eist()();
Enhanced Intel SpeedStep® Technology
bool therm_monitor2()();
Thermal Monitor 2
bool ssse3()();
SSSE3 Extensions
bool cnxt_id()();
L1 Context ID
bool sdbg()();
bool fma()();
Fused Multiply Add
bool cmpxchg16b()();
bool xtpr()();
TPR Update Control
bool pdcm()();
Perf/Debug Capability MSR xTPR Update Control
bool pcid()();
Process-context Identifiers
bool dca()();
Direct Cache Access
bool sse41()();
SSE4.1
bool sse42()();
SSE4.2
bool x2apic()();
bool movbe()();
bool popcnt()();
bool tsc_deadline()();
bool aes()();
bool xsave()();
bool osxsave()();
bool avx()();
bool f16c()();
bool rdrand()();
bool virtual()();
Virtual machine
bool fpu()();
x87 FPU on Chip
bool vme()();
Virtual-8086 Mode Enhancement
bool de()();
Debugging Extensions
bool pse()();
Page Size Extensions
bool tsc()();
Time Stamp Counter
bool msr()();
RDMSR and WRMSR Support
bool pae()();
Physical Address Extensions
bool mce()();
Machine Check Exception
bool cx8()();
CMPXCHG8B Inst.
bool apic()();
APIC on Chip
bool sep()();
SYSENTER and SYSEXIT
bool mtrr()();
Memory Type Range Registers
bool pge()();
PTE Global Bit
bool mca()();
Machine Check Architecture
bool cmov()();
Conditional Move/Compare Instruction
bool pat()();
Page Attribute Table
bool pse36()();
Page Size Extension
bool psn()();
Processor Serial Number
bool clfsh()();
CLFLUSH instruction
bool ds()();
Debug Store
bool acpi()();
Thermal Monitor and Clock Ctrl
bool mmx()();
MMX Technology
bool fxsr()();
FXSAVE/FXRSTOR
bool sse()();
SSE Extensions
bool sse2()();
SSE2 Extensions
bool self_snoop()();
Self Snoop
bool htt()();
Multi-threading
bool therm_monitor()();
Therm. Monitor
bool pbe()();
Pend. Brk. EN.
bool fsgsbase()();
Supports RDFSBASE/RDGSBASE/WRFSBASE/WRGSBASE if 1.
bool ia32_tsc_adjust()();
MSR is supported if 1.
bool sgx()();
Supports Intel® Software Guard Extensions (Intel® SGX Extensions) if 1.
bool bmi1()();
Bit Manipulation Instruction Set 1
bool hle()();
Transactional Synchronization Extensions
bool avx2()();
Advanced Vector Extensions 2
bool fdp_excptn_only()();
x87 FPU Data Pointer updated only on x87 exceptions if 1.
bool smep()();
Supports Supervisor-Mode Execution Prevention if 1.
bool bmi2()();
Bit Manipulation Instruction Set 2
bool supports()();
Enhanced REP MOVSB/STOSB if 1.
bool invpcid()();
If 1, supports INVPCID instruction for system software that manages process-context identifiers.
bool rtm()();
Transactional Synchronization Extensions
bool rdt_m()();
Supports Intel® Resource Director Technology (Intel® RDT) Monitoring capability if 1.
bool deprecates()();
FPU CS and FPU DS values if 1.
bool mpx()();
Supports Intel® Memory Protection Extensions if 1.
bool rdt_a()();
Supports Intel® Resource Director Technology (Intel® RDT) Allocation capability if 1.
bool avx512f()();
AVX-512 Foundation
bool avx512dq()();
AVX-512 Doubleword and Quadword Instructions
bool rdseed()();
RDSEED instruction
bool adx()();
Intel ADX (Multi-Precision Add-Carry Instruction Extensions)
bool smap()();
Supports Supervisor-Mode Access Prevention (and the CLAC/STAC instructions) if 1.
bool avx512ifma()();
AVX-512 Integer Fused Multiply-Add Instructions
bool pcommit()();
PCOMMIT instruction
bool clflushopt()();
CLFLUSHOPT instruction
bool clwb()();
CLWB instruction
bool intel_pt()();
Intel Processor Trace.
bool avx512pf()();
AVX-512 Prefetch Instructions
bool avx512er()();
AVX-512 Exponential and Reciprocal Instructions
bool avx512cd()();
AVX-512 Conflict Detection Instructions
bool sha()();
supports Intel® Secure Hash Algorithm Extens
bool avx512bw()();
AVX-512 Byte and Word Instructions
bool avx512vl()();
AVX-512 Vector Length Extensions
bool prefetchwt1()();
PREFETCHWT1 instruction
bool avx512vbmi()();
AVX-512 Vector Bit Manipulation Instructions
bool umip()();
Supports user-mode instruction prevention if 1
bool pku()();
Memory Protection Keys for User-mode pages
bool ospke()();
If 1, OS has set CR4.PKE to enable protection keys (and the RDPKRU/WRPKRU instructions).
bool waitpkg()();
bool avx512vbmi2()();
bool cet_ss()();
Supports CET shadow stack features if 1.
bool gfni()();
bool vaes()();
bool vpclmulqdq()();
bool avx512vnni()();
bool avx512bitalg()();
bool avx512vpopcntdq()();
uint mawau()();
The value of MAWAU used by the BNDLDX and BNDSTX instructions in 64-bit mode.
nothrow @nogc @property bool rdpid();
RDPID and IA32_TSC_AUX are available if 1.
bool cldemote()();
Supports cache line demote if 1.
bool movdiri()();
Supports MOVDIRI if 1.
bool movdir64b()();
Supports MOVDIR64B if 1.
bool sgx_lc()();
Supports SGX Launch Configuration if 1.