2013-04-17 21:09:55 -06:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
|
2009-02-27 18:26:56 -07:00
|
|
|
// Detect the cpu, so we'll know which optimizations to use
|
2009-03-28 02:57:34 -06:00
|
|
|
#ifndef _CPUDETECT_H_
|
|
|
|
#define _CPUDETECT_H_
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
enum CPUVendor
|
|
|
|
{
|
|
|
|
VENDOR_INTEL = 0,
|
|
|
|
VENDOR_AMD = 1,
|
2013-02-26 12:49:00 -07:00
|
|
|
VENDOR_ARM = 2,
|
|
|
|
VENDOR_OTHER = 3,
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CPUInfo
|
|
|
|
{
|
|
|
|
CPUVendor vendor;
|
2013-03-19 19:51:12 -06:00
|
|
|
|
2008-12-07 21:46:09 -07:00
|
|
|
char cpu_string[0x21];
|
|
|
|
char brand_string[0x41];
|
|
|
|
bool OS64bit;
|
|
|
|
bool CPU64bit;
|
|
|
|
bool Mode64bit;
|
2013-03-19 19:51:12 -06:00
|
|
|
|
2011-01-29 14:13:56 -07:00
|
|
|
bool HTT;
|
2008-12-07 21:46:09 -07:00
|
|
|
int num_cores;
|
2010-12-18 11:23:22 -07:00
|
|
|
int logical_cpu_count;
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
bool bSSE;
|
|
|
|
bool bSSE2;
|
|
|
|
bool bSSE3;
|
|
|
|
bool bSSSE3;
|
|
|
|
bool bPOPCNT;
|
|
|
|
bool bSSE4_1;
|
|
|
|
bool bSSE4_2;
|
|
|
|
bool bLZCNT;
|
|
|
|
bool bSSE4A;
|
2011-01-26 14:27:26 -07:00
|
|
|
bool bAVX;
|
2013-11-12 20:46:34 -07:00
|
|
|
bool bFMA;
|
2011-01-26 14:27:26 -07:00
|
|
|
bool bAES;
|
2013-10-24 05:52:22 -06:00
|
|
|
// FXSAVE/FXRSTOR
|
|
|
|
bool bFXSR;
|
|
|
|
bool bDAZ;
|
2008-12-07 21:46:09 -07:00
|
|
|
bool bLAHFSAHF64;
|
|
|
|
bool bLongMode;
|
2013-03-19 19:51:12 -06:00
|
|
|
|
2013-02-26 12:49:00 -07:00
|
|
|
// ARM specific CPUInfo
|
|
|
|
bool bSwp;
|
|
|
|
bool bHalf;
|
|
|
|
bool bThumb;
|
|
|
|
bool bFastMult;
|
|
|
|
bool bVFP;
|
|
|
|
bool bEDSP;
|
|
|
|
bool bThumbEE;
|
|
|
|
bool bNEON;
|
|
|
|
bool bVFPv3;
|
|
|
|
bool bTLS;
|
|
|
|
bool bVFPv4;
|
|
|
|
bool bIDIVa;
|
|
|
|
bool bIDIVt;
|
|
|
|
bool bArmV7; // enable MOVT, MOVW etc
|
2013-03-19 19:51:12 -06:00
|
|
|
|
2013-02-26 12:49:00 -07:00
|
|
|
// ARMv8 specific
|
|
|
|
bool bFP;
|
|
|
|
bool bASIMD;
|
2009-02-27 18:26:56 -07:00
|
|
|
|
2010-02-24 03:10:48 -07:00
|
|
|
// Call Detect()
|
|
|
|
explicit CPUInfo();
|
2013-03-19 19:51:12 -06:00
|
|
|
|
2009-02-27 18:26:56 -07:00
|
|
|
// Turn the cpu info into a string we can show
|
2008-12-07 21:46:09 -07:00
|
|
|
std::string Summarize();
|
2010-02-24 03:10:48 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Detects the various cpu features
|
|
|
|
void Detect();
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
extern CPUInfo cpu_info;
|
|
|
|
|
2009-03-28 02:57:34 -06:00
|
|
|
#endif // _CPUDETECT_H_
|