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 cpuid_x86_any_init();
Initialize basic x86 CPU information. It is safe to call this function multiple times.
union Leaf1Information;
Basic information about CPU.
CpuInfo info;
CPUID payload
pure nothrow @nogc @property @trusted uint stepping();
Stepping ID
pure nothrow @nogc @property @trusted uint model();
Model
pure nothrow @nogc @property @trusted uint family();
Family ID
pure nothrow @nogc @property @trusted uint type();
Processor Type, Specification: Intel
pure nothrow @nogc @property @trusted uint extendedModel();
Extended Model ID
pure nothrow @nogc @property @trusted uint extendedFamily();
Extended Family ID
ubyte brandIndex;
Brand Index
ubyte clflushLineSize;
clflush line size
ubyte maxLogicalProcessors;
maximal number of logical processors
ubyte initialAPIC;
initial APIC
pure nothrow @nogc @property @trusted bool sse3();
SSE3 Extensions
pure nothrow @nogc @property @trusted bool pclmulqdq();
Carryless Multiplication
pure nothrow @nogc @property @trusted bool dtes64();
64-bit DS Area
pure nothrow @nogc @property @trusted bool monitor();
MONITOR/MWAIT
pure nothrow @nogc @property @trusted bool ds_cpl();
(); /// CPL Qualified Debug Store
pure nothrow @nogc @property @trusted bool vmx();
Virtual Machine Extensions
pure nothrow @nogc @property @trusted bool smx();
Safer Mode Extensions
pure nothrow @nogc @property @trusted bool eist();
Enhanced Intel SpeedStep® Technology
pure nothrow @nogc @property @trusted bool therm_monitor2();
Thermal Monitor 2
pure nothrow @nogc @property @trusted bool ssse3();
SSSE3 Extensions
pure nothrow @nogc @property @trusted bool cnxt_id();
L1 Context ID
pure nothrow @nogc @property @trusted bool sdbg();
pure nothrow @nogc @property @trusted bool fma();
Fused Multiply Add
pure nothrow @nogc @property @trusted bool cmpxchg16b();
pure nothrow @nogc @property @trusted bool xtpr();
TPR Update Control
pure nothrow @nogc @property @trusted bool pdcm();
Perf/Debug Capability MSR xTPR Update Control
pure nothrow @nogc @property @trusted bool pcid();
Process-context Identifiers
pure nothrow @nogc @property @trusted bool dca();
Direct Cache Access
pure nothrow @nogc @property @trusted bool sse41();
SSE4.1
pure nothrow @nogc @property @trusted bool sse42();
SSE4.2
pure nothrow @nogc @property @trusted bool x2apic();
pure nothrow @nogc @property @trusted bool movbe();
pure nothrow @nogc @property @trusted bool popcnt();
pure nothrow @nogc @property @trusted bool tsc_deadline();
(
pure nothrow @nogc @property @trusted bool aes();
pure nothrow @nogc @property @trusted bool xsave();
pure nothrow @nogc @property @trusted bool osxsave();
pure nothrow @nogc @property @trusted bool avx();
pure nothrow @nogc @property @trusted bool f16c();
pure nothrow @nogc @property @trusted bool rdrand();
pure nothrow @nogc @property @trusted bool virtual();
pure nothrow @nogc @property @trusted bool fpu();
x87 FPU on Chip
pure nothrow @nogc @property @trusted bool vme();
Virtual-8086 Mode Enhancement
pure nothrow @nogc @property @trusted bool de();
Debugging Extensions
pure nothrow @nogc @property @trusted bool pse();
Page Size Extensions
pure nothrow @nogc @property @trusted bool tsc();
Time Stamp Counter
pure nothrow @nogc @property @trusted bool msr();
RDMSR and WRMSR Support
pure nothrow @nogc @property @trusted bool pae();
Physical Address Extensions
pure nothrow @nogc @property @trusted bool mce();
Machine Check Exception
pure nothrow @nogc @property @trusted bool cx8();
CMPXCHG8B Inst.
pure nothrow @nogc @property @trusted bool apic();
APIC on Chip
pure nothrow @nogc @property @trusted bool sep();
SYSENTER and SYSEXIT
pure nothrow @nogc @property @trusted bool mtrr();
Memory Type Range Registers
pure nothrow @nogc @property @trusted bool pge();
PTE Global Bit
pure nothrow @nogc @property @trusted bool mca();
Machine Check Architecture
pure nothrow @nogc @property @trusted bool cmov();
Conditional Move/Compare Instruction
pure nothrow @nogc @property @trusted bool pat();
Page Attribute Table
pure nothrow @nogc @property @trusted bool pse36();
Page Size Extension
pure nothrow @nogc @property @trusted bool psn();
Processor Serial Number
pure nothrow @nogc @property @trusted bool clfsh();
CLFLUSH instruction
pure nothrow @nogc @property @trusted bool ds();
Debug Store
pure nothrow @nogc @property @trusted bool acpi();
Thermal Monitor and Clock Ctrl
pure nothrow @nogc @property @trusted bool mmx();
MMX Technology
pure nothrow @nogc @property @trusted bool fxsr();
FXSAVE/FXRSTOR
pure nothrow @nogc @property @trusted bool sse();
SSE Extensions
pure nothrow @nogc @property @trusted bool sse2();
SSE2 Extensions
pure nothrow @nogc @property @trusted bool self_snoop();
Self Snoop
pure nothrow @nogc @property @trusted bool htt();
Multi-threading
pure nothrow @nogc @property @trusted bool therm_monitor();
Therm. Monitor
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
pure nothrow @nogc @property @trusted bool fsgsbase();
Supports RDFSBASE/RDGSBASE/WRFSBASE/WRGSBASE if 1.
pure nothrow @nogc @property @trusted bool ia32_tsc_adjust();
MSR is supported if 1.
pure nothrow @nogc @property @trusted bool sgx();
Supports Intel® Software Guard Extensions (Intel® SGX Extensions) if 1.
pure nothrow @nogc @property @trusted bool bmi1();
Bit Manipulation Instruction Set 1
pure nothrow @nogc @property @trusted bool hle();
Transactional Synchronization Extensions
pure nothrow @nogc @property @trusted bool avx2();
Advanced Vector Extensions 2
pure nothrow @nogc @property @trusted bool fdp_excptn_only();
x87 FPU Data Pointer updated only on x87 exceptions if 1.
pure nothrow @nogc @property @trusted bool smep();
Supports Supervisor-Mode Execution Prevention if 1.
pure nothrow @nogc @property @trusted bool bmi2();
Bit Manipulation Instruction Set 2
pure nothrow @nogc @property @trusted bool supports();
Enhanced REP MOVSB/STOSB if 1.
pure nothrow @nogc @property @trusted bool invpcid();
If 1, supports INVPCID instruction for system software that manages process-context identifiers.
pure nothrow @nogc @property @trusted bool rtm();
Transactional Synchronization Extensions
pure nothrow @nogc @property @trusted bool rdt_m();
Supports Intel® Resource Director Technology (Intel® RDT) Monitoring capability if 1.
pure nothrow @nogc @property @trusted bool deprecates();
FPU CS and FPU DS values if 1.
pure nothrow @nogc @property @trusted bool mpx();
Supports Intel® Memory Protection Extensions if 1.
pure nothrow @nogc @property @trusted bool rdt_a();
Supports Intel® Resource Director Technology (Intel® RDT) Allocation capability if 1.
pure nothrow @nogc @property @trusted bool avx512f();
AVX-512 Foundation
pure nothrow @nogc @property @trusted bool avx512dq();
AVX-512 Doubleword and Quadword Instructions
pure nothrow @nogc @property @trusted bool rdseed();
RDSEED instruction
pure nothrow @nogc @property @trusted bool adx();
Intel ADX (Multi-Precision Add-Carry Instruction Extensions)
pure nothrow @nogc @property @trusted bool smap();
Supports Supervisor-Mode Access Prevention (and the CLAC/STAC instructions) if 1.
pure nothrow @nogc @property @trusted bool avx512ifma();
AVX-512 Integer Fused Multiply-Add Instructions
pure nothrow @nogc @property @trusted bool pcommit();
PCOMMIT instruction
pure nothrow @nogc @property @trusted bool clflushopt();
CLFLUSHOPT instruction
pure nothrow @nogc @property @trusted bool clwb();
CLWB instruction
pure nothrow @nogc @property @trusted bool intel_pt();
Intel Processor Trace.
pure nothrow @nogc @property @trusted bool avx512pf();
AVX-512 Prefetch Instructions
pure nothrow @nogc @property @trusted bool avx512er();
AVX-512 Exponential and Reciprocal Instructions
pure nothrow @nogc @property @trusted bool avx512cd();
AVX-512 Conflict Detection Instructions
pure nothrow @nogc @property @trusted bool sha();
supports Intel® Secure Hash Algorithm Extens
pure nothrow @nogc @property @trusted bool avx512bw();
AVX-512 Byte and Word Instructions
pure nothrow @nogc @property @trusted bool avx512vl();
AVX-512 Vector Length Extensions
pure nothrow @nogc @property @trusted bool prefetchwt1();
PREFETCHWT1 instruction
pure nothrow @nogc @property @trusted bool avx512vbmi();
AVX-512 Vector Bit Manipulation Instructions
pure nothrow @nogc @property @trusted bool pku();
Memory Protection Keys for User-mode pages
pure nothrow @nogc @property @trusted bool ospke();
PKU enabled by OS
struct CpuInfo;
x86 CPU information
uint a;
EAX
uint b;
EBX
uint c;
ECX
uint d;
EDX
pure nothrow @nogc CpuInfo _cpuid(uint eax, uint ecx = 0);
Parameters:
info information received from CPUID instruction
uint eax function id
uint ecx sub-function id
nothrow @nogc @property immutable(char)[12][] vendors();
VendorIndex name
Examples:
assert(vendors[VendorIndex.intel] == "GenuineIntel");
nothrow @nogc @property VendorIndex vendorIndex();
VendorIndex encoded value.
nothrow @nogc @property VendorIndex virtualVendorIndex();
VendorIndex encoded value for virtual machine.
nothrow @nogc @property uint maxBasicLeaf();
Maximum Input Value for Basic CPUID Information
nothrow @nogc @property uint maxExtendedLeaf();
Maximum Input Value for Extended CPUID Information
nothrow @nogc @property 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
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
nothrow @nogc @property 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
nothrow @nogc @property string vendor();
Vendor, e.g. GenuineIntel.
nothrow @nogc @property string virtualVendor();
Virtual vendor, e.g. GenuineIntel or VMwareVMware.
nothrow @nogc @property ubyte brandIndex();
Brand Index
nothrow @nogc @property ubyte clflushLineSize();
CLFLUSH line size

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

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