From 89df65aa253064623e313cc102c6b6e371b2ea99 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 24 Mar 2018 20:42:29 -0400 Subject: [PATCH] Interpreter_Integer: Correct precedence of overflow check in nego The overflow check needs to occur before the condition register update due to the fact that the summary overflow (SO) bit is used in the updating of the condition register. If we set any overflow bits after updating the CR, then we can potentially incorrectly report that an overflow did not happen (in the case the SO bit wasn't set previously). --- .../Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp index 5c184e4ecc..71c27599e0 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp @@ -591,11 +591,11 @@ void Interpreter::negx(UGeckoInstruction inst) rGPR[inst.RD] = (~a) + 1; - if (inst.Rc) - Helper_UpdateCR0(rGPR[inst.RD]); - if (inst.OE) PowerPC::SetXER_OV(a == 0x80000000); + + if (inst.Rc) + Helper_UpdateCR0(rGPR[inst.RD]); } void Interpreter::subfx(UGeckoInstruction inst)