mirror of https://github.com/RPCS3/rpcs3.git
Util: Add FMA and INVARIANT_TSC detection (#7937)
This commit is contained in:
parent
63080c22a3
commit
dd8a3eaac5
|
@ -75,6 +75,24 @@ bool utils::has_clwb()
|
||||||
return g_value;
|
return g_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool utils::has_invariant_tsc()
|
||||||
|
{
|
||||||
|
static const bool g_value = get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(0x80000007, 0)[3] & 0x100) == 0x100;
|
||||||
|
return g_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool utils::has_fma3()
|
||||||
|
{
|
||||||
|
static const bool g_value = get_cpuid(0, 0)[0] >= 0x1 && get_cpuid(1, 0)[2] & 0x1000;
|
||||||
|
return g_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool utils::has_fma4()
|
||||||
|
{
|
||||||
|
static const bool g_value = get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(0x80000001, 0)[2] & 0x10000) == 0x10000;
|
||||||
|
return g_value;
|
||||||
|
}
|
||||||
|
|
||||||
std::string utils::get_cpu_brand()
|
std::string utils::get_cpu_brand()
|
||||||
{
|
{
|
||||||
std::string brand;
|
std::string brand;
|
||||||
|
@ -113,7 +131,11 @@ std::string utils::get_system_info()
|
||||||
|
|
||||||
fmt::append(result, "%s | %d Threads | %.2f GiB RAM", brand, num_proc, mem_total / (1024.0f * 1024 * 1024));
|
fmt::append(result, "%s | %d Threads | %.2f GiB RAM", brand, num_proc, mem_total / (1024.0f * 1024 * 1024));
|
||||||
|
|
||||||
if (const ullong tsc_freq = get_tsc_freq())
|
if (!has_invariant_tsc())
|
||||||
|
{
|
||||||
|
fmt::append(result, " | TSC: Bad");
|
||||||
|
}
|
||||||
|
else if (const ullong tsc_freq = get_tsc_freq())
|
||||||
{
|
{
|
||||||
fmt::append(result, " | TSC: %.02fGHz", tsc_freq / 1000000000.);
|
fmt::append(result, " | TSC: %.02fGHz", tsc_freq / 1000000000.);
|
||||||
}
|
}
|
||||||
|
@ -142,6 +164,24 @@ std::string utils::get_system_info()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (has_fma3() || has_fma4())
|
||||||
|
{
|
||||||
|
result += " | FMA";
|
||||||
|
|
||||||
|
if (has_fma3() && has_fma4())
|
||||||
|
{
|
||||||
|
result += "3+4";
|
||||||
|
}
|
||||||
|
else if (has_fma3())
|
||||||
|
{
|
||||||
|
result += "3";
|
||||||
|
}
|
||||||
|
else if (has_fma4())
|
||||||
|
{
|
||||||
|
result += "4";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (has_rtm())
|
if (has_rtm())
|
||||||
{
|
{
|
||||||
result += " | TSX";
|
result += " | TSX";
|
||||||
|
@ -155,7 +195,6 @@ std::string utils::get_system_info()
|
||||||
{
|
{
|
||||||
result += " disabled by default";
|
result += " disabled by default";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -47,6 +47,12 @@ namespace utils
|
||||||
|
|
||||||
bool has_clwb();
|
bool has_clwb();
|
||||||
|
|
||||||
|
bool has_invariant_tsc();
|
||||||
|
|
||||||
|
bool has_fma3();
|
||||||
|
|
||||||
|
bool has_fma4();
|
||||||
|
|
||||||
std::string get_cpu_brand();
|
std::string get_cpu_brand();
|
||||||
|
|
||||||
std::string get_system_info();
|
std::string get_system_info();
|
||||||
|
|
Loading…
Reference in New Issue