2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-11-14 02:28:27 +00:00
|
|
|
// Detect the CPU, so we'll know which optimizations to use
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2008-08-16 10:41:36 +00:00
|
|
|
#include <string>
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2018-04-01 21:43:40 +00:00
|
|
|
enum class CPUVendor
|
2008-07-12 17:40:22 +00:00
|
|
|
{
|
2018-04-01 21:43:40 +00:00
|
|
|
Intel,
|
|
|
|
AMD,
|
|
|
|
ARM,
|
|
|
|
Other,
|
2008-08-15 20:43:14 +00:00
|
|
|
};
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2008-08-15 20:43:14 +00:00
|
|
|
struct CPUInfo
|
|
|
|
{
|
2022-07-19 04:45:27 +00:00
|
|
|
CPUVendor vendor = CPUVendor::Other;
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2022-07-19 04:45:27 +00:00
|
|
|
std::string cpu_id;
|
|
|
|
std::string model_name;
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2015-07-29 03:39:38 +00:00
|
|
|
bool HTT = false;
|
|
|
|
int num_cores = 0;
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2015-07-29 03:39:38 +00:00
|
|
|
bool bSSE3 = false;
|
|
|
|
bool bSSSE3 = false;
|
|
|
|
bool bSSE4_1 = false;
|
|
|
|
bool bSSE4_2 = false;
|
|
|
|
bool bLZCNT = false;
|
|
|
|
bool bAVX = false;
|
|
|
|
bool bBMI1 = false;
|
|
|
|
bool bBMI2 = false;
|
2022-07-19 04:45:27 +00:00
|
|
|
// PDEP and PEXT are ridiculously slow on AMD Zen1, Zen1+ and Zen2 (Family 17h)
|
|
|
|
bool bBMI2FastParallelBitOps = false;
|
2015-07-29 03:39:38 +00:00
|
|
|
bool bFMA = false;
|
|
|
|
bool bFMA4 = false;
|
|
|
|
bool bAES = false;
|
|
|
|
bool bMOVBE = false;
|
2013-10-24 20:05:53 +00: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 03:39:38 +00:00
|
|
|
bool bFlushToZero = false;
|
|
|
|
bool bAtom = false;
|
|
|
|
bool bCRC32 = false;
|
|
|
|
bool bSHA1 = false;
|
|
|
|
bool bSHA2 = false;
|
2022-07-19 04:45:27 +00:00
|
|
|
|
|
|
|
// ARMv8 specific
|
2021-05-26 12:38:29 +00:00
|
|
|
bool bAFP = false; // Alternate floating-point behavior
|
2009-02-28 01:26:56 +00:00
|
|
|
|
2010-02-24 10:10:48 +00:00
|
|
|
// Call Detect()
|
|
|
|
explicit CPUInfo();
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2022-07-19 04:45:27 +00:00
|
|
|
// The returned string consists of "<model_name>,<cpu_id>,<flag...>"
|
|
|
|
// Where:
|
|
|
|
// model_name and cpud_id may be zero-length
|
|
|
|
// model_name is human-readable marketing name
|
|
|
|
// cpu_id is ':'-delimited string of id info
|
|
|
|
// flags are optionally included if the related feature is supported and reporting its enablement
|
|
|
|
// seems useful to report
|
2008-08-15 20:43:14 +00:00
|
|
|
std::string Summarize();
|
2010-02-24 10:10:48 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void Detect();
|
2008-07-12 17:40:22 +00:00
|
|
|
};
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2008-08-15 20:43:14 +00:00
|
|
|
extern CPUInfo cpu_info;
|