From ad1a2a2d9a8a4d25e7320741410268a6bcd8dc5b Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 1 Feb 2024 18:17:03 +1030 Subject: [PATCH] Core: Update neg.s for the recompiler --- .../Recompiler/x86/x86RecompilerOps.cpp | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp index 572ee25a0..31d8cca38 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp @@ -7881,11 +7881,30 @@ void CX86RecompilerOps::COP1_S_ABS() void CX86RecompilerOps::COP1_S_NEG() { - CompileCop1Test(); - m_RegWorkingSet.FixRoundModel(CRegInfo::RoundDefault); - m_RegWorkingSet.Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fs, CRegInfo::FPU_Float); - m_Assembler.fchs(); - m_RegWorkingSet.UnMap_FPR(m_Opcode.fd, true); + if (FpuExceptionInRecompiler()) + { + CompileInitFpuOperation(CRegInfo::RoundUnknown); + if (m_RegWorkingSet.RegInStack(m_Opcode.fs, CRegInfo::FPU_Any)) + { + g_Notify->BreakPoint(__FILE__, __LINE__); + return; + } + asmjit::x86::Gp TempReg = m_RegWorkingSet.FPRValuePointer(m_Opcode.fs, CRegInfo::FPU_FloatLow); + CompileCheckFPUInput32(TempReg); + m_RegWorkingSet.PrepareFPTopToBe(m_Opcode.fd, m_Opcode.fs, CRegInfo::FPU_Float); + m_Assembler.fchs(); + m_RegWorkingSet.SetX86Protected(GetIndexFromX86Reg(TempReg), false); + CompileCheckFPUResult32(m_Opcode.fd); + m_RegWorkingSet.SetFPTopAs(m_Opcode.fd); + } + else + { + CompileCop1Test(); + m_RegWorkingSet.FixRoundModel(CRegInfo::RoundDefault); + m_RegWorkingSet.Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fs, CRegInfo::FPU_Float); + m_Assembler.fchs(); + m_RegWorkingSet.UnMap_FPR(m_Opcode.fd, true); + } } void CX86RecompilerOps::COP1_S_SQRT()