JitArm64: zero extend RC for cmpli

Patch written by HdkR
This commit is contained in:
degasus 2015-08-01 08:59:14 +02:00
parent 4c5fec4772
commit b9f5bfb2bd
2 changed files with 19 additions and 12 deletions

View File

@ -240,8 +240,8 @@ private:
FixupBranch JumpIfCRFieldBit(int field, int bit, bool jump_if_set);
void ComputeRC(Arm64Gen::ARM64Reg reg, int crf = 0);
void ComputeRC(u32 imm, int crf = 0);
void ComputeRC(Arm64Gen::ARM64Reg reg, int crf = 0, bool needs_sext = true);
void ComputeRC(u64 imm, int crf = 0, bool needs_sext = true);
void ComputeCarry(bool Carry);
void ComputeCarry();

View File

@ -15,24 +15,31 @@
using namespace Arm64Gen;
void JitArm64::ComputeRC(ARM64Reg reg, int crf)
void JitArm64::ComputeRC(ARM64Reg reg, int crf, bool needs_sext)
{
ARM64Reg WA = gpr.GetReg();
ARM64Reg XA = EncodeRegTo64(WA);
if (needs_sext)
{
ARM64Reg WA = gpr.GetReg();
ARM64Reg XA = EncodeRegTo64(WA);
SXTW(XA, reg);
SXTW(XA, reg);
STR(INDEX_UNSIGNED, XA, X29, PPCSTATE_OFF(cr_val[crf]));
gpr.Unlock(WA);
STR(INDEX_UNSIGNED, XA, X29, PPCSTATE_OFF(cr_val[crf]));
gpr.Unlock(WA);
}
else
{
STR(INDEX_UNSIGNED, EncodeRegTo64(reg), X29, PPCSTATE_OFF(cr_val[crf]));
}
}
void JitArm64::ComputeRC(u32 imm, int crf)
void JitArm64::ComputeRC(u64 imm, int crf, bool needs_sext)
{
ARM64Reg WA = gpr.GetReg();
ARM64Reg XA = EncodeRegTo64(WA);
MOVI2R(XA, imm);
if (imm & 0x80000000)
if (imm & 0x80000000 && needs_sext)
SXTW(XA, WA);
STR(INDEX_UNSIGNED, XA, X29, PPCSTATE_OFF(cr_val[crf]));
@ -472,13 +479,13 @@ void JitArm64::cmpli(UGeckoInstruction inst)
if (gpr.IsImm(a))
{
ComputeRC(gpr.GetImm(a) - inst.UIMM, crf);
ComputeRC((u64)gpr.GetImm(a) - inst.UIMM, crf, false);
return;
}
if (!inst.UIMM)
{
ComputeRC(gpr.R(a), crf);
ComputeRC(gpr.R(a), crf, false);
return;
}