18 #ifndef hifi_CPUIdent_h
19 #define hifi_CPUIdent_h
30 class CPUIdent_Internal;
38 static std::vector<Feature> getAllFeatures();
40 static std::string Vendor(
void) {
return CPU_Rep.vendor_; }
41 static std::string Brand(
void) {
return CPU_Rep.brand_; }
43 static bool SSE3(
void) {
return CPU_Rep.f_1_ECX_[0]; }
44 static bool PCLMULQDQ(
void) {
return CPU_Rep.f_1_ECX_[1]; }
45 static bool MONITOR(
void) {
return CPU_Rep.f_1_ECX_[3]; }
46 static bool SSSE3(
void) {
return CPU_Rep.f_1_ECX_[9]; }
47 static bool FMA(
void) {
return CPU_Rep.f_1_ECX_[12]; }
48 static bool CMPXCHG16B(
void) {
return CPU_Rep.f_1_ECX_[13]; }
49 static bool SSE41(
void) {
return CPU_Rep.f_1_ECX_[19]; }
50 static bool SSE42(
void) {
return CPU_Rep.f_1_ECX_[20]; }
51 static bool MOVBE(
void) {
return CPU_Rep.f_1_ECX_[22]; }
52 static bool POPCNT(
void) {
return CPU_Rep.f_1_ECX_[23]; }
53 static bool AES(
void) {
return CPU_Rep.f_1_ECX_[25]; }
54 static bool XSAVE(
void) {
return CPU_Rep.f_1_ECX_[26]; }
55 static bool OSXSAVE(
void) {
return CPU_Rep.f_1_ECX_[27]; }
56 static bool AVX(
void) {
return CPU_Rep.f_1_ECX_[28]; }
57 static bool F16C(
void) {
return CPU_Rep.f_1_ECX_[29]; }
58 static bool RDRAND(
void) {
return CPU_Rep.f_1_ECX_[30]; }
60 static bool MSR(
void) {
return CPU_Rep.f_1_EDX_[5]; }
61 static bool CX8(
void) {
return CPU_Rep.f_1_EDX_[8]; }
62 static bool SEP(
void) {
return CPU_Rep.f_1_EDX_[11]; }
63 static bool CMOV(
void) {
return CPU_Rep.f_1_EDX_[15]; }
64 static bool CLFSH(
void) {
return CPU_Rep.f_1_EDX_[19]; }
65 static bool MMX(
void) {
return CPU_Rep.f_1_EDX_[23]; }
66 static bool FXSR(
void) {
return CPU_Rep.f_1_EDX_[24]; }
67 static bool SSE(
void) {
return CPU_Rep.f_1_EDX_[25]; }
68 static bool SSE2(
void) {
return CPU_Rep.f_1_EDX_[26]; }
70 static bool FSGSBASE(
void) {
return CPU_Rep.f_7_EBX_[0]; }
71 static bool BMI1(
void) {
return CPU_Rep.f_7_EBX_[3]; }
72 static bool HLE(
void) {
return CPU_Rep.isIntel_ && CPU_Rep.f_7_EBX_[4]; }
73 static bool AVX2(
void) {
return CPU_Rep.f_7_EBX_[5]; }
74 static bool BMI2(
void) {
return CPU_Rep.f_7_EBX_[8]; }
75 static bool ERMS(
void) {
return CPU_Rep.f_7_EBX_[9]; }
76 static bool INVPCID(
void) {
return CPU_Rep.f_7_EBX_[10]; }
77 static bool RTM(
void) {
return CPU_Rep.isIntel_ && CPU_Rep.f_7_EBX_[11]; }
78 static bool AVX512F(
void) {
return CPU_Rep.f_7_EBX_[16]; }
79 static bool RDSEED(
void) {
return CPU_Rep.f_7_EBX_[18]; }
80 static bool ADX(
void) {
return CPU_Rep.f_7_EBX_[19]; }
81 static bool AVX512PF(
void) {
return CPU_Rep.f_7_EBX_[26]; }
82 static bool AVX512ER(
void) {
return CPU_Rep.f_7_EBX_[27]; }
83 static bool AVX512CD(
void) {
return CPU_Rep.f_7_EBX_[28]; }
84 static bool SHA(
void) {
return CPU_Rep.f_7_EBX_[29]; }
86 static bool PREFETCHWT1(
void) {
return CPU_Rep.f_7_ECX_[0]; }
88 static bool LAHF(
void) {
return CPU_Rep.f_81_ECX_[0]; }
89 static bool LZCNT(
void) {
return CPU_Rep.isIntel_ && CPU_Rep.f_81_ECX_[5]; }
90 static bool ABM(
void) {
return CPU_Rep.isAMD_ && CPU_Rep.f_81_ECX_[5]; }
91 static bool SSE4a(
void) {
return CPU_Rep.isAMD_ && CPU_Rep.f_81_ECX_[6]; }
92 static bool XOP(
void) {
return CPU_Rep.isAMD_ && CPU_Rep.f_81_ECX_[11]; }
93 static bool TBM(
void) {
return CPU_Rep.isAMD_ && CPU_Rep.f_81_ECX_[21]; }
95 static bool SYSCALL(
void) {
return CPU_Rep.isIntel_ && CPU_Rep.f_81_EDX_[11]; }
96 static bool MMXEXT(
void) {
return CPU_Rep.isAMD_ && CPU_Rep.f_81_EDX_[22]; }
97 static bool RDTSCP(
void) {
return CPU_Rep.isIntel_ && CPU_Rep.f_81_EDX_[27]; }
98 static bool _3DNOWEXT(
void) {
return CPU_Rep.isAMD_ && CPU_Rep.f_81_EDX_[30]; }
99 static bool _3DNOW(
void) {
return CPU_Rep.isAMD_ && CPU_Rep.f_81_EDX_[31]; }
102 static const CPUIdent_Internal CPU_Rep;
104 class CPUIdent_Internal {
109 uint32_t nExIds_{ 0 };
112 bool isIntel_{
false };
113 bool isAMD_{
false };
114 std::bitset<32> f_1_ECX_{ 0 };
115 std::bitset<32> f_1_EDX_{ 0 };
116 std::bitset<32> f_7_EBX_{ 0 };
117 std::bitset<32> f_7_ECX_{ 0 };
118 std::bitset<32> f_81_ECX_{ 0 };
119 std::bitset<32> f_81_EDX_{ 0 };