From 637851fce0c588063e584dde1b46a59a804648ed Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 5 Mar 2016 15:11:15 +0100 Subject: [PATCH] JitArm64: optimize bclrx the unconditional path is the most common, so no need to switch to far code here. --- .../Core/PowerPC/JitArm64/JitArm64_Branch.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Branch.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Branch.cpp index 4871fa1e22..773736a935 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Branch.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Branch.cpp @@ -216,6 +216,8 @@ void JitArm64::bclrx(UGeckoInstruction inst) INSTRUCTION_START JITDISABLE(bJITBranchOff); + bool conditional = (inst.BO & BO_DONT_DECREMENT_FLAG) == 0 || (inst.BO & BO_DONT_CHECK_CONDITION) == 0; + ARM64Reg WA = gpr.GetReg(); FixupBranch pCTRDontBranch; 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)); } - FixupBranch far = B(); - SwitchToFarCode(); - SetJumpTarget(far); + if (conditional) + { + FixupBranch far = B(); + SwitchToFarCode(); + SetJumpTarget(far); + } LDR(INDEX_UNSIGNED, WA, PPC_REG, PPCSTATE_OFF(spr[SPR_LR])); AND(WA, WA, 30, 29); // Wipe the bottom 2 bits. @@ -252,12 +257,13 @@ void JitArm64::bclrx(UGeckoInstruction inst) gpr.Unlock(WB); } - gpr.Flush(FlushMode::FLUSH_MAINTAIN_STATE); - fpr.Flush(FlushMode::FLUSH_MAINTAIN_STATE); + gpr.Flush(conditional ? FlushMode::FLUSH_MAINTAIN_STATE : FlushMode::FLUSH_ALL); + fpr.Flush(conditional ? FlushMode::FLUSH_MAINTAIN_STATE : FlushMode::FLUSH_ALL); WriteExit(WA); - SwitchToNearCode(); + if (conditional) + SwitchToNearCode(); if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0) SetJumpTarget( pConditionDontBranch );