ROOT  6.06/09
Reference Guide
Public Types | Static Public Member Functions | Private Types | Static Private Member Functions | Static Private Attributes | List of all members
ROOT::Vc::CpuId Class Reference

This class is available for x86 / AMD64 systems to read and interpret information about the CPU's capabilities.

Before any of the getter functions may be called, the init() function must have been called. It will be called automatically, but for any function executing before main, you better call CpuId::init() first.

Vc users will most likely not need this class directly, but rely on the isImplementationSupported, bestImplementationSupported, extraInstructionsSupported, and currentImplementationSupported functions.

Definition at line 42 of file cpuid.h.

Public Types

enum  ProcessorType { OriginalOemProcessor = 0, IntelOverDriveProcessor = 1, DualProcessor = 2, IntelReserved = 3 }
 

Static Public Member Functions

static void init ()
 Reads the CPU capabilities and stores them for faster subsequent access. More...
 
static ushort cacheLineSize ()
 Return the cache line size in bits. More...
 
static ProcessorType processorType ()
 Return the ProcessorType. More...
 
static uint processorFamily ()
 Return the family number of the processor (vendor dependent). More...
 
static uint processorModel ()
 Return the model number of the processor (vendor dependent). More...
 
static uint logicalProcessors ()
 Return the number of logical processors. More...
 
static bool isAmd ()
 Return whether the CPU vendor is AMD. More...
 
static bool isIntel ()
 Return whether the CPU vendor is Intel. More...
 
static bool hasSse3 ()
 Return whether the CPU supports SSE3. More...
 
static bool hasPclmulqdq ()
 Return whether the CPU supports the PCLMULQDQ instruction. More...
 
static bool hasMonitor ()
 Return whether the CPU supports the MONITOR/MWAIT instructions. More...
 
static bool hasVmx ()
 Return whether the CPU supports the Virtual Machine Extensions. More...
 
static bool hasSmx ()
 Return whether the CPU supports the Safer Mode Extensions. More...
 
static bool hasEist ()
 Return whether the CPU supports the Enhanced Intel SpeedStep technology. More...
 
static bool hasTm2 ()
 Return whether the CPU supports Thermal Monitor 2. More...
 
static bool hasSsse3 ()
 Return whether the CPU supports SSSE3. More...
 
static bool hasFma ()
 Return whether the CPU supports FMA extensions using YMM state. More...
 
static bool hasCmpXchg16b ()
 Return whether the CPU supports CMPXCHG16B. More...
 
static bool hasPdcm ()
 Return whether the CPU supports the Perfmon and Debug Capability. More...
 
static bool hasDca ()
 Return whether the CPU supports Direct Cache Access: prefetch data from a memory mapped device. More...
 
static bool hasSse41 ()
 Return whether the CPU supports SSE 4.1. More...
 
static bool hasSse42 ()
 Return whether the CPU supports SSE 4.2. More...
 
static bool hasMovbe ()
 Return whether the CPU supports the MOVBE instruction. More...
 
static bool hasPopcnt ()
 Return whether the CPU supports the POPCNT instruction. More...
 
static bool hasAes ()
 Return whether the CPU supports the AESNI instructions. More...
 
static bool hasOsxsave ()
 Return whether the CPU and OS support the XSETBV/XGETBV instructions. More...
 
static bool hasAvx ()
 Return whether the CPU supports AVX. More...
 
static bool hasF16c ()
 Return whether the CPU supports 16-bit floating-point conversion instructions. More...
 
static bool hasRdrand ()
 Return whether the CPU supports the RDRAND instruction. More...
 
static bool hasFpu ()
 Return whether the CPU contains an x87 FPU. More...
 
static bool hasVme ()
 
static bool hasDe ()
 Return whether the CPU contains Debugging Extensions. More...
 
static bool hasPse ()
 Return whether the CPU contains Page Size Extensions. More...
 
static bool hasTsc ()
 Return whether the CPU supports the RDTSC instruction. More...
 
static bool hasMsr ()
 Return whether the CPU supports the Model Specific Registers instructions. More...
 
static bool hasPae ()
 Return whether the CPU supports the Physical Address Extension. More...
 
static bool hasCx8 ()
 Return whether the CPU supports the CMPXCHG8B instruction. More...
 
static bool hasMtrr ()
 Return whether the CPU supports Memory Type Range Registers. More...
 
static bool hasCmov ()
 Return whether the CPU supports CMOV instructions. More...
 
static bool hasClfsh ()
 Return whether the CPU supports the CLFLUSH instruction. More...
 
static bool hasAcpi ()
 Return whether the CPU supports ACPI. More...
 
static bool hasMmx ()
 Return whether the CPU supports MMX. More...
 
static bool hasSse ()
 Return whether the CPU supports SSE. More...
 
static bool hasSse2 ()
 Return whether the CPU supports SSE2. More...
 
static bool hasHtt ()
 
static bool hasSse4a ()
 Return whether the CPU supports SSE4a. More...
 
static bool hasMisAlignSse ()
 Return whether the CPU supports misaligned SSE instructions. More...
 
static bool hasAmdPrefetch ()
 Return whether the CPU supports the AMD prefetchw instruction. More...
 
static bool hasXop ()
 Return whether the CPU supports the XOP instructions. More...
 
static bool hasFma4 ()
 Return whether the CPU supports the FMA4 instructions. More...
 
static bool hasRdtscp ()
 Return whether the CPU supports the RDTSCP instruction. More...
 
static bool has3DNow ()
 
static bool has3DNowExt ()
 
static uint L1Instruction ()
 Return the size of the L1 instruction cache. More...
 
static uint L1Data ()
 Return the size of the L1 data cache. More...
 
static uint L2Data ()
 Return the size of the L2 cache. More...
 
static uint L3Data ()
 Return the size of the L3 cache. More...
 
static ushort L1InstructionLineSize ()
 
static ushort L1DataLineSize ()
 
static ushort L2DataLineSize ()
 
static ushort L3DataLineSize ()
 
static uint L1Associativity ()
 
static uint L2Associativity ()
 
static uint L3Associativity ()
 
static ushort prefetch ()
 

Private Types

typedef unsigned char uchar
 
typedef unsigned short ushort
 
typedef unsigned int uint
 

Static Private Member Functions

static void interpret (uchar byte, bool *checkLeaf4)
 

Static Private Attributes

static uint s_ecx0 = 0
 
static uint s_logicalProcessors = 0
 
static uint s_processorFeaturesC = 0
 
static uint s_processorFeaturesD = 0
 
static uint s_processorFeatures8C = 0
 
static uint s_processorFeatures8D = 0
 
static uint s_L1Instruction = 0
 
static uint s_L1Data = 0
 
static uint s_L2Data = 0
 
static uint s_L3Data = 0
 
static ushort s_L1InstructionLineSize = 0
 
static ushort s_L1DataLineSize = 0
 
static ushort s_L2DataLineSize = 0
 
static ushort s_L3DataLineSize = 0
 
static uint s_L1Associativity = 0
 
static uint s_L2Associativity = 0
 
static uint s_L3Associativity = 0
 
static ushort s_prefetch = 32
 
static uchar s_brandIndex = 0
 
static uchar s_cacheLineSize = 0
 
static uchar s_processorModel = 0
 
static uchar s_processorFamily = 0
 
static ProcessorType s_processorType = CpuId::IntelReserved
 
static bool s_noL2orL3 = false
 

#include <Vc/cpuid.h>

Member Typedef Documentation

typedef unsigned char ROOT::Vc::CpuId::uchar
private

Definition at line 44 of file cpuid.h.

typedef unsigned int ROOT::Vc::CpuId::uint
private

Definition at line 46 of file cpuid.h.

typedef unsigned short ROOT::Vc::CpuId::ushort
private

