Core: CX86RecompilerOps::COP1_CF should be able use the mapped FPStatusReg if is mapped

This commit is contained in:
zilmar 2024-01-04 12:37:06 +10:30
parent 0998f0ff0e
commit c9d2bbd221
3 changed files with 21 additions and 1 deletions

View File

@ -7494,7 +7494,14 @@ void CX86RecompilerOps::COP1_CF()
}
m_RegWorkingSet.Map_GPR_32bit(m_Opcode.rt, true, -1);
m_Assembler.MoveVariableToX86reg(m_RegWorkingSet.GetMipsRegMapLo(m_Opcode.rt), &m_Reg.m_FPCR[m_Opcode.fs], CRegName::FPR_Ctrl[m_Opcode.fs]);
if (m_Opcode.fs == 31 && m_RegWorkingSet.IsFPStatusRegMapped())
{
m_Assembler.mov(m_RegWorkingSet.GetMipsRegMapLo(m_Opcode.rt), m_RegWorkingSet.Map_FPStatusReg());
}
else
{
m_Assembler.MoveVariableToX86reg(m_RegWorkingSet.GetMipsRegMapLo(m_Opcode.rt), &m_Reg.m_FPCR[m_Opcode.fs], CRegName::FPR_Ctrl[m_Opcode.fs]);
}
}
void CX86RecompilerOps::COP1_MT()

View File

@ -596,6 +596,18 @@ const asmjit::x86::St & CX86RegInfo::StackPosition(int32_t Reg)
return Unknown;
}
bool CX86RegInfo::IsFPStatusRegMapped()
{
for (int32_t i = 0, n = x86RegIndex_Size; i < n; i++)
{
if (GetX86Mapped((x86RegIndex)i) == FPStatusReg_Mapped)
{
return true;
}
}
return false;
}
asmjit::x86::Gp CX86RegInfo::FreeX86Reg()
{
if (GetX86Mapped(x86RegIndex_EDI) == NotMapped && !GetX86Protected(x86RegIndex_EDI))

View File

@ -91,6 +91,7 @@ public:
void UnMap_FPR(int32_t Reg, bool WriteBackValue);
const asmjit::x86::St & StackPosition(int32_t Reg);
bool IsFPStatusRegMapped();
asmjit::x86::Gp FreeX86Reg();
asmjit::x86::Gp Free8BitX86Reg();
void Map_GPR_32bit(int32_t MipsReg, bool SignValue, int32_t MipsRegToLoad);