CPU/Recompiler: Don't use far code for mtc0 cache check
Redundant for a few instructions.
This commit is contained in:
parent
fe1fa765f7
commit
10e2079ee4
|
@ -2265,15 +2265,19 @@ void CPU::ARM32Recompiler::Compile_mtc0(CompileFlags cf)
|
||||||
// We could just inline the whole thing..
|
// We could just inline the whole thing..
|
||||||
Flush(FLUSH_FOR_C_CALL);
|
Flush(FLUSH_FOR_C_CALL);
|
||||||
|
|
||||||
SwitchToFarCodeIfBitSet(changed_bits, 16);
|
Label caches_unchanged;
|
||||||
|
armAsm->tst(changed_bits, 1u << 16);
|
||||||
|
armAsm->b(eq, &caches_unchanged);
|
||||||
EmitCall(reinterpret_cast<const void*>(&CPU::UpdateMemoryPointers));
|
EmitCall(reinterpret_cast<const void*>(&CPU::UpdateMemoryPointers));
|
||||||
armAsm->ldr(RARG1, PTR(ptr)); // reload value for interrupt test below
|
armAsm->ldr(RARG1, PTR(ptr)); // reload value for interrupt test below
|
||||||
|
armAsm->bind(&caches_unchanged);
|
||||||
|
|
||||||
|
// might need to reload fastmem base too
|
||||||
if (CodeCache::IsUsingFastmem() && m_block->HasFlag(CodeCache::BlockFlags::ContainsLoadStoreInstructions) &&
|
if (CodeCache::IsUsingFastmem() && m_block->HasFlag(CodeCache::BlockFlags::ContainsLoadStoreInstructions) &&
|
||||||
IsHostRegAllocated(RMEMBASE.GetCode()))
|
IsHostRegAllocated(RMEMBASE.GetCode()))
|
||||||
{
|
{
|
||||||
FreeHostReg(RMEMBASE.GetCode());
|
FreeHostReg(RMEMBASE.GetCode());
|
||||||
}
|
}
|
||||||
SwitchToNearCode(true);
|
|
||||||
|
|
||||||
TestInterrupts(RARG1);
|
TestInterrupts(RARG1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2428,11 +2428,13 @@ void CPU::ARM64Recompiler::Compile_mtc0(CompileFlags cf)
|
||||||
// We could just inline the whole thing..
|
// We could just inline the whole thing..
|
||||||
Flush(FLUSH_FOR_C_CALL);
|
Flush(FLUSH_FOR_C_CALL);
|
||||||
|
|
||||||
SwitchToFarCodeIfBitSet(changed_bits, 16);
|
Label caches_unchanged;
|
||||||
|
armAsm->tbz(changed_bits, 16, &caches_unchanged);
|
||||||
EmitCall(reinterpret_cast<const void*>(&CPU::UpdateMemoryPointers));
|
EmitCall(reinterpret_cast<const void*>(&CPU::UpdateMemoryPointers));
|
||||||
armAsm->ldr(RWARG1, PTR(ptr)); // reload value for interrupt test below
|
armAsm->ldr(RWARG1, PTR(ptr)); // reload value for interrupt test below
|
||||||
armAsm->ldr(RMEMBASE, PTR(&g_state.fastmem_base));
|
if (CodeCache::IsUsingFastmem())
|
||||||
SwitchToNearCode(true);
|
armAsm->ldr(RMEMBASE, PTR(&g_state.fastmem_base));
|
||||||
|
armAsm->bind(&caches_unchanged);
|
||||||
|
|
||||||
TestInterrupts(RWARG1);
|
TestInterrupts(RWARG1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2283,13 +2283,15 @@ void CPU::RISCV64Recompiler::Compile_mtc0(CompileFlags cf)
|
||||||
// We could just inline the whole thing..
|
// We could just inline the whole thing..
|
||||||
Flush(FLUSH_FOR_C_CALL);
|
Flush(FLUSH_FOR_C_CALL);
|
||||||
|
|
||||||
|
Label caches_unchanged;
|
||||||
rvAsm->SRLIW(RSCRATCH, changed_bits, 16);
|
rvAsm->SRLIW(RSCRATCH, changed_bits, 16);
|
||||||
rvAsm->ANDI(RSCRATCH, RSCRATCH, 1);
|
rvAsm->ANDI(RSCRATCH, RSCRATCH, 1);
|
||||||
SwitchToFarCode(true, &Assembler::BEQ, RSCRATCH, zero);
|
rvAsm->BEQ(RSCRATCH, zero, &caches_unchanged);
|
||||||
EmitCall(reinterpret_cast<const void*>(&CPU::UpdateMemoryPointers));
|
EmitCall(reinterpret_cast<const void*>(&CPU::UpdateMemoryPointers));
|
||||||
rvAsm->LW(new_value, PTR(ptr));
|
rvAsm->LW(new_value, PTR(ptr));
|
||||||
rvAsm->LD(RMEMBASE, PTR(&g_state.fastmem_base));
|
if (CodeCache::IsUsingFastmem())
|
||||||
SwitchToNearCode(true);
|
rvAsm->LD(RMEMBASE, PTR(&g_state.fastmem_base));
|
||||||
|
rvAsm->Bind(&caches_unchanged);
|
||||||
|
|
||||||
TestInterrupts(RARG1);
|
TestInterrupts(RARG1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2241,12 +2241,15 @@ void CPU::X64Recompiler::Compile_mtc0(CompileFlags cf)
|
||||||
// We could just inline the whole thing..
|
// We could just inline the whole thing..
|
||||||
Flush(FLUSH_FOR_C_CALL);
|
Flush(FLUSH_FOR_C_CALL);
|
||||||
|
|
||||||
|
Label caches_unchanged;
|
||||||
cg->test(changed_bits, 1u << 16);
|
cg->test(changed_bits, 1u << 16);
|
||||||
SwitchToFarCode(true, &CodeGenerator::jnz);
|
cg->jz(caches_unchanged);
|
||||||
cg->call(&CPU::UpdateMemoryPointers);
|
cg->call(&CPU::UpdateMemoryPointers);
|
||||||
cg->mov(RWARG2, cg->dword[PTR(ptr)]); // reload value for interrupt test below
|
cg->mov(RWARG2, cg->dword[PTR(ptr)]); // reload value for interrupt test below
|
||||||
cg->mov(RMEMBASE, cg->qword[PTR(&g_state.fastmem_base)]);
|
if (CodeCache::IsUsingFastmem())
|
||||||
SwitchToNearCode(true);
|
cg->mov(RMEMBASE, cg->qword[PTR(&g_state.fastmem_base)]);
|
||||||
|
|
||||||
|
cg->L(caches_unchanged);
|
||||||
|
|
||||||
TestInterrupts(RWARG2);
|
TestInterrupts(RWARG2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue