diff options
| author | Markus Wick <degasus@users.noreply.github.com> | 2018-03-20 11:08:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-03-20 11:08:12 +0100 |
| commit | 35bfa64dfcb9e0d873f95bd7d3a9aa8b29e99cb6 (patch) | |
| tree | 6498e123353c68a8f3e9d6bc4e07ca0ce9707ad6 /Source/Core | |
| parent | 5a4b59c4d1f9ee7ba0a992cda5c2d3d9e7ee394f (diff) | |
| parent | 2fa0cb91a150e221cde870b5bda82c8ad48f8496 (diff) | |
Merge pull request #6470 from lioncash/ov-flag
Interpreter: Handle setting the overflow flag when the OE bit is set in divw, divwu, and neg
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp | 17 | ||||
| -rw-r--r-- | Source/Core/Core/PowerPC/PowerPC.h | 17 |
2 files changed, 21 insertions, 13 deletions
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp index e8731b8c2a..cfd6d3992f 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp @@ -499,8 +499,7 @@ void Interpreter::divwx(UGeckoInstruction inst) { if (inst.OE) { - // should set OV - PanicAlert("OE: divwx"); + SetXER_OV(true); } if (((u32)a & 0x80000000) && b == 0) @@ -526,8 +525,7 @@ void Interpreter::divwux(UGeckoInstruction inst) { if (inst.OE) { - // should set OV - PanicAlert("OE: divwux"); + SetXER_OV(true); } rGPR[inst.RD] = 0; @@ -582,16 +580,15 @@ void Interpreter::mullwx(UGeckoInstruction inst) void Interpreter::negx(UGeckoInstruction inst) { - rGPR[inst.RD] = (~rGPR[inst.RA]) + 1; + const u32 a = rGPR[inst.RA]; - if (rGPR[inst.RD] == 0x80000000) - { - if (inst.OE) - PanicAlert("OE: negx"); - } + rGPR[inst.RD] = (~a) + 1; if (inst.Rc) Helper_UpdateCR0(rGPR[inst.RD]); + + if (inst.OE && a == 0x80000000) + SetXER_OV(true); } void Interpreter::subfx(UGeckoInstruction inst) diff --git a/Source/Core/Core/PowerPC/PowerPC.h b/Source/Core/Core/PowerPC/PowerPC.h index 2b3fe8a98e..5b74df1a58 100644 --- a/Source/Core/Core/PowerPC/PowerPC.h +++ b/Source/Core/Core/PowerPC/PowerPC.h @@ -417,14 +417,25 @@ inline void SetXER(UReg_XER new_xer) PowerPC::ppcState.xer_so_ov = (new_xer.SO << 1) + new_xer.OV; } -inline int GetXER_SO() +inline u32 GetXER_SO() { return PowerPC::ppcState.xer_so_ov >> 1; } -inline void SetXER_SO(int value) +inline void SetXER_SO(bool value) { - PowerPC::ppcState.xer_so_ov |= value << 1; + PowerPC::ppcState.xer_so_ov |= static_cast<u32>(value) << 1; +} + +inline u32 GetXER_OV() +{ + return PowerPC::ppcState.xer_so_ov & 1; +} + +inline void SetXER_OV(bool value) +{ + PowerPC::ppcState.xer_so_ov |= static_cast<u32>(value); + SetXER_SO(value); } void UpdateFPRF(double dvalue); |
