mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
riscv: Detect Zicsr with cpu_features.
This commit is contained in:
parent
09eb509df4
commit
dcd83c1e47
@ -107,6 +107,7 @@ struct CPUInfo {
|
||||
bool RiscV_C;
|
||||
bool RiscV_V;
|
||||
bool RiscV_B;
|
||||
bool RiscV_Zicsr;
|
||||
|
||||
// Quirks
|
||||
struct {
|
||||
|
@ -18,6 +18,12 @@
|
||||
#include "ppsspp_config.h"
|
||||
#if PPSSPP_ARCH(RISCV64)
|
||||
|
||||
#include "ext/cpu_features/include/cpuinfo_riscv.h"
|
||||
|
||||
#if defined(CPU_FEATURES_OS_LINUX)
|
||||
#define USE_CPU_FEATURES 1
|
||||
#endif
|
||||
|
||||
#include <cstring>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
@ -174,6 +180,21 @@ void CPUInfo::Detect()
|
||||
RiscV_C = ExtensionSupported(hwcap, 'C');
|
||||
RiscV_V = ExtensionSupported(hwcap, 'V');
|
||||
RiscV_B = ExtensionSupported(hwcap, 'B');
|
||||
// Let's assume for now...
|
||||
RiscV_Zicsr = RiscV_M && RiscV_A && RiscV_F && RiscV_D;
|
||||
|
||||
#ifdef USE_CPU_FEATURES
|
||||
cpu_features::RiscvInfo info = cpu_features::GetRiscvInfo();
|
||||
CPU64bit = info.features.RV64I;
|
||||
RiscV_M = info.features.M;
|
||||
RiscV_A = info.features.A;
|
||||
RiscV_F = info.features.F;
|
||||
RiscV_D = info.features.D;
|
||||
RiscV_C = info.features.C;
|
||||
RiscV_Zicsr = info.features.Zicsr;
|
||||
|
||||
truncate_cpy(brand_string, info.uarch);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::vector<std::string> CPUInfo::Features() {
|
||||
@ -191,6 +212,7 @@ std::vector<std::string> CPUInfo::Features() {
|
||||
{ RiscV_C, "Compressed" },
|
||||
{ RiscV_V, "Vector" },
|
||||
{ RiscV_B, "Bitmanip" },
|
||||
{ RiscV_Zicsr, "Zicsr" },
|
||||
{ CPU64bit, "64-bit" },
|
||||
};
|
||||
|
||||
|
@ -50,8 +50,7 @@ static inline bool SupportsAtomic() {
|
||||
}
|
||||
|
||||
static inline bool SupportsZicsr() {
|
||||
// TODO
|
||||
return false;
|
||||
return cpu_info.RiscV_Zicsr;
|
||||
}
|
||||
|
||||
static inline bool SupportsVector() {
|
||||
|
Loading…
Reference in New Issue
Block a user