Merge pull request #1138 from FioraAeterna/arithetweak

JIT: a small optimization for subfex and friends
This commit is contained in:
skidau 2014-09-29 13:51:44 +10:00
commit c7f3858379
1 changed files with 13 additions and 3 deletions

View File

@ -1288,14 +1288,24 @@ void Jit64::arithXex(UGeckoInstruction inst)
else else
{ {
OpArg source = regsource ? gpr.R(d == b ? a : b) : Imm32(mex ? 0xFFFFFFFF : 0); OpArg source = regsource ? gpr.R(d == b ? a : b) : Imm32(mex ? 0xFFFFFFFF : 0);
if (js.carryFlagInverted)
CMC();
if (d != a && d != b) if (d != a && d != b)
MOV(32, gpr.R(d), gpr.R(a)); MOV(32, gpr.R(d), gpr.R(a));
if (!add) if (!add)
NOT(32, gpr.R(d)); NOT(32, gpr.R(d));
// if the source is an immediate, we can invert carry by going from add -> sub and doing src = -1 - src
if (js.carryFlagInverted && source.IsImm())
{
source.offset = -1 - (s32)source.offset;
SBB(32, gpr.R(d), source);
invertedCarry = true;
}
else
{
if (js.carryFlagInverted)
CMC();
ADC(32, gpr.R(d), source); ADC(32, gpr.R(d), source);
} }
}
FinalizeCarryOverflow(inst.OE, invertedCarry); FinalizeCarryOverflow(inst.OE, invertedCarry);
if (inst.Rc) if (inst.Rc)
ComputeRC(gpr.R(d), false); ComputeRC(gpr.R(d), false);