summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2010-03-27 06:51:37 +0000
committerShawn Hoffman <godisgovernment@gmail.com>2010-03-27 06:51:37 +0000
commitef193f2e9566c09d71ecf2f29a44fbf09b9c8fc0 (patch)
treee395ee96675bb694ea07c2a8536a0c0232b9cb7c
parent14d489dfee0e8138a4f882b88397780d51994b71 (diff)
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
-rw-r--r--Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp17
-rw-r--r--Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp8
2 files changed, 15 insertions, 10 deletions
diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp
index 23b175d279..c27c2f32af 100644
--- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp
+++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp
@@ -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
{
diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp
index da4380bf9a..62c9c1f3fe 100644
--- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp
+++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp
@@ -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) {