subfex optimization when RD==RA

This commit is contained in:
calc84maniac 2012-01-05 19:07:31 -05:00
parent 60cddf0823
commit a7a6a1859e
1 changed files with 10 additions and 7 deletions

View File

@ -913,28 +913,31 @@ void Jit64::subfex(UGeckoInstruction inst)
JitClearCAOV(inst.OE); JitClearCAOV(inst.OE);
SHR(32, R(EAX), Imm8(30)); SHR(32, R(EAX), Imm8(30));
// Convert carry to borrow bool invertedCarry = false;
CMC();
if (d == b) if (d == b)
{ {
// Convert carry to borrow
CMC();
SBB(32, gpr.R(d), gpr.R(a)); SBB(32, gpr.R(d), gpr.R(a));
invertedCarry = true;
} }
else if (d == a) else if (d == a)
{ {
MOV(32, R(EAX), gpr.R(a)); NOT(32, gpr.R(d));
MOV(32, gpr.R(d), gpr.R(b)); ADC(32, gpr.R(d), gpr.R(b));
SBB(32, gpr.R(d), R(EAX));
} }
else else
{ {
// Convert carry to borrow
CMC();
MOV(32, gpr.R(d), gpr.R(b)); MOV(32, gpr.R(d), gpr.R(b));
SBB(32, gpr.R(d), gpr.R(a)); SBB(32, gpr.R(d), gpr.R(a));
invertedCarry = true;
} }
if (inst.Rc) { if (inst.Rc) {
GenerateRC(); GenerateRC();
} }
FinalizeCarryOverflow(inst.OE, true); FinalizeCarryOverflow(inst.OE, invertedCarry);
gpr.UnlockAll(); gpr.UnlockAll();
} }