~ppsspp/ppsspp/ppsspp_1.3.0

« back to all changes in this revision

Viewing changes to Common/CPUDetect.h

  • Committer: Sérgio Benjamim
  • Date: 2017-01-02 00:12:05 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20170102001205-cxbta9za203nmjwm
1.3.0 source (from ppsspp_1.3.0-r160.p5.l1762.a165.t83~56~ubuntu16.04.1.tar.xz).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2003 Dolphin Project.
 
2
 
 
3
// This program is free software: you can redistribute it and/or modify
 
4
// it under the terms of the GNU General Public License as published by
 
5
// the Free Software Foundation, version 2.0.
 
6
 
 
7
// This program is distributed in the hope that it will be useful,
 
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
// GNU General Public License 2.0 for more details.
 
11
 
 
12
// A copy of the GPL 2.0 should have been included with the program.
 
13
// If not, see http://www.gnu.org/licenses/
 
14
 
 
15
// Official SVN repository and contact information can be found at
 
16
// http://code.google.com/p/dolphin-emu/
 
17
 
 
18
// Detect the cpu, so we'll know which optimizations to use
 
19
#pragma once
 
20
 
 
21
// Every architecture has its own define. This needs to be added to.
 
22
#if defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7S__)
 
23
#define HAVE_ARMV7 1
 
24
#endif
 
25
 
 
26
#include <string>
 
27
 
 
28
enum CPUVendor {
 
29
        VENDOR_INTEL = 0,
 
30
        VENDOR_AMD = 1,
 
31
        VENDOR_ARM = 2,
 
32
        VENDOR_OTHER = 3,
 
33
};
 
34
 
 
35
struct CPUInfo {
 
36
        CPUVendor vendor;
 
37
 
 
38
        char cpu_string[0x21];
 
39
        char brand_string[0x41];
 
40
        bool OS64bit;
 
41
        bool CPU64bit;
 
42
        bool Mode64bit;
 
43
 
 
44
        bool HTT;
 
45
        int num_cores;
 
46
        int logical_cpu_count;
 
47
 
 
48
        bool bSSE;
 
49
        bool bSSE2;
 
50
        bool bSSE3;
 
51
        bool bSSSE3;
 
52
        bool bPOPCNT;
 
53
        bool bSSE4_1;
 
54
        bool bSSE4_2;
 
55
        bool bLZCNT;
 
56
        bool bSSE4A;
 
57
        bool bAVX;
 
58
        bool bAVX2;
 
59
        bool bFMA;
 
60
        bool bAES;
 
61
        bool bLAHFSAHF64;
 
62
        bool bLongMode;
 
63
        bool bAtom;
 
64
        bool bBMI1;
 
65
        bool bBMI2;
 
66
        bool bMOVBE;
 
67
        bool bFXSR;
 
68
 
 
69
        // ARM specific CPUInfo
 
70
        bool bSwp;
 
71
        bool bHalf;
 
72
        bool bThumb;
 
73
        bool bFastMult;
 
74
        bool bVFP;
 
75
        bool bEDSP;
 
76
        bool bThumbEE;
 
77
        bool bNEON;
 
78
        bool bVFPv3;
 
79
        bool bTLS;
 
80
        bool bVFPv4;
 
81
        bool bIDIVa;
 
82
        bool bIDIVt;
 
83
 
 
84
        // ARMv8 specific
 
85
        bool bFP;
 
86
        bool bASIMD;
 
87
 
 
88
        // MIPS specific
 
89
        bool bXBurst1;
 
90
        bool bXBurst2;
 
91
 
 
92
        // Quirks
 
93
        struct {
 
94
                // Samsung Galaxy S7 devices (Exynos 8890) have a big.LITTLE configuration where the cacheline size differs between big and LITTLE.
 
95
                // GCC's cache clearing function would detect the cacheline size on one and keep it for later. When clearing
 
96
                // with the wrong cacheline size on the other, that's an issue. In case we want to do something different in this
 
97
                // situation in the future, let's keep this as a quirk, but our current code won't detect it reliably
 
98
                // if it happens on new archs. We now use better clearing code on ARM64 that doesn't have this issue.
 
99
                bool bExynos8890DifferingCachelineSizes;
 
100
        } sQuirks;
 
101
 
 
102
        // Call Detect()
 
103
        explicit CPUInfo();
 
104
 
 
105
        // Turn the cpu info into a string we can show
 
106
        std::string Summarize();
 
107
 
 
108
private:
 
109
        // Detects the various cpu features
 
110
        void Detect();
 
111
};
 
112
 
 
113
extern CPUInfo cpu_info;