Skip to content

Commit

Permalink
Merge pull request #487 from Sonicadvance1/Fix-Conditional-branch
Browse files Browse the repository at this point in the history
Fix conditional branching on x86_64.
  • Loading branch information
Sonicadvance1 committed Jun 13, 2014
2 parents 5a66ded + 2152e81 commit 679f57e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Source/Core/Core/PowerPC/Jit64/Jit_Branch.cpp
Expand Up @@ -186,7 +186,7 @@ void Jit64::bcctrx(UGeckoInstruction inst)
branch = CC_Z;
else
branch = CC_NZ;
FixupBranch b = J_CC(branch, false);
FixupBranch b = J_CC(branch, true);
MOV(32, R(EAX), M(&CTR));
AND(32, R(EAX), Imm32(0xFFFFFFFC));
//MOV(32, M(&PC), R(EAX)); => Already done in WriteExitDestInEAX()
Expand Down Expand Up @@ -214,19 +214,19 @@ void Jit64::bclrx(UGeckoInstruction inst)
{
SUB(32, M(&CTR), Imm8(1));
if (inst.BO & BO_BRANCH_IF_CTR_0)
pCTRDontBranch = J_CC(CC_NZ);
pCTRDontBranch = J_CC(CC_NZ, true);
else
pCTRDontBranch = J_CC(CC_Z);
pCTRDontBranch = J_CC(CC_Z, true);
}

FixupBranch pConditionDontBranch;
if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0) // Test a CR bit
{
TEST(8, M(&PowerPC::ppcState.cr_fast[inst.BI >> 2]), Imm8(8 >> (inst.BI & 3)));
if (inst.BO & BO_BRANCH_IF_TRUE) // Conditional branch
pConditionDontBranch = J_CC(CC_Z);
pConditionDontBranch = J_CC(CC_Z, true);
else
pConditionDontBranch = J_CC(CC_NZ);
pConditionDontBranch = J_CC(CC_NZ, true);
}

// This below line can be used to prove that blr "eats flags" in practice.
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
Expand Up @@ -2194,7 +2194,7 @@ void Jit64::twx(UGeckoInstruction inst)
{
if (inst.TO & (1 << i))
{
FixupBranch f = J_CC(conditions[i]);
FixupBranch f = J_CC(conditions[i], true);
fixups.push_back(f);
}
}
Expand Down

0 comments on commit 679f57e

Please sign in to comment.