fix divwux and divwx in interpreter, and fix divwux in jit64 - use the jit64 version as well.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5243 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2010-03-27 06:51:37 +00:00
parent 14d489dfee
commit ef193f2e95
2 changed files with 15 additions and 10 deletions

View File

@ -477,10 +477,13 @@ void divwx(UGeckoInstruction _inst)
s32 b = m_GPR[_inst.RB];
if (b == 0 || ((u32)a == 0x80000000 && b == -1))
{
if (_inst.OE)
PanicAlert("OE: divwx");
if (_inst.OE)
// should set OV
//else PanicAlert("Div by zero", "divwx");
PanicAlert("OE: divwx");
if (((u32)a & 0x80000000) && b == 0)
m_GPR[_inst.RD] = -1;
else
m_GPR[_inst.RD] = 0;
}
else
m_GPR[_inst.RD] = (u32)(a / b);
@ -494,12 +497,12 @@ void divwux(UGeckoInstruction _inst)
u32 a = m_GPR[_inst.RA];
u32 b = m_GPR[_inst.RB];
if (b == 0) // || (a == 0x80000000 && b == 0xFFFFFFFF))
if (b == 0)
{
if (_inst.OE)
PanicAlert("OE: divwux");
if (_inst.OE)
// should set OV
//else PanicAlert("Div by zero", "divwux");
PanicAlert("OE: divwux");
m_GPR[_inst.RD] = 0;
}
else
{

View File

@ -634,7 +634,6 @@ void Jit64::divwux(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(Integer)
Default(inst); return;
int a = inst.RA, b = inst.RB, d = inst.RD;
gpr.FlushLockX(EDX);
gpr.Lock(a, b, d);
@ -648,10 +647,13 @@ void Jit64::divwux(UGeckoInstruction inst)
gpr.KillImmediate(b);
CMP(32, gpr.R(b), R(EDX));
// doesn't handle if OE is set, but int doesn't either...
FixupBranch branch = J_CC(CC_Z);
FixupBranch not_div_by_zero = J_CC(CC_NZ);
MOV(32, gpr.R(d), Imm32(0));
FixupBranch end = J();
SetJumpTarget(not_div_by_zero);
DIV(32, gpr.R(b));
MOV(32, gpr.R(d), R(EAX));
SetJumpTarget(branch);
SetJumpTarget(end);
gpr.UnlockAll();
gpr.UnlockAllX();
if (inst.Rc) {