Definition at line 45 of file cpuid.h.

Member Enumeration Documentation

Enumerator
OriginalOemProcessor 
IntelOverDriveProcessor 
DualProcessor 
IntelReserved 

Definition at line 49 of file cpuid.h.

Member Function Documentation

static ushort ROOT::Vc::CpuId::cacheLineSize ( )
inlinestatic

Return the cache line size in bits.

Definition at line 65 of file cpuid.h.

Referenced by init(), and testMallocAlignment().

static bool ROOT::Vc::CpuId::has3DNow ( )
inlinestatic

Definition at line 164 of file cpuid.h.

static bool ROOT::Vc::CpuId::has3DNowExt ( )
inlinestatic

Definition at line 165 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasAcpi ( )
inlinestatic

Return whether the CPU supports ACPI.

Definition at line 144 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasAes ( )
inlinestatic

Return whether the CPU supports the AESNI instructions.

Definition at line 112 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasAmdPrefetch ( )
inlinestatic

Return whether the CPU supports the AMD prefetchw instruction.

Definition at line 157 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasAvx ( )
inlinestatic

Return whether the CPU supports AVX.

Definition at line 117 of file cpuid.h.

Referenced by ROOT::Vc::bestImplementationSupported(), and ROOT::Vc::isImplementationSupported().

static bool ROOT::Vc::CpuId::hasClfsh ( )
inlinestatic

Return whether the CPU supports the CLFLUSH instruction.

Definition at line 142 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasCmov ( )
inlinestatic

Return whether the CPU supports CMOV instructions.

Definition at line 140 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasCmpXchg16b ( )
inlinestatic

Return whether the CPU supports CMPXCHG16B.

Definition at line 97 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasCx8 ( )
inlinestatic

Return whether the CPU supports the CMPXCHG8B instruction.

Definition at line 136 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasDca ( )
inlinestatic

Return whether the CPU supports Direct Cache Access: prefetch data from a memory mapped device.

Definition at line 101 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasDe ( )
inlinestatic

Return whether the CPU contains Debugging Extensions.

Definition at line 126 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasEist ( )
inlinestatic

Return whether the CPU supports the Enhanced Intel SpeedStep technology.

Definition at line 89 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasF16c ( )
inlinestatic

Return whether the CPU supports 16-bit floating-point conversion instructions.

Definition at line 119 of file cpuid.h.

Referenced by ROOT::Vc::extraInstructionsSupported().

static bool ROOT::Vc::CpuId::hasFma ( )
inlinestatic

Return whether the CPU supports FMA extensions using YMM state.

Definition at line 95 of file cpuid.h.

Referenced by ROOT::Vc::extraInstructionsSupported().

static bool ROOT::Vc::CpuId::hasFma4 ( )
inlinestatic

Return whether the CPU supports the FMA4 instructions.

Definition at line 161 of file cpuid.h.

Referenced by ROOT::Vc::extraInstructionsSupported().

static bool ROOT::Vc::CpuId::hasFpu ( )
inlinestatic

Return whether the CPU contains an x87 FPU.

Definition at line 123 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasHtt ( )
inlinestatic

Definition at line 151 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasMisAlignSse ( )
inlinestatic

Return whether the CPU supports misaligned SSE instructions.

Definition at line 155 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasMmx ( )
inlinestatic

Return whether the CPU supports MMX.

Definition at line 146 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasMonitor ( )
inlinestatic

Return whether the CPU supports the MONITOR/MWAIT instructions.

Definition at line 83 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasMovbe ( )
inlinestatic

Return whether the CPU supports the MOVBE instruction.

Definition at line 107 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasMsr ( )
inlinestatic

Return whether the CPU supports the Model Specific Registers instructions.

Definition at line 132 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasMtrr ( )
inlinestatic

Return whether the CPU supports Memory Type Range Registers.

Definition at line 138 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasOsxsave ( )
inlinestatic

