SPU LLVM: don't force-enter process_mfc_cmd() because it's slower

This commit is contained in:
Eladash 2022-09-20 10:20:24 +03:00 committed by Ivan
parent b01220d2c5
commit 2a00a88e2a
1 changed files with 11 additions and 5 deletions

View File

@ -6629,17 +6629,19 @@ public:
if (auto ci = llvm::dyn_cast<llvm::ConstantInt>(trunc<u8>(val).eval(m_ir)))
{
if (g_cfg.core.spu_accurate_dma)
if (g_cfg.core.mfc_debug)
{
break;
}
bool must_use_cpp_functions = !!g_cfg.core.spu_accurate_dma;
if (u64 cmdh = ci->getZExtValue() & ~(MFC_BARRIER_MASK | MFC_FENCE_MASK | MFC_RESULT_MASK); g_cfg.core.rsx_fifo_accuracy || g_cfg.video.strict_rendering_mode || !g_use_rtm)
{
// TODO: don't require TSX (current implementation is TSX-only)
if (cmdh == MFC_PUT_CMD || cmdh == MFC_SNDSIG_CMD)
{
break;
must_use_cpp_functions = true;
}
}
@ -6739,12 +6741,16 @@ public:
m_ir->CreateCondBr(cond, exec, fail, m_md_likely);
m_ir->SetInsertPoint(exec);
const auto mmio = llvm::BasicBlock::Create(m_context, "", m_function);
const auto copy = llvm::BasicBlock::Create(m_context, "", m_function);
// Always use interpreter function for MFC debug option
m_ir->CreateCondBr(m_ir->CreateICmpUGE(eal.value, m_ir->getInt32(g_cfg.core.mfc_debug ? 0 : 0xe0000000)), mmio, copy, m_md_unlikely);
m_ir->SetInsertPoint(mmio);
if (!must_use_cpp_functions)
{
const auto mmio = llvm::BasicBlock::Create(m_context, "", m_function);
m_ir->CreateCondBr(m_ir->CreateICmpUGE(eal.value, m_ir->getInt32(0xe0000000)), mmio, copy, m_md_unlikely);
m_ir->SetInsertPoint(mmio);
}
m_ir->CreateStore(ci, spu_ptr<u8>(&spu_thread::ch_mfc_cmd, &spu_mfc_cmd::cmd));
call("spu_exec_mfc_cmd", &exec_mfc_cmd, m_thread);
m_ir->CreateBr(next);