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)) else
{ {
int operand = ((d == a) ? b : a); RCOpArg Ra = gpr.Use(a, RCMode::Read);
gpr.Lock(a, b, d); RCOpArg Rb = gpr.Use(b, RCMode::Read);
gpr.BindToRegister(d, true); RCX64Reg Rd = gpr.Bind(d, RCMode::Write);
ADD(32, gpr.R(d), gpr.R(operand)); RegCache::Realize(Ra, Rb, Rd);
if (inst.OE)
GenerateOverflow(); if (Ra.IsSimpleReg() && Rb.IsSimpleReg() && !inst.OE)
{
LEA(32, Rd, MRegSum(Ra.GetSimpleReg(), Rb.GetSimpleReg()));
} }
else if (gpr.R(a).IsSimpleReg() && gpr.R(b).IsSimpleReg() && !inst.OE) else if (d == b)
{ {
gpr.Lock(a, b, d); ADD(32, Rd, Ra);
gpr.BindToRegister(d, false);
LEA(32, gpr.RX(d), MRegSum(gpr.RX(a), gpr.RX(b)));
} }
else else
{ {
gpr.Lock(a, b, d); if (d != a)
gpr.BindToRegister(d, false); MOV(32, Rd, Ra);
MOV(32, gpr.R(d), gpr.R(a)); ADD(32, Rd, Rb);
ADD(32, gpr.R(d), gpr.R(b)); }
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)