Interpreter_Integer: Handle the overflow flag when the OE bit is set for mullw

This commit is contained in:
Lioncash 2018-03-21 19:36:15 -04:00
parent 1b0f6a7d2e
commit 355509653e

View File

@ -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]);