Jit_Integer: twX

This commit is contained in:
MerryMage 2018-10-15 21:01:17 +01:00
parent 5621907283
commit c380764ed0
1 changed files with 22 additions and 13 deletions

View File

@ -1966,13 +1966,17 @@ void Jit64::twX(UGeckoInstruction inst)
if (inst.OPCD == 3) // twi if (inst.OPCD == 3) // twi
{ {
gpr.KillImmediate(a, true, false); RCOpArg Ra = gpr.UseNoImm(a, RCMode::Read);
CMP(32, gpr.R(a), Imm32((s32)(s16)inst.SIMM_16)); RegCache::Realize(Ra);
CMP(32, Ra, Imm32((s32)(s16)inst.SIMM_16));
} }
else // tw else // tw
{ {
gpr.BindToRegister(a, true, false); s32 b = inst.RB;
CMP(32, gpr.R(a), gpr.R(inst.RB)); RCX64Reg Ra = gpr.Bind(a, RCMode::Read);
RCOpArg Rb = gpr.Use(b, RCMode::Read);
RegCache::Realize(Ra, Rb);
CMP(32, Ra, Rb);
} }
constexpr std::array<CCFlags, 5> conditions{{CC_A, CC_B, CC_E, CC_G, CC_L}}; constexpr std::array<CCFlags, 5> conditions{{CC_A, CC_B, CC_E, CC_G, CC_L}};
@ -1988,17 +1992,22 @@ void Jit64::twX(UGeckoInstruction inst)
} }
FixupBranch dont_trap = J(); FixupBranch dont_trap = J();
for (const FixupBranch& fixup : fixups)
{ {
SetJumpTarget(fixup); RCForkGuard gpr_guard = gpr.Fork();
RCForkGuard fpr_guard = fpr.Fork();
for (const FixupBranch& fixup : fixups)
{
SetJumpTarget(fixup);
}
LOCK();
OR(32, PPCSTATE(Exceptions), Imm32(EXCEPTION_PROGRAM));
gpr.Flush();
fpr.Flush();
WriteExceptionExit();
} }
LOCK();
OR(32, PPCSTATE(Exceptions), Imm32(EXCEPTION_PROGRAM));
gpr.Flush(RegCache::FlushMode::MaintainState);
fpr.Flush(RegCache::FlushMode::MaintainState);
WriteExceptionExit();
SetJumpTarget(dont_trap); SetJumpTarget(dont_trap);