CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Common/CPUDetect.h
Views: 1401
// Copyright (C) 2003 Dolphin Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official SVN repository and contact information can be found at15// http://code.google.com/p/dolphin-emu/1617// Detect the cpu, so we'll know which optimizations to use18#pragma once1920#include "ppsspp_config.h"21#include <string>22#include <vector>2324enum CPUVendor {25VENDOR_INTEL = 0,26VENDOR_AMD = 1,27VENDOR_ARM = 2,28VENDOR_OTHER = 3,29};3031struct CPUInfo {32CPUVendor vendor;3334// Misc35char cpu_string[0x21];36char brand_string[0x41];37bool OS64bit;38bool CPU64bit;39bool Mode64bit;4041bool HTT;4243// Number of real CPU cores.44int num_cores;45// Number of logical CPUs per core.46int logical_cpu_count;4748bool bAtom;49bool bPOPCNT;50bool bLAHFSAHF64;51bool bLongMode;52bool bMOVBE;53bool bFXSR;54bool bLZCNT;55bool bBMI1;56bool bBMI2;57bool bBMI2_fast;58bool bXOP;59bool bRTM;6061// x86 : SIMD 128 bit62bool bSSE;63bool bSSE2;64bool bSSE3;65bool bSSSE3;66bool bSSE4_1;67bool bSSE4_2;68bool bSSE4A;69bool bAES;70bool bSHA;71bool bF16C;72// x86 : SIMD 256 bit73bool bAVX;74bool bAVX2;75bool bFMA3;76bool bFMA4;7778// ARM specific CPUInfo79bool bSwp;80bool bHalf;81bool bThumb;82bool bFastMult;83bool bVFP;84bool bEDSP;85bool bThumbEE;86bool bNEON;87bool bVFPv3;88bool bTLS;89bool bVFPv4;90bool bIDIVa;91bool bIDIVt;9293// ARMv8 specific94bool bFP;95bool bASIMD;96bool bSVE;97bool bSVE2;98bool bFRINT;99100// MIPS specific101bool bXBurst1;102bool bXBurst2;103104// RiscV specific extension flags.105bool RiscV_M;106bool RiscV_A;107bool RiscV_F;108bool RiscV_D;109bool RiscV_C;110bool RiscV_V;111bool RiscV_Zicsr;112bool RiscV_Zba;113bool RiscV_Zbb;114bool RiscV_Zbc;115bool RiscV_Zbs;116bool RiscV_Zcb;117bool RiscV_Zfa;118bool RiscV_Zfh;119bool RiscV_Zfhmin;120bool RiscV_Zicond;121bool RiscV_Zvbb;122bool RiscV_Zvkb;123124// LoongArch specific extension flags.125bool LOONGARCH_CPUCFG;126bool LOONGARCH_LAM;127bool LOONGARCH_UAL;128bool LOONGARCH_FPU;129bool LOONGARCH_LSX;130bool LOONGARCH_LASX;131bool LOONGARCH_CRC32;132bool LOONGARCH_COMPLEX;133bool LOONGARCH_CRYPTO;134bool LOONGARCH_LVZ;135bool LOONGARCH_LBT_X86;136bool LOONGARCH_LBT_ARM;137bool LOONGARCH_LBT_MIPS;138bool LOONGARCH_PTW;139140// Quirks141struct {142// Samsung Galaxy S7 devices (Exynos 8890) have a big.LITTLE configuration where the cacheline size differs between big and LITTLE.143// GCC's cache clearing function would detect the cacheline size on one and keep it for later. When clearing144// with the wrong cacheline size on the other, that's an issue. In case we want to do something different in this145// situation in the future, let's keep this as a quirk, but our current code won't detect it reliably146// if it happens on new archs. We now use better clearing code on ARM64 that doesn't have this issue.147bool bExynos8890DifferingCachelineSizes;148} sQuirks;149150// Call Detect()151explicit CPUInfo();152153// Turn the cpu info into a string we can show154std::vector<std::string> Features();155std::string Summarize();156157private:158// Detects the various cpu features159void Detect();160};161162extern CPUInfo cpu_info;163164const char *GetCompilerABI();165166167