1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

CPUTranslator: detect FMA feature

This commit is contained in:
Nekotekina 2019-12-20 21:11:07 +03:00
parent 4a5c8c392c
commit 068450d4fe
3 changed files with 35 additions and 5 deletions

View File

@ -958,10 +958,12 @@ std::string jit_compiler::cpu(const std::string& _cpu)
m_cpu == "skylake" ||
m_cpu == "skylake-avx512" ||
m_cpu == "cascadelake" ||
m_cpu == "cooperlake" ||
m_cpu == "cannonlake" ||
m_cpu == "icelake" ||
m_cpu == "icelake-client" ||
m_cpu == "icelake-server")
m_cpu == "icelake-server" ||
m_cpu == "tigerlake")
{
// Downgrade if AVX is not supported by some chips
if (!utils::has_avx())
@ -972,10 +974,12 @@ std::string jit_compiler::cpu(const std::string& _cpu)
if (m_cpu == "skylake-avx512" ||
m_cpu == "cascadelake" ||
m_cpu == "cooperlake" ||
m_cpu == "cannonlake" ||
m_cpu == "icelake" ||
m_cpu == "icelake-client" ||
m_cpu == "icelake-server")
m_cpu == "icelake-server" ||
m_cpu == "tigerlake")
{
// Downgrade if AVX-512 is disabled or not supported
if (!utils::has_512())

View File

@ -18,8 +18,6 @@ void cpu_translator::initialize(llvm::LLVMContext& context, llvm::ExecutionEngin
const auto cpu = m_engine->getTargetMachine()->getTargetCPU();
m_use_ssse3 = true;
// Test SSSE3 feature (TODO)
if (cpu == "generic" ||
cpu == "k8" ||
@ -34,6 +32,31 @@ void cpu_translator::initialize(llvm::LLVMContext& context, llvm::ExecutionEngin
{
m_use_ssse3 = false;
}
// Test FMA feature (TODO)
if (cpu == "haswell" ||
cpu == "broadwell" ||
cpu == "skylake" ||
cpu == "bdver2" ||
cpu == "bdver3" ||
cpu == "bdver4" ||
cpu.substr(0, 5) == "znver")
{
m_use_fma = true;
}
// Test AVX-512 feature (TODO)
if (cpu == "skylake-avx512" ||
cpu == "cascadelake" ||
cpu == "cannonlake" ||
cpu == "cooperlake" ||
cpu == "icelake" ||
cpu == "icelake-client" ||
cpu == "icelake-server" ||
cpu == "tigerlake")
{
m_use_fma = true;
}
}
llvm::Value* cpu_translator::bitcast(llvm::Value* val, llvm::Type* type)

View File

@ -2404,7 +2404,10 @@ protected:
bool m_is_be;
// Allow PSHUFB intrinsic
bool m_use_ssse3;
bool m_use_ssse3 = true;
// Allow FMA
bool m_use_fma = false;
// IR builder
llvm::IRBuilder<>* m_ir;