32 #include "common/macros.h"
33 namespace Vc_VERSIONED_NAMESPACE
53 typedef unsigned char uchar;
54 typedef unsigned short ushort;
55 typedef unsigned int uint;
59 OriginalOemProcessor = 0,
60 IntelOverDriveProcessor = 1,
74 static inline ushort
cacheLineSize() {
return static_cast<ushort
>(s_cacheLineSize) * 8u; }
84 static inline bool isAmd () {
return s_ecx0 == 0x444D4163; }
86 static inline bool isIntel () {
return s_ecx0 == 0x6C65746E; }
88 static inline bool hasSse3 () {
return s_processorFeaturesC & (1 << 0); }
90 static inline bool hasPclmulqdq() {
return (s_processorFeaturesC & (1 << 1)) != 0; }
92 static inline bool hasMonitor() {
return (s_processorFeaturesC & (1 << 3)) != 0; }
94 static inline bool hasVmx () {
return (s_processorFeaturesC & (1 << 5)) != 0; }
96 static inline bool hasSmx () {
return (s_processorFeaturesC & (1 << 6)) != 0; }
98 static inline bool hasEist () {
return (s_processorFeaturesC & (1 << 7)) != 0; }
100 static inline bool hasTm2 () {
return (s_processorFeaturesC & (1 << 8)) != 0; }
102 static inline bool hasSsse3() {
return (s_processorFeaturesC & (1 << 9)) != 0; }
104 static inline bool hasFma () {
return (s_processorFeaturesC & (1 << 12)) != 0; }
106 static inline bool hasCmpXchg16b() {
return (s_processorFeaturesC & (1 << 13)) != 0; }
108 static inline bool hasPdcm () {
return (s_processorFeaturesC & (1 << 15)) != 0; }
110 static inline bool hasDca() {
return (s_processorFeaturesC & (1 << 18)) != 0; }
112 static inline bool hasSse41() {
return (s_processorFeaturesC & (1 << 19)) != 0; }
114 static inline bool hasSse42() {
return (s_processorFeaturesC & (1 << 20)) != 0; }
116 static inline bool hasMovbe() {
return (s_processorFeaturesC & (1 << 22)) != 0; }
118 static inline bool hasPopcnt(){
return (s_processorFeaturesC & (1 << 23)) != 0; }
121 static inline bool hasAes () {
return (s_processorFeaturesC & (1 << 25)) != 0; }
124 static inline bool hasOsxsave() {
return (s_processorFeaturesC & (1 << 27)) != 0; }
126 static inline bool hasAvx () {
return (s_processorFeaturesC & (1 << 28)) != 0; }
128 static inline bool hasBmi1 () {
return (s_processorFeatures7B& (1 << 3)) != 0; }
130 static inline bool hasHle () {
return (s_processorFeatures7B& (1 << 4)) != 0; }
132 static inline bool hasAvx2 () {
return (s_processorFeatures7B& (1 << 5)) != 0; }
134 static inline bool hasBmi2 () {
return (s_processorFeatures7B& (1 << 8)) != 0; }
136 static inline bool hasRtm () {
return (s_processorFeatures7B& (1 << 11)) != 0; }
139 static inline bool hasAvx512f () {
return (s_processorFeatures7B & (1u << 16)) != 0; }
141 static inline bool hasAvx512dq () {
return (s_processorFeatures7B & (1u << 17)) != 0; }
143 static inline bool hasAvx512ifma() {
return (s_processorFeatures7B & (1u << 21)) != 0; }
145 static inline bool hasAvx512pf () {
return (s_processorFeatures7B & (1u << 26)) != 0; }
147 static inline bool hasAvx512er () {
return (s_processorFeatures7B & (1u << 27)) != 0; }
149 static inline bool hasAvx512cd () {
return (s_processorFeatures7B & (1u << 28)) != 0; }
151 static inline bool hasAvx512bw () {
return (s_processorFeatures7B & (1u << 30)) != 0; }
153 static inline bool hasAvx512vl () {
return (s_processorFeatures7B & (1u << 31)) != 0; }
155 static inline bool hasAvx512vbmi() {
return (s_processorFeatures7C & (1u << 1)) != 0; }
158 static inline bool hasF16c () {
return (s_processorFeaturesC & (1 << 29)) != 0; }
160 static inline bool hasRdrand(){
return (s_processorFeaturesC & (1 << 30)) != 0; }
162 static inline bool hasFpu () {
return (s_processorFeaturesD & (1 << 0)) != 0; }
163 static inline bool hasVme () {
return (s_processorFeaturesD & (1 << 1)) != 0; }
165 static inline bool hasDe () {
return (s_processorFeaturesD & (1 << 2)) != 0; }
167 static inline bool hasPse () {
return (s_processorFeaturesD & (1 << 3)) != 0; }
169 static inline bool hasTsc () {
return (s_processorFeaturesD & (1 << 4)) != 0; }
171 static inline bool hasMsr () {
return (s_processorFeaturesD & (1 << 5)) != 0; }
173 static inline bool hasPae () {
return (s_processorFeaturesD & (1 << 6)) != 0; }
175 static inline bool hasCx8 () {
return (s_processorFeaturesD & (1 << 8)) != 0; }
177 static inline bool hasMtrr () {
return (s_processorFeaturesD & (1 << 12)) != 0; }
179 static inline bool hasCmov () {
return (s_processorFeaturesD & (1 << 15)) != 0; }
181 static inline bool hasClfsh() {
return (s_processorFeaturesD & (1 << 19)) != 0; }
183 static inline bool hasAcpi () {
return (s_processorFeaturesD & (1 << 22)) != 0; }
185 static inline bool hasMmx () {
return (s_processorFeaturesD & (1 << 23)) != 0; }
187 static inline bool hasSse () {
return (s_processorFeaturesD & (1 << 25)) != 0; }
189 static inline bool hasSse2 () {
return (s_processorFeaturesD & (1 << 26)) != 0; }
190 static inline bool hasHtt () {
return (s_processorFeaturesD & (1 << 28)) != 0; }
192 static inline bool hasSse4a() {
return (s_processorFeatures8C & (1 << 6)) != 0; }
194 static inline bool hasMisAlignSse() {
return (s_processorFeatures8C & (1 << 7)) != 0; }
196 static inline bool hasAmdPrefetch() {
return (s_processorFeatures8C & (1 << 8)) != 0; }
198 static inline bool hasXop () {
return (s_processorFeatures8C & (1 << 11)) != 0; }
200 static inline bool hasFma4 () {
return (s_processorFeatures8C & (1 << 16)) != 0; }
202 static inline bool hasRdtscp() {
return (s_processorFeatures8D & (1 << 27)) != 0; }
203 static inline bool has3DNow() {
return (s_processorFeatures8D & (1u << 31)) != 0; }
204 static inline bool has3DNowExt() {
return (s_processorFeatures8D & (1 << 30)) != 0; }
208 static inline uint
L1Data() {
return s_L1Data; }
210 static inline uint
L2Data() {
return s_L2Data; }
212 static inline uint
L3Data() {
return s_L3Data; }
213 static inline ushort L1InstructionLineSize() {
return s_L1InstructionLineSize; }
214 static inline ushort L1DataLineSize() {
return s_L1DataLineSize; }
215 static inline ushort L2DataLineSize() {
return s_L2DataLineSize; }
216 static inline ushort L3DataLineSize() {
return s_L3DataLineSize; }
217 static inline uint L1Associativity() {
return s_L1Associativity; }
218 static inline uint L2Associativity() {
return s_L2Associativity; }
219 static inline uint L3Associativity() {
return s_L3Associativity; }
220 static inline ushort prefetch() {
return s_prefetch; }
223 static void interpret(uchar byte,
bool *checkLeaf4);
226 static uint s_logicalProcessors;
227 static uint s_processorFeaturesC;
228 static uint s_processorFeaturesD;
229 static uint s_processorFeatures7B;
230 static uint s_processorFeatures7C;
231 static uint s_processorFeatures8C;
232 static uint s_processorFeatures8D;
233 static uint s_L1Instruction;
234 static uint s_L1Data;
235 static uint s_L2Data;
236 static uint s_L3Data;
237 static ushort s_L1InstructionLineSize;
238 static ushort s_L1DataLineSize;
239 static ushort s_L2DataLineSize;
240 static ushort s_L3DataLineSize;
241 static uint s_L1Associativity;
242 static uint s_L2Associativity;
243 static uint s_L3Associativity;
244 static ushort s_prefetch;
245 static uchar s_brandIndex;
246 static uchar s_cacheLineSize;
247 static uchar s_processorModel;
248 static uchar s_processorFamily;
249 static ProcessorType s_processorType;
250 static bool s_noL2orL3;
255 #endif // VC_CPUID_H_
static bool hasRtm()
Return whether the CPU supports transactional synchronization extensions.
static uint processorModel()
Return the model number of the processor (vendor dependent).
unsigned char uchar
unsigned char shorthand
static bool hasSmx()
Return whether the CPU supports the Safer Mode Extensions.
unsigned int uint
unsigned int shorthand
static bool isIntel()
Return whether the CPU vendor is Intel.
static bool hasAvx512vl()
Return whether the CPU supports AVX512vl.
static bool hasSse4a()
Return whether the CPU supports SSE4a.
static bool hasF16c()
Return whether the CPU supports 16-bit floating-point conversion instructions.
static bool hasPae()
Return whether the CPU supports the Physical Address Extension.
static bool hasAvx512dq()
Return whether the CPU supports AVX512dq.
static bool hasVmx()
Return whether the CPU supports the Virtual Machine Extensions.
static uint L2Data()
Return the size of the L2 cache.
static bool hasMtrr()
Return whether the CPU supports Memory Type Range Registers.
static bool hasAvx512cd()
Return whether the CPU supports AVX512cd.
static bool hasAvx512f()
Return whether the CPU supports AVX512f.
static bool hasOsxsave()
Return whether the CPU and OS support the XSETBV/XGETBV instructions.
static bool hasPclmulqdq()
Return whether the CPU supports the PCLMULQDQ instruction.
static bool hasMonitor()
Return whether the CPU supports the MONITOR/MWAIT instructions.
static bool isAmd()
Return whether the CPU vendor is AMD.
static bool hasMisAlignSse()
Return whether the CPU supports misaligned SSE instructions.
static bool hasBmi1()
Return whether the CPU supports BMI1.
static bool hasSse3()
Return whether the CPU supports SSE3.
static bool hasPdcm()
Return whether the CPU supports the Perfmon and Debug Capability.
static uint logicalProcessors()
Return the number of logical processors.
static bool hasSse()
Return whether the CPU supports SSE.
static bool hasAcpi()
Return whether the CPU supports ACPI.
static bool hasPse()
Return whether the CPU contains Page Size Extensions.
static bool hasAvx()
Return whether the CPU supports AVX.
static bool hasSse42()
Return whether the CPU supports SSE 4.2.
static bool hasAmdPrefetch()
Return whether the CPU supports the AMD prefetchw instruction.
static uint L3Data()
Return the size of the L3 cache.
static bool hasAvx512ifma()
Return whether the CPU supports AVX512ifma.
static bool hasRdrand()
Return whether the CPU supports the RDRAND instruction.
static bool hasCmov()
Return whether the CPU supports CMOV instructions.
static bool hasClfsh()
Return whether the CPU supports the CLFLUSH instruction.
static bool hasAes()
Return whether the CPU supports the AESNI instructions.
static bool hasRdtscp()
Return whether the CPU supports the RDTSCP instruction.
static bool hasCmpXchg16b()
Return whether the CPU supports CMPXCHG16B.
static bool hasFpu()
Return whether the CPU contains an x87 FPU.
This class is available for x86 / AMD64 systems to read and interpret information about the CPU's cap...
static bool hasMmx()
Return whether the CPU supports MMX.
static bool hasSse2()
Return whether the CPU supports SSE2.
static bool hasAvx512er()
Return whether the CPU supports AVX512er.
static bool hasCx8()
Return whether the CPU supports the CMPXCHG8B instruction.
static uint L1Instruction()
Return the size of the L1 instruction cache.
static bool hasDca()
Return whether the CPU supports Direct Cache Access: prefetch data from a memory mapped device...
static bool hasBmi2()
Return whether the CPU supports BMI2.
static bool hasFma()
Return whether the CPU supports FMA extensions using YMM state.
static bool hasTm2()
Return whether the CPU supports Thermal Monitor 2.
static ProcessorType processorType()
Return the ProcessorType.
static bool hasAvx512pf()
Return whether the CPU supports AVX512pf.
static bool hasXop()
Return whether the CPU supports the XOP instructions.
static bool hasDe()
Return whether the CPU contains Debugging Extensions.
unsigned short ushort
unsigned short shorthand
static bool hasFma4()
Return whether the CPU supports the FMA4 instructions.
static uint processorFamily()
Return the family number of the processor (vendor dependent).
static bool hasTsc()
Return whether the CPU supports the RDTSC instruction.
static bool hasSsse3()
Return whether the CPU supports SSSE3.
static uint L1Data()
Return the size of the L1 data cache.
static bool hasAvx512vbmi()
Return whether the CPU supports AVX512vbmi.
static bool hasPopcnt()
Return whether the CPU supports the POPCNT instruction.
static bool hasEist()
Return whether the CPU supports the Enhanced Intel SpeedStep technology.
static ushort cacheLineSize()
Return the cache line size in bits.
static bool hasSse41()
Return whether the CPU supports SSE 4.1.
static bool hasMsr()
Return whether the CPU supports the Model Specific Registers instructions.
static bool hasAvx2()
Return whether the CPU supports AVX2.
static bool hasHle()
Return whether the CPU supports transactional synchronization extensions.
static bool hasMovbe()
Return whether the CPU supports the MOVBE instruction.
static bool hasAvx512bw()
Return whether the CPU supports AVX512bw.