Jit_Integer: arithcx

This commit is contained in:
MerryMage 2018-10-15 21:01:07 +01:00
parent 6ce718b920
commit bde5df03a3
1 changed files with 24 additions and 20 deletions

View File

@ -1466,37 +1466,41 @@ void Jit64::arithcx(UGeckoInstruction inst)
JITDISABLE(bJITIntegerOff); JITDISABLE(bJITIntegerOff);
bool add = !!(inst.SUBOP10 & 2); // add or sub bool add = !!(inst.SUBOP10 & 2); // add or sub
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
gpr.Lock(a, b, d);
gpr.BindToRegister(d, d == a || d == b, true); {
RCOpArg Ra = gpr.Use(a, RCMode::Read);
RCOpArg Rb = gpr.Use(b, RCMode::Read);
RCX64Reg Rd = gpr.Bind(d, RCMode::Write);
RegCache::Realize(Ra, Rb, Rd);
if (d == a && d != b) if (d == a && d != b)
{ {
if (add) if (add)
{ {
ADD(32, gpr.R(d), gpr.R(b)); ADD(32, Rd, Rb);
} }
else else
{ {
// special case, because sub isn't reversible // special case, because sub isn't reversible
MOV(32, R(RSCRATCH), gpr.R(a)); MOV(32, R(RSCRATCH), Ra);
MOV(32, gpr.R(d), gpr.R(b)); MOV(32, Rd, Rb);
SUB(32, gpr.R(d), R(RSCRATCH)); SUB(32, Rd, R(RSCRATCH));
} }
} }
else else
{ {
if (d != b) if (d != b)
MOV(32, gpr.R(d), gpr.R(b)); MOV(32, Rd, Rb);
if (add) if (add)
ADD(32, gpr.R(d), gpr.R(a)); ADD(32, Rd, Ra);
else else
SUB(32, gpr.R(d), gpr.R(a)); SUB(32, Rd, Ra);
}
} }
FinalizeCarryOverflow(inst.OE, !add); FinalizeCarryOverflow(inst.OE, !add);
if (inst.Rc) if (inst.Rc)
ComputeRC(gpr.R(d)); ComputeRC(d);
gpr.UnlockAll();
} }
void Jit64::rlwinmx(UGeckoInstruction inst) void Jit64::rlwinmx(UGeckoInstruction inst)