Core: Sync FP status register in advanced block linking

This commit is contained in:
zilmar 2024-05-16 15:45:38 +09:30
parent 703a09d034
commit 13bd420b2a
1 changed files with 36 additions and 6 deletions

View File

@ -241,12 +241,17 @@ void CX86RecompilerOps::PreCompileOpcode(void)
/*if ((m_CompilePC >= 0x80325D80 && m_CompilePC <= 0x80325DF0) && m_PipelineStage == PIPELINE_STAGE_NORMAL)
{
m_RegWorkingSet.WriteBackRegisters();
UpdateCounters(m_RegWorkingSet,false,true);
m_Assembler.MoveConstToVariable(&g_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER",m_CompilePC);
if (g_SyncSystem) {
m_Assembler.CallThis((uint32_t)g_BaseSystem, AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem", 4);
}
CX86RegInfo TestRegSet = m_RegWorkingSet;
m_Assembler.pushad();
TestRegSet.WriteBackRegisters();
UpdateCounters(TestRegSet,false,true);
m_Assembler.MoveConstToVariable(&g_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER",m_CompilePC);
if (g_SyncSystem)
{
m_Assembler.CallThis((uint32_t)g_BaseSystem, AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem", 4);
}
m_RegWorkingSet.SetBlockCycleCount(0);
m_Assembler.popad();
}*/
/*if ((m_CompilePC == 0x80324E14) && m_PipelineStage == PIPELINE_STAGE_NORMAL)
{
@ -8598,6 +8603,31 @@ void CX86RecompilerOps::SyncRegState(const CRegInfo & SyncTo)
}
}
asmjit::x86::Gp TargetFPStatusReg = SyncTo.GetFPStatusReg();
asmjit::x86::Gp FPStatusReg = m_RegWorkingSet.GetFPStatusReg();
if (FPStatusReg != TargetFPStatusReg)
{
if (!TargetFPStatusReg.isValid())
{
m_RegWorkingSet.UnMap_X86reg(FPStatusReg);
}
else if (!FPStatusReg.isValid())
{
m_RegWorkingSet.UnMap_X86reg(TargetFPStatusReg);
m_CodeBlock.Log(" regcache: allocate %s as fp status reg", CX86Ops::x86_Name(TargetFPStatusReg));
m_RegWorkingSet.SetX86Mapped(GetIndexFromX86Reg(TargetFPStatusReg), CRegInfo::FPStatusReg_Mapped);
m_Assembler.MoveVariableToX86reg(TargetFPStatusReg, &g_Reg->m_FPCR[31], "FPCR[31]");
}
else
{
m_RegWorkingSet.UnMap_X86reg(TargetFPStatusReg);
m_CodeBlock.Log(" regcache: change allocation of fp status reg from %s to %s", CX86Ops::x86_Name(FPStatusReg), CX86Ops::x86_Name(TargetFPStatusReg));
m_RegWorkingSet.SetX86Mapped(GetIndexFromX86Reg(TargetFPStatusReg), CRegInfo::FPStatusReg_Mapped);
m_RegWorkingSet.SetX86Mapped(GetIndexFromX86Reg(FPStatusReg), CRegInfo::NotMapped);
m_Assembler.mov(TargetFPStatusReg, FPStatusReg);
}
}
for (int i = 1; i < 32; i++)
{
if (m_RegWorkingSet.GetMipsRegState(i) == SyncTo.GetMipsRegState(i) ||