Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various issues with the twi/tw instructions #1017

Merged
merged 2 commits into from
Sep 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ void Interpreter::tw(UGeckoInstruction _inst)
s32 b = m_GPR[_inst.RB];
s32 TO = _inst.TO;

ERROR_LOG(POWERPC, "tw rA %0x rB %0x TO %0x", a, b, TO);
DEBUG_LOG(POWERPC, "tw rA %0x rB %0x TO %0x", a, b, TO);

if (((a < b) && (TO & 0x10)) ||
((a > b) && (TO & 0x08)) ||
Expand Down
6 changes: 4 additions & 2 deletions Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1997,10 +1997,12 @@ void Jit64::twx(UGeckoInstruction inst)

s32 a = inst.RA;

gpr.KillImmediate(a, true, false);

if (inst.OPCD == 3) // twi
CMP(32, gpr.R(a), gpr.R(inst.RB));
else // tw
CMP(32, gpr.R(a), Imm32((s32)(s16)inst.SIMM_16));
else // tw
CMP(32, gpr.R(a), gpr.R(inst.RB));

This comment was marked as off-topic.


std::vector<FixupBranch> fixups;
CCFlags conditions[] = { CC_A, CC_B, CC_E, CC_G, CC_L };
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Core/PowerPC/JitArm32/JitArm_Integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -915,12 +915,12 @@ void JitArm::twx(UGeckoInstruction inst)

if (inst.OPCD == 3) // twi
{
CMP(gpr.R(a), gpr.R(inst.RB));
MOVI2R(RB, (s32)(s16)inst.SIMM_16);
CMP(gpr.R(a), RB);
}
else // tw
{
MOVI2R(RB, (s32)(s16)inst.SIMM_16);
CMP(gpr.R(a), RB);
CMP(gpr.R(a), gpr.R(inst.RB));
}

FixupBranch al = B_CC(CC_LT);
Expand Down