Core: Use the new COP1_S_CVT in COP1_D_ROUND_L, COP1_D_TRUNC_L, COP1_D_CEIL_L, COP1_D_FLOOR_L

This commit is contained in:
zilmar 2024-04-18 16:51:53 +09:30
parent fe87142657
commit 9e73771815
1 changed files with 52 additions and 24 deletions

View File

@ -8390,6 +8390,12 @@ void CX86RecompilerOps::COP1_D_MOV()
} }
void CX86RecompilerOps::COP1_D_ROUND_L() void CX86RecompilerOps::COP1_D_ROUND_L()
{
if (FpuExceptionInRecompiler())
{
COP1_S_CVT(CRegInfo::RoundNearest, CRegInfo::FPU_Double, CRegInfo::FPU_Qword);
}
else
{ {
CompileCop1Test(); CompileCop1Test();
if (m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Double) || m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Qword)) if (m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Double) || m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Qword))
@ -8402,8 +8408,15 @@ void CX86RecompilerOps::COP1_D_ROUND_L()
} }
m_RegWorkingSet.ChangeFPURegFormat(m_Opcode.fd, CRegInfo::FPU_Double, CRegInfo::FPU_Qword, CRegInfo::RoundNearest); m_RegWorkingSet.ChangeFPURegFormat(m_Opcode.fd, CRegInfo::FPU_Double, CRegInfo::FPU_Qword, CRegInfo::RoundNearest);
} }
}
void CX86RecompilerOps::COP1_D_TRUNC_L() void CX86RecompilerOps::COP1_D_TRUNC_L()
{
if (FpuExceptionInRecompiler())
{
COP1_S_CVT(CRegInfo::RoundTruncate, CRegInfo::FPU_Double, CRegInfo::FPU_Qword);
}
else
{ {
CompileCop1Test(); CompileCop1Test();
if (m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Double) || m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Qword)) if (m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Double) || m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Qword))
@ -8416,8 +8429,15 @@ void CX86RecompilerOps::COP1_D_TRUNC_L()
} }
m_RegWorkingSet.ChangeFPURegFormat(m_Opcode.fd, CRegInfo::FPU_Double, CRegInfo::FPU_Qword, CRegInfo::RoundTruncate); m_RegWorkingSet.ChangeFPURegFormat(m_Opcode.fd, CRegInfo::FPU_Double, CRegInfo::FPU_Qword, CRegInfo::RoundTruncate);
} }
}
void CX86RecompilerOps::COP1_D_CEIL_L() void CX86RecompilerOps::COP1_D_CEIL_L()
{
if (FpuExceptionInRecompiler())
{
COP1_S_CVT(CRegInfo::RoundUp, CRegInfo::FPU_Double, CRegInfo::FPU_Qword);
}
else
{ {
CompileCop1Test(); CompileCop1Test();
if (m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Double) || m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Qword)) if (m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Double) || m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Qword))
@ -8430,8 +8450,15 @@ void CX86RecompilerOps::COP1_D_CEIL_L()
} }
m_RegWorkingSet.ChangeFPURegFormat(m_Opcode.fd, CRegInfo::FPU_Double, CRegInfo::FPU_Qword, CRegInfo::RoundUp); m_RegWorkingSet.ChangeFPURegFormat(m_Opcode.fd, CRegInfo::FPU_Double, CRegInfo::FPU_Qword, CRegInfo::RoundUp);
} }
}
void CX86RecompilerOps::COP1_D_FLOOR_L() void CX86RecompilerOps::COP1_D_FLOOR_L()
{
if (FpuExceptionInRecompiler())
{
COP1_S_CVT(CRegInfo::RoundDown, CRegInfo::FPU_Double, CRegInfo::FPU_Qword);
}
else
{ {
CompileCop1Test(); CompileCop1Test();
if (m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Double) || m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Qword)) if (m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Double) || m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Qword))
@ -8444,6 +8471,7 @@ void CX86RecompilerOps::COP1_D_FLOOR_L()
} }
m_RegWorkingSet.ChangeFPURegFormat(m_Opcode.fd, CRegInfo::FPU_Double, CRegInfo::FPU_Qword, CRegInfo::RoundDown); m_RegWorkingSet.ChangeFPURegFormat(m_Opcode.fd, CRegInfo::FPU_Double, CRegInfo::FPU_Qword, CRegInfo::RoundDown);
} }
}
void CX86RecompilerOps::COP1_D_ROUND_W() void CX86RecompilerOps::COP1_D_ROUND_W()
{ {