JitArm64: optimize bclrx

the unconditional path is the most common, so no need to switch to far code here.
This commit is contained in:
degasus 2016-03-05 15:11:15 +01:00
parent b6f16352e4
commit 637851fce0
1 changed files with 12 additions and 6 deletions

View File

@ -216,6 +216,8 @@ void JitArm64::bclrx(UGeckoInstruction inst)
INSTRUCTION_START INSTRUCTION_START
JITDISABLE(bJITBranchOff); JITDISABLE(bJITBranchOff);
bool conditional = (inst.BO & BO_DONT_DECREMENT_FLAG) == 0 || (inst.BO & BO_DONT_CHECK_CONDITION) == 0;
ARM64Reg WA = gpr.GetReg(); ARM64Reg WA = gpr.GetReg();
FixupBranch pCTRDontBranch; FixupBranch pCTRDontBranch;
if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0) // Decrement and test CTR if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0) // Decrement and test CTR
@ -237,9 +239,12 @@ void JitArm64::bclrx(UGeckoInstruction inst)
!(inst.BO_2 & BO_BRANCH_IF_TRUE)); !(inst.BO_2 & BO_BRANCH_IF_TRUE));
} }
FixupBranch far = B(); if (conditional)
SwitchToFarCode(); {
SetJumpTarget(far); FixupBranch far = B();
SwitchToFarCode();
SetJumpTarget(far);
}
LDR(INDEX_UNSIGNED, WA, PPC_REG, PPCSTATE_OFF(spr[SPR_LR])); LDR(INDEX_UNSIGNED, WA, PPC_REG, PPCSTATE_OFF(spr[SPR_LR]));
AND(WA, WA, 30, 29); // Wipe the bottom 2 bits. AND(WA, WA, 30, 29); // Wipe the bottom 2 bits.
@ -252,12 +257,13 @@ void JitArm64::bclrx(UGeckoInstruction inst)
gpr.Unlock(WB); gpr.Unlock(WB);
} }
gpr.Flush(FlushMode::FLUSH_MAINTAIN_STATE); gpr.Flush(conditional ? FlushMode::FLUSH_MAINTAIN_STATE : FlushMode::FLUSH_ALL);
fpr.Flush(FlushMode::FLUSH_MAINTAIN_STATE); fpr.Flush(conditional ? FlushMode::FLUSH_MAINTAIN_STATE : FlushMode::FLUSH_ALL);
WriteExit(WA); WriteExit(WA);
SwitchToNearCode(); if (conditional)
SwitchToNearCode();
if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0) if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0)
SetJumpTarget( pConditionDontBranch ); SetJumpTarget( pConditionDontBranch );