x86jit: Set HI/LO properly on divide by zero.

This commit is contained in:
Unknown W. Brackets 2016-05-18 23:11:07 -07:00
parent b5b94f4a4d
commit 5105e1947f

View File

@ -1027,10 +1027,13 @@ namespace MIPSComp
FixupBranch skip = J();
SetJumpTarget(divZero);
// TODO: This isn't exactly right.
MOV(32, gpr.R(MIPS_REG_HI), R(EAX));
MOV(32, gpr.R(MIPS_REG_LO), Imm32(-1));
CMP(32, R(EAX), Imm32(0));
FixupBranch positiveDivZero = J_CC(CC_GE);
MOV(32, gpr.R(MIPS_REG_LO), Imm32(1));
SetJumpTarget(positiveDivZero);
SetJumpTarget(skip);
SetJumpTarget(skip2);
gpr.UnlockAllX();
@ -1058,7 +1061,11 @@ namespace MIPSComp
SetJumpTarget(divZero);
MOV(32, gpr.R(MIPS_REG_HI), R(EAX));
MOV(32, gpr.R(MIPS_REG_LO), Imm32(-1));
CMP(32, R(EAX), Imm32(0xFFFF));
FixupBranch moreThan16Bit = J_CC(CC_A);
MOV(32, gpr.R(MIPS_REG_LO), Imm32(0xFFFF));
SetJumpTarget(moreThan16Bit);
SetJumpTarget(skip);
gpr.UnlockAllX();
}