File: CPUDetect.h

package info (click to toggle)
dolphin-emu 5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 28,976 kB
  • ctags: 35,666
  • sloc: cpp: 213,139; java: 6,252; asm: 2,277; xml: 1,998; ansic: 1,514; python: 462; sh: 279; pascal: 247; makefile: 124; perl: 97
file content (77 lines) | stat: -rw-r--r-- 1,567 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright 2008 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.


// Detect the CPU, so we'll know which optimizations to use
#pragma once

#include <string>

enum CPUVendor
{
	VENDOR_INTEL = 0,
	VENDOR_AMD = 1,
	VENDOR_ARM = 2,
	VENDOR_OTHER = 3,
};

struct CPUInfo
{
	CPUVendor vendor = VENDOR_INTEL;

	char cpu_string[0x41] = {};
	char brand_string[0x21] = {};
	bool OS64bit = false;
	bool CPU64bit = false;
	bool Mode64bit = false;

	bool HTT = false;
	int num_cores = 0;
	int logical_cpu_count = 0;

	bool bSSE    = false;
	bool bSSE2   = false;
	bool bSSE3   = false;
	bool bSSSE3  = false;
	bool bPOPCNT = false;
	bool bSSE4_1 = false;
	bool bSSE4_2 = false;
	bool bLZCNT  = false;
	bool bSSE4A  = false;
	bool bAVX    = false;
	bool bAVX2   = false;
	bool bBMI1   = false;
	bool bBMI2   = false;
	bool bFMA    = false;
	bool bFMA4   = false;
	bool bAES    = false;
	// FXSAVE/FXRSTOR
	bool bFXSR   = false;
	bool bMOVBE  = false;
	// This flag indicates that the hardware supports some mode
	// in which denormal inputs _and_ outputs are automatically set to (signed) zero.
	bool bFlushToZero = false;
	bool bLAHFSAHF64 = false;
	bool bLongMode = false;
	bool bAtom = false;

	// ARMv8 specific
	bool bFP    = false;
	bool bASIMD = false;
	bool bCRC32 = false;
	bool bSHA1  = false;
	bool bSHA2  = false;

	// Call Detect()
	explicit CPUInfo();

	// Turn the CPU info into a string we can show
	std::string Summarize();

private:
	// Detects the various CPU features
	void Detect();
};

extern CPUInfo cpu_info;