Visual Servoing Platform version 3.5.0
cpu_x86.h
1/* cpu_x86.h
2 *
3 * Author : Alexander J. Yee
4 * Date Created : 04/12/2014
5 * Last Modified : 04/12/2014
6 *
7 */
8
9#pragma once
10#ifndef _cpu_x86_H
11#define _cpu_x86_H
16// Dependencies
17#include <stdint.h>
18#include <string>
19#ifndef DOXYGEN_SHOULD_SKIP_THIS
20namespace FeatureDetector
21{
26struct cpu_x86 {
27 // Vendor
28 bool Vendor_AMD;
29 bool Vendor_Intel;
30
31 // OS Features
32 bool OS_x64;
33 bool OS_AVX;
34 bool OS_AVX512;
35
36 // Misc.
37 bool HW_MMX;
38 bool HW_x64;
39 bool HW_ABM;
40 bool HW_RDRAND;
41 bool HW_BMI1;
42 bool HW_BMI2;
43 bool HW_ADX;
44 bool HW_PREFETCHWT1;
45 bool HW_MPX;
46
47 // SIMD: 128-bit
48 bool HW_SSE;
49 bool HW_SSE2;
50 bool HW_SSE3;
51 bool HW_SSSE3;
52 bool HW_SSE41;
53 bool HW_SSE42;
54 bool HW_SSE4a;
55 bool HW_AES;
56 bool HW_SHA;
57
58 // SIMD: 256-bit
59 bool HW_AVX;
60 bool HW_XOP;
61 bool HW_FMA3;
62 bool HW_FMA4;
63 bool HW_AVX2;
64
65 // SIMD: 512-bit
66 bool HW_AVX512_F;
67 bool HW_AVX512_PF;
68 bool HW_AVX512_ER;
69 bool HW_AVX512_CD;
70 bool HW_AVX512_VL;
71 bool HW_AVX512_BW;
72 bool HW_AVX512_DQ;
73 bool HW_AVX512_IFMA;
74 bool HW_AVX512_VBMI;
75
76public:
77 cpu_x86();
78
79 void print() const;
80
81 static void cpuid(int32_t out[4], int32_t x);
82 static std::string get_vendor_string();
83
84private:
85 void detect_host();
86 static void print(const char *label, bool yes);
87
88 static bool detect_OS_x64();
89 static bool detect_OS_AVX();
90 static bool detect_OS_AVX512();
91};
96} // namespace FeatureDetector{
97#endif
98#endif