From 08b5286bd5c42dcbf50304b864ef0bfc9e87655d Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 29 Jan 2023 15:45:51 -0800 Subject: [PATCH] arm64: Add some flags from cpu_features. --- Common/ArmCPUDetect.cpp | 42 +++++++++++++++++++++++++++++++++++++++++ Common/CPUDetect.h | 3 +++ 2 files changed, 45 insertions(+) diff --git a/Common/ArmCPUDetect.cpp b/Common/ArmCPUDetect.cpp index 3a0fc60e8b..4742e2b862 100644 --- a/Common/ArmCPUDetect.cpp +++ b/Common/ArmCPUDetect.cpp @@ -26,6 +26,20 @@ #if PPSSPP_ARCH(ARM) || PPSSPP_ARCH(ARM64) +#if PPSSPP_ARCH(ARM) +#include "ext/cpu_features/include/cpuinfo_arm.h" + +#if defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_ANDROID) +#define USE_CPU_FEATURES 1 +#endif +#elif PPSSPP_ARCH(ARM64) && defined(__aarch64__) +#include "ext/cpu_features/include/cpuinfo_aarch64.h" + +#if defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_ANDROID) +#define USE_CPU_FEATURES 1 +#endif +#endif + #include #include "Common/CommonTypes.h" @@ -337,6 +351,31 @@ void CPUInfo::Detect() bNEON = true; bASIMD = true; #endif + +#if PPSSPP_ARCH(ARM) && defined(USE_CPU_FEATURES) + cpu_features::ArmInfo info = cpu_features::GetArmInfo(); + bSwp = info.features.swp; + bHalf = info.features.half; + bThumb = info.features.thumb; + bFastMult = info.features.fastmult; + bEDSP = info.features.edsp; + bThumbEE = info.features.thumbee; + bNEON = info.features.neon; + bTLS = info.features.tls; + bVFP = info.features.vfp; + bVFPv3 = info.features.vfpv3; + bVFPv4 = info.features.vfpv4; + bIDIVa = info.features.idiva; + bIDIVt = info.features.idivt; +#endif +#if PPSSPP_ARCH(ARM64) && defined(USE_CPU_FEATURES) + cpu_features::Aarch64Info info = cpu_features::GetAarch64Info(); + bFP = info.features.fp; + bASIMD = info.features.asimd; + bSVE = info.features.sve; + bSVE2 = info.features.sve2; + bFRINT = info.features.frint; +#endif } std::vector CPUInfo::Features() { @@ -360,6 +399,9 @@ std::vector CPUInfo::Features() { { bNEON, "NEON" }, { bIDIVa, "IDIVa" }, { bIDIVt, "IDIVt" }, + { bFRINT, "FRINT" }, + { bSVE, "SVE" }, + { bSVE2, "SVE2" }, { CPU64bit, "64-bit" }, }; diff --git a/Common/CPUDetect.h b/Common/CPUDetect.h index 5f639df86b..13e1170acc 100644 --- a/Common/CPUDetect.h +++ b/Common/CPUDetect.h @@ -94,6 +94,9 @@ struct CPUInfo { // ARMv8 specific bool bFP; bool bASIMD; + bool bSVE; + bool bSVE2; + bool bFRINT; // MIPS specific bool bXBurst1;