Return whether the CPU and OS support the XSETBV/XGETBV instructions.

Definition at line 115 of file cpuid.h.

Referenced by ROOT::Vc::bestImplementationSupported(), and ROOT::Vc::isImplementationSupported().

static bool ROOT::Vc::CpuId::hasPae ( )
inlinestatic

Return whether the CPU supports the Physical Address Extension.

Definition at line 134 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasPclmulqdq ( )
inlinestatic

Return whether the CPU supports the PCLMULQDQ instruction.

Definition at line 81 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasPdcm ( )
inlinestatic

Return whether the CPU supports the Perfmon and Debug Capability.

Definition at line 99 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasPopcnt ( )
inlinestatic

Return whether the CPU supports the POPCNT instruction.

Definition at line 109 of file cpuid.h.

Referenced by ROOT::Vc::extraInstructionsSupported().

static bool ROOT::Vc::CpuId::hasPse ( )
inlinestatic

Return whether the CPU contains Page Size Extensions.

Definition at line 128 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasRdrand ( )
inlinestatic

Return whether the CPU supports the RDRAND instruction.

Definition at line 121 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasRdtscp ( )
inlinestatic

Return whether the CPU supports the RDTSCP instruction.

Definition at line 163 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasSmx ( )
inlinestatic

Return whether the CPU supports the Safer Mode Extensions.

Definition at line 87 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasSse ( )
inlinestatic

Return whether the CPU supports SSE.

Definition at line 148 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasSse2 ( )
inlinestatic

Return whether the CPU supports SSE2.

Definition at line 150 of file cpuid.h.

Referenced by ROOT::Vc::bestImplementationSupported(), and ROOT::Vc::isImplementationSupported().

static bool ROOT::Vc::CpuId::hasSse3 ( )
inlinestatic

Return whether the CPU supports SSE3.

Definition at line 79 of file cpuid.h.

Referenced by ROOT::Vc::bestImplementationSupported(), and ROOT::Vc::isImplementationSupported().

static bool ROOT::Vc::CpuId::hasSse41 ( )
inlinestatic

Return whether the CPU supports SSE 4.1.

Definition at line 103 of file cpuid.h.

Referenced by ROOT::Vc::bestImplementationSupported(), and ROOT::Vc::isImplementationSupported().

static bool ROOT::Vc::CpuId::hasSse42 ( )
inlinestatic

Return whether the CPU supports SSE 4.2.

Definition at line 105 of file cpuid.h.

Referenced by ROOT::Vc::bestImplementationSupported(), and ROOT::Vc::isImplementationSupported().

static bool ROOT::Vc::CpuId::hasSse4a ( )
inlinestatic

Return whether the CPU supports SSE4a.

Definition at line 153 of file cpuid.h.

Referenced by ROOT::Vc::extraInstructionsSupported().

static bool ROOT::Vc::CpuId::hasSsse3 ( )
inlinestatic

Return whether the CPU supports SSSE3.

Definition at line 93 of file cpuid.h.

Referenced by ROOT::Vc::bestImplementationSupported(), and ROOT::Vc::isImplementationSupported().

static bool ROOT::Vc::CpuId::hasTm2 ( )
inlinestatic

Return whether the CPU supports Thermal Monitor 2.

Definition at line 91 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasTsc ( )
inlinestatic

Return whether the CPU supports the RDTSC instruction.

Definition at line 130 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasVme ( )
inlinestatic

Definition at line 124 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasVmx ( )
inlinestatic

Return whether the CPU supports the Virtual Machine Extensions.

Definition at line 85 of file cpuid.h.

static bool ROOT::Vc::CpuId::hasXop ( )
inlinestatic

Return whether the CPU supports the XOP instructions.

Definition at line 159 of file cpuid.h.

Referenced by ROOT::Vc::extraInstructionsSupported().

void ROOT::Vc::CpuId::init ( )
static

Reads the CPU capabilities and stores them for faster subsequent access.

Will be executed automatically before main, but not necessarily before other functions executing before main.

Definition at line 120 of file cpuid.cpp.

Referenced by ROOT::Vc::bestImplementationSupported(), and ROOT::Vc::isImplementationSupported().

void ROOT::Vc::CpuId::interpret ( uchar  byte,
bool *  checkLeaf4 
)
staticprivate

Definition at line 289 of file cpuid.cpp.

Referenced by init().

static bool ROOT::Vc::CpuId::isAmd ( )
inlinestatic

Return whether the CPU vendor is AMD.

Definition at line 75 of file cpuid.h.

Referenced by init().

static bool ROOT::Vc::CpuId::isIntel ( )
inlinestatic

Return whether the CPU vendor is Intel.

Definition at line 77 of file cpuid.h.

static uint ROOT::Vc::CpuId::L1Associativity ( )
inlinestatic

Definition at line 178 of file cpuid.h.

static uint ROOT::Vc::CpuId::L1Data ( )
inlinestatic

Return the size of the L1 data cache.

Definition at line 169 of file cpuid.h.

static ushort ROOT::Vc::CpuId::L1DataLineSize ( )
inlinestatic

Definition at line 175 of file cpuid.h.

static uint ROOT::Vc::CpuId::L1Instruction ( )
inlinestatic

Return the size of the L1 instruction cache.

Definition at line 167 of file cpuid.h.

static ushort ROOT::Vc::CpuId::L1InstructionLineSize ( )
inlinestatic

Definition at line 174 of file cpuid.h.

static uint ROOT::Vc::CpuId::L2Associativity ( )
inlinestatic

Definition at line 179 of file cpuid.h.

static uint ROOT::Vc::CpuId::L2Data ( )
inlinestatic

Return the size of the L2 cache.

Definition at line 171 of file cpuid.h.

static ushort ROOT::Vc::CpuId::L2DataLineSize ( )
inlinestatic

Definition at line 176 of file cpuid.h.

static uint ROOT::Vc::CpuId::L3Associativity ( )
inlinestatic

Definition at line 180 of file cpuid.h.

static uint ROOT::Vc::CpuId::L3Data ( )
inlinestatic

Return the size of the L3 cache.

Definition at line 173 of file cpuid.h.

static ushort ROOT::Vc::CpuId::L3DataLineSize ( )
inlinestatic

Definition at line 177 of file cpuid.h.

static uint ROOT::Vc::CpuId::logicalProcessors ( )
inlinestatic

Return the number of logical processors.

Definition at line 73 of file cpuid.h.

static ushort ROOT::Vc::CpuId::prefetch ( )
inlinestatic

Definition at line 181 of file cpuid.h.

static uint ROOT::Vc::CpuId::processorFamily ( )
inlinestatic

Return the family number of the processor (vendor dependent).

Definition at line 69 of file cpuid.h.

static uint ROOT::Vc::CpuId::processorModel ( )
inlinestatic

Return the model number of the processor (vendor dependent).

Definition at line 71 of file cpuid.h.

static ProcessorType ROOT::Vc::CpuId::processorType ( )
inlinestatic

Return the ProcessorType.

Definition at line 67 of file cpuid.h.

Member Data Documentation

CpuId::uchar ROOT::Vc::CpuId::s_brandIndex = 0
staticprivate

Definition at line 204 of file cpuid.h.

Referenced by init().

CpuId::uchar ROOT::Vc::CpuId::s_cacheLineSize = 0
staticprivate

Definition at line 205 of file cpuid.h.

Referenced by cacheLineSize(), and init().

CpuId::uint ROOT::Vc::CpuId::s_ecx0 = 0
staticprivate

Definition at line 186 of file cpuid.h.

Referenced by init(), isAmd(), and isIntel().

CpuId::uint ROOT::Vc::CpuId::s_L1Associativity = 0
staticprivate

Definition at line 200 of file cpuid.h.

Referenced by init(), interpret(), and L1Associativity().

CpuId::uint ROOT::Vc::CpuId::s_L1Data = 0
staticprivate

Definition at line 193 of file cpuid.h.

Referenced by init(), interpret(), and L1Data().

CpuId::ushort ROOT::Vc::CpuId::s_L1DataLineSize = 0
staticprivate

Definition at line 197 of file cpuid.h.

Referenced by init(), interpret(), and L1DataLineSize().

CpuId::uint ROOT::Vc::CpuId::s_L1Instruction = 0
staticprivate

Definition at line 192 of file cpuid.h.

Referenced by init(), interpret(), and L1Instruction().

CpuId::ushort ROOT::Vc::CpuId::s_L1InstructionLineSize = 0
staticprivate

Definition at line 196 of file cpuid.h.

Referenced by init(), interpret(), and L1InstructionLineSize().

CpuId::uint ROOT::Vc::CpuId::s_L2Associativity = 0
staticprivate

Definition at line 201 of file cpuid.h.

Referenced by init(), interpret(), and L2Associativity().

CpuId::uint ROOT::Vc::CpuId::s_L2Data = 0
staticprivate

Definition at line 194 of file cpuid.h.

Referenced by init(), interpret(), and L2Data().

CpuId::ushort ROOT::Vc::CpuId::s_L2DataLineSize = 0
staticprivate

Definition at line 198 of file cpuid.h.

Referenced by init(), interpret(), and L2DataLineSize().

CpuId::uint ROOT::Vc::CpuId::s_L3Associativity = 0
staticprivate

Definition at line 202 of file cpuid.h.

Referenced by init(), interpret(), and L3Associativity().

CpuId::uint ROOT::Vc::CpuId::s_L3Data = 0
staticprivate

Definition at line 195 of file cpuid.h.

Referenced by init(), interpret(), and L3Data().

CpuId::ushort ROOT::Vc::CpuId::s_L3DataLineSize = 0
staticprivate

Definition at line 199 of file cpuid.h.

Referenced by init(), interpret(), and L3DataLineSize().

CpuId::uint ROOT::Vc::CpuId::s_logicalProcessors = 0
staticprivate

Definition at line 187 of file cpuid.h.

Referenced by init(), and logicalProcessors().

bool ROOT::Vc::CpuId::s_noL2orL3 = false
staticprivate

Definition at line 209 of file cpuid.h.

Referenced by interpret().

CpuId::ushort ROOT::Vc::CpuId::s_prefetch = 32
staticprivate

Definition at line 203 of file cpuid.h.

Referenced by init(), interpret(), and prefetch().

CpuId::uchar ROOT::Vc::CpuId::s_processorFamily = 0
staticprivate

Definition at line 207 of file cpuid.h.

Referenced by init(), interpret(), and processorFamily().

CpuId::uint ROOT::Vc::CpuId::s_processorFeatures8C = 0
staticprivate

Definition at line 190 of file cpuid.h.

Referenced by hasAmdPrefetch(), hasFma4(), hasMisAlignSse(), hasSse4a(), hasXop(), and init().

CpuId::uint ROOT::Vc::CpuId::s_processorFeatures8D = 0
staticprivate

Definition at line 191 of file cpuid.h.

Referenced by has3DNow(), has3DNowExt(), hasRdtscp(), and init().

CpuId::uint ROOT::Vc::CpuId::s_processorFeaturesC = 0
staticprivate
CpuId::uint ROOT::Vc::CpuId::s_processorFeaturesD = 0
staticprivate
CpuId::uchar ROOT::Vc::CpuId::s_processorModel = 0
staticprivate

Definition at line 206 of file cpuid.h.

Referenced by init(), interpret(), and processorModel().

CpuId::ProcessorType ROOT::Vc::CpuId::s_processorType = CpuId::IntelReserved
staticprivate

Definition at line 208 of file cpuid.h.

Referenced by init(), and processorType().


The documentation for this class was generated from the following files: