diff options
| author | Fiora <fioraaeterna@gmail.com> | 2014-09-21 12:16:26 -0700 |
|---|---|---|
| committer | Fiora <fioraaeterna@gmail.com> | 2014-09-21 12:16:26 -0700 |
| commit | 505b1bd5622173e73976339b50dcdde33d287c01 (patch) | |
| tree | b85eba609df3842cc8614272348e7f86d9066704 /Source | |
| parent | 9f2d4ee53e9040925aa56ea5a04a374578562d02 (diff) | |
JIT: a small optimization for subfex and friends
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp index 79a7c5d76d..1840b92417 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp @@ -1307,13 +1307,23 @@ void Jit64::arithXex(UGeckoInstruction inst) else { OpArg source = regsource ? gpr.R(d == b ? a : b) : Imm32(mex ? 0xFFFFFFFF : 0); - if (js.carryFlagInverted) - CMC(); if (d != a && d != b) MOV(32, gpr.R(d), gpr.R(a)); if (!add) NOT(32, gpr.R(d)); - ADC(32, gpr.R(d), source); + // 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); + } } FinalizeCarryOverflow(inst.OE, invertedCarry); if (inst.Rc) |
