2015-05-24 06:55:12 +02:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-18 01:08:10 +02:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 05:09:55 +02:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2014-11-14 03:28:27 +01:00
|
|
|
// Detect the CPU, so we'll know which optimizations to use
|
2014-02-10 19:54:46 +01:00
|
|
|
#pragma once
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2008-08-16 12:41:36 +02:00
|
|
|
#include <string>
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2018-04-01 23:43:40 +02:00
|
|
|
enum class CPUVendor
|
2008-07-12 19:40:22 +02:00
|
|
|
{
|
2018-04-01 23:43:40 +02:00
|
|
|
Intel,
|
|
|
|
AMD,
|
|
|
|
ARM,
|
|
|
|
Other,
|
2008-08-15 22:43:14 +02:00
|
|
|
};
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2008-08-15 22:43:14 +02:00
|
|
|
struct CPUInfo
|
|
|
|
{
|
2018-04-01 23:43:40 +02:00
|
|
|
CPUVendor vendor = CPUVendor::Intel;
|
2013-03-20 02:51:12 +01:00
|
|
|
|
2015-07-29 05:39:38 +02:00
|
|
|
char cpu_string[0x41] = {};
|
|
|
|
char brand_string[0x21] = {};
|
|
|
|
bool OS64bit = false;
|
|
|
|
bool CPU64bit = false;
|
|
|
|
bool Mode64bit = false;
|
2013-03-20 02:51:12 +01:00
|
|
|
|
2015-07-29 05:39:38 +02:00
|
|
|
bool HTT = false;
|
|
|
|
int num_cores = 0;
|
|
|
|
int logical_cpu_count = 0;
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2015-07-29 05:39:38 +02: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;
|
2020-11-08 14:27:24 +01:00
|
|
|
// PDEP and PEXT are ridiculously slow on AMD Zen1, Zen1+ and Zen2 (Family 23)
|
2020-01-27 04:08:55 +01:00
|
|
|
bool bFastBMI2 = false;
|
2015-07-29 05:39:38 +02:00
|
|
|
bool bFMA = false;
|
|
|
|
bool bFMA4 = false;
|
|
|
|
bool bAES = false;
|
2013-10-24 13:52:22 +02:00
|
|
|
// FXSAVE/FXRSTOR
|
2015-07-29 05:39:38 +02:00
|
|
|
bool bFXSR = false;
|
|
|
|
bool bMOVBE = false;
|
2013-10-24 22:05:53 +02:00
|
|
|
// This flag indicates that the hardware supports some mode
|
|
|
|
// in which denormal inputs _and_ outputs are automatically set to (signed) zero.
|
2015-07-29 05:39:38 +02:00
|
|
|
bool bFlushToZero = false;
|
|
|
|
bool bLAHFSAHF64 = false;
|
|
|
|
bool bLongMode = false;
|
|
|
|
bool bAtom = false;
|
2020-11-08 14:27:24 +01:00
|
|
|
bool bZen1p2 = false;
|
2013-03-20 02:51:12 +01:00
|
|
|
|
2013-02-26 20:49:00 +01:00
|
|
|
// ARMv8 specific
|
2015-07-29 05:39:38 +02:00
|
|
|
bool bFP = false;
|
|
|
|
bool bASIMD = false;
|
|
|
|
bool bCRC32 = false;
|
|
|
|
bool bSHA1 = false;
|
|
|
|
bool bSHA2 = false;
|
2021-05-26 14:38:29 +02:00
|
|
|
bool bAFP = false; // Alternate floating-point behavior
|
2009-02-28 02:26:56 +01:00
|
|
|
|
2010-02-24 11:10:48 +01:00
|
|
|
// Call Detect()
|
|
|
|
explicit CPUInfo();
|
2013-03-20 02:51:12 +01:00
|
|
|
|
2014-11-14 03:28:27 +01:00
|
|
|
// Turn the CPU info into a string we can show
|
2008-08-15 22:43:14 +02:00
|
|
|
std::string Summarize();
|
2010-02-24 11:10:48 +01:00
|
|
|
|
|
|
|
private:
|
2014-11-14 03:28:27 +01:00
|
|
|
// Detects the various CPU features
|
2010-02-24 11:10:48 +01:00
|
|
|
void Detect();
|
2008-07-12 19:40:22 +02:00
|
|
|
};
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2008-08-15 22:43:14 +02:00
|
|
|
extern CPUInfo cpu_info;
|