diff options
| author | Anthony <Helios747@users.noreply.github.com> | 2018-03-21 18:18:00 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-03-21 18:18:00 -0700 |
| commit | 23bc50704aa199cfea71f4d9729220fe89711732 (patch) | |
| tree | bbbccb3228a9bf8245ef3ed865025f8e791e1fa3 /Source | |
| parent | 716e4ba035eddc89430e462204e3345fdb471889 (diff) | |
| parent | 355509653eb4c0bc3ae80336838cf63a9ea97aef (diff) | |
Merge pull request #6484 from lioncash/mul
Interpreter_Integer: Handle the overflow flag when the OE bit is set for mullw
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp index cfd6d3992f..8b7a3c8742 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp @@ -566,13 +566,14 @@ void Interpreter::mulhwux(UGeckoInstruction inst) void Interpreter::mullwx(UGeckoInstruction inst) { - u32 a = rGPR[inst.RA]; - u32 b = rGPR[inst.RB]; - u32 d = (u32)((s32)a * (s32)b); - rGPR[inst.RD] = d; + const s64 a = static_cast<s32>(rGPR[inst.RA]); + const s64 b = static_cast<s32>(rGPR[inst.RB]); + const s64 result = a * b; - if (inst.OE) - PanicAlert("OE: mullwx"); + rGPR[inst.RD] = static_cast<u32>(result); + + if (inst.OE && (result < -0x80000000LL || result > 0x7FFFFFFFLL)) + SetXER_OV(true); if (inst.Rc) Helper_UpdateCR0(rGPR[inst.RD]); |
