[ARM32] Adds unsigned compares.

Superscedes PR #1131.
Optimizes cmpi a bit.
This commit is contained in:
Ryan Houdek 2014-11-29 04:47:04 +00:00
parent 581ab9edec
commit e2f8286415
3 changed files with 57 additions and 4 deletions

View File

@ -178,7 +178,9 @@ public:
void subfic(UGeckoInstruction _inst);
void cntlzwx(UGeckoInstruction _inst);
void cmp (UGeckoInstruction _inst);
void cmpl(UGeckoInstruction _inst);
void cmpi(UGeckoInstruction _inst);
void cmpli(UGeckoInstruction _inst);
void negx(UGeckoInstruction _inst);
void mulhwux(UGeckoInstruction _inst);
void rlwimix(UGeckoInstruction _inst);

View File

@ -825,10 +825,34 @@ void JitArm::cmp (UGeckoInstruction inst)
gpr.Unlock(rA);
}
void JitArm::cmpl(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITIntegerOff);
int crf = inst.CRFD;
u32 a = inst.RA, b = inst.RB;
if (gpr.IsImm(a) && gpr.IsImm(b))
{
ComputeRC(gpr.GetImm(a) - gpr.GetImm(b), crf);
return;
}
else if (gpr.IsImm(b) && !gpr.GetImm(b))
{
ComputeRC(gpr.R(a), crf);
return;
}
FALLBACK_IF(true);
}
void JitArm::cmpi(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITIntegerOff);
u32 a = inst.RA;
int crf = inst.CRFD;
if (gpr.IsImm(a))
@ -838,10 +862,15 @@ void JitArm::cmpi(UGeckoInstruction inst)
}
ARMReg rA = gpr.GetReg();
ARMReg RA = gpr.R(a);
bool negated = false;
Operand2 off;
if (inst.SIMM_16 >= 0 && inst.SIMM_16 < 256)
if (TryMakeOperand2_AllowNegation(inst.SIMM_16, off, &negated))
{
SUB(rA, RA, inst.SIMM_16);
if (negated)
ADD(rA, RA, off);
else
SUB(rA, RA, off);
}
else
{
@ -853,6 +882,28 @@ void JitArm::cmpi(UGeckoInstruction inst)
gpr.Unlock(rA);
}
void JitArm::cmpli(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITIntegerOff);
u32 a = inst.RA;
int crf = inst.CRFD;
if (gpr.IsImm(a))
{
ComputeRC(gpr.GetImm(a) - inst.UIMM, crf);
return;
}
if (!inst.UIMM)
{
ComputeRC(gpr.R(a), crf);
return;
}
FALLBACK_IF(true);
}
void JitArm::negx(UGeckoInstruction inst)
{
INSTRUCTION_START

View File

@ -47,7 +47,7 @@ static GekkoOPTemplate primarytable[] =
{7, &JitArm::arith}, //"mulli", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_RC_BIT, 2}},
{8, &JitArm::subfic}, //"subfic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
{10, &JitArm::FallBackToInterpreter}, //"cmpli", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
{10, &JitArm::cmpli}, //"cmpli", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
{11, &JitArm::cmpi}, //"cmpi", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
{12, &JitArm::arith}, //"addic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
{13, &JitArm::arith}, //"addic_rc", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CR0}},
@ -190,7 +190,7 @@ static GekkoOPTemplate table31[] =
{476, &JitArm::arith}, //"nandx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
{284, &JitArm::arith}, //"eqvx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
{0, &JitArm::cmp}, //"cmp", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}},
{32, &JitArm::FallBackToInterpreter}, //"cmpl", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}},
{32, &JitArm::cmpl}, //"cmpl", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}},
{26, &JitArm::cntlzwx}, //"cntlzwx",OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
{922, &JitArm::extshx}, //"extshx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
{954, &JitArm::extsbx}, //"extsbx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},