Jit_Integer: addx

This commit is contained in:
MerryMage 2018-10-15 21:01:04 +01:00
parent 50e7b97406
commit 9bf75a0f31
1 changed files with 22 additions and 23 deletions

View File

@ -1352,40 +1352,39 @@ void Jit64::addx(UGeckoInstruction inst)
JITDISABLE(bJITIntegerOff); JITDISABLE(bJITIntegerOff);
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
if (gpr.R(a).IsImm() && gpr.R(b).IsImm()) if (gpr.IsImm(a, b))
{ {
s32 i = gpr.R(a).SImm32(), j = gpr.R(b).SImm32(); s32 i = gpr.SImm32(a), j = gpr.SImm32(b);
gpr.SetImmediate32(d, i + j); gpr.SetImmediate32(d, i + j);
if (inst.OE) if (inst.OE)
GenerateConstantOverflow((s64)i + (s64)j); GenerateConstantOverflow((s64)i + (s64)j);
} }
else if ((d == a) || (d == b))
{
int operand = ((d == a) ? b : a);
gpr.Lock(a, b, d);
gpr.BindToRegister(d, true);
ADD(32, gpr.R(d), gpr.R(operand));
if (inst.OE)
GenerateOverflow();
}
else if (gpr.R(a).IsSimpleReg() && gpr.R(b).IsSimpleReg() && !inst.OE)
{
gpr.Lock(a, b, d);
gpr.BindToRegister(d, false);
LEA(32, gpr.RX(d), MRegSum(gpr.RX(a), gpr.RX(b)));
}
else else
{ {
gpr.Lock(a, b, d); RCOpArg Ra = gpr.Use(a, RCMode::Read);
gpr.BindToRegister(d, false); RCOpArg Rb = gpr.Use(b, RCMode::Read);
MOV(32, gpr.R(d), gpr.R(a)); RCX64Reg Rd = gpr.Bind(d, RCMode::Write);
ADD(32, gpr.R(d), gpr.R(b)); RegCache::Realize(Ra, Rb, Rd);
if (Ra.IsSimpleReg() && Rb.IsSimpleReg() && !inst.OE)
{
LEA(32, Rd, MRegSum(Ra.GetSimpleReg(), Rb.GetSimpleReg()));
}
else if (d == b)
{
ADD(32, Rd, Ra);
}
else
{
if (d != a)
MOV(32, Rd, Ra);
ADD(32, Rd, Rb);
}
if (inst.OE) if (inst.OE)
GenerateOverflow(); GenerateOverflow();
} }
if (inst.Rc) if (inst.Rc)
ComputeRC(gpr.R(d)); ComputeRC(d);
gpr.UnlockAll();
} }
void Jit64::arithXex(UGeckoInstruction inst) void Jit64::arithXex(UGeckoInstruction inst)