2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 21:09:55 -06:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2014-11-13 19:28:27 -07:00
|
|
|
// Detect the CPU, so we'll know which optimizations to use
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
enum CPUVendor
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
VENDOR_INTEL = 0,
|
|
|
|
VENDOR_AMD = 1,
|
|
|
|
VENDOR_ARM = 2,
|
|
|
|
VENDOR_OTHER = 3,
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CPUInfo
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
CPUVendor vendor = VENDOR_INTEL;
|
2013-03-19 19:51:12 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
char cpu_string[0x41] = {};
|
|
|
|
char brand_string[0x21] = {};
|
|
|
|
bool OS64bit = false;
|
|
|
|
bool CPU64bit = false;
|
|
|
|
bool Mode64bit = false;
|
2013-03-19 19:51:12 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
bool HTT = false;
|
|
|
|
int num_cores = 0;
|
|
|
|
int logical_cpu_count = 0;
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
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;
|
2013-03-19 19:51:12 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
// ARMv8 specific
|
|
|
|
bool bFP = false;
|
|
|
|
bool bASIMD = false;
|
|
|
|
bool bCRC32 = false;
|
|
|
|
bool bSHA1 = false;
|
|
|
|
bool bSHA2 = false;
|
2009-02-27 18:26:56 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
// Call Detect()
|
|
|
|
explicit CPUInfo();
|
2013-03-19 19:51:12 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
// Turn the CPU info into a string we can show
|
|
|
|
std::string Summarize();
|
2010-02-24 03:10:48 -07:00
|
|
|
|
|
|
|
private:
|
2016-06-24 02:43:46 -06:00
|
|
|
// Detects the various CPU features
|
|
|
|
void Detect();
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
extern CPUInfo cpu_info;
|