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()