[ARM] Some initial support for immediates in integer. Plenty more to go.

This commit is contained in:
Ryan Houdek 2013-08-05 19:48:15 +00:00
parent 4752eae677
commit 873987bc99
1 changed files with 33 additions and 15 deletions

View File

@ -59,18 +59,18 @@ void JitArm::addi(UGeckoInstruction inst)
{ {
INSTRUCTION_START INSTRUCTION_START
JITDISABLE(Integer) JITDISABLE(Integer)
u32 d = inst.RD, a = inst.RA; u32 d = inst.RD, a = inst.RA;
if (a) if (a)
{ {
if (gpr.IsImm(a))
if (gpr.IsImm(a) && gpr.IsImm(d))
{ {
gpr.SetImmediate(d, gpr.GetImm(d) + gpr.GetImm(a) + inst.SIMM_16); gpr.SetImmediate(d, gpr.GetImm(a) + inst.SIMM_16);
return; return;
} }
ARMReg rA = gpr.GetReg(false); ARMReg rA = gpr.GetReg(false);
ARMReg RA = gpr.R(inst.RA); ARMReg RA = gpr.R(a);
ARMReg RD = gpr.R(inst.RD); ARMReg RD = gpr.R(d);
MOVI2R(rA, (u32)inst.SIMM_16); MOVI2R(rA, (u32)inst.SIMM_16);
ADD(RD, RA, rA); ADD(RD, RA, rA);
} }
@ -82,16 +82,22 @@ void JitArm::addis(UGeckoInstruction inst)
INSTRUCTION_START INSTRUCTION_START
JITDISABLE(Integer) JITDISABLE(Integer)
ARMReg RD = gpr.R(inst.RD); u32 d = inst.RD, a = inst.RA;
if (inst.RA) if (a)
{ {
if (gpr.IsImm(a))
{
gpr.SetImmediate(d, gpr.GetImm(a) + (inst.SIMM_16 << 16));
return;
}
ARMReg rA = gpr.GetReg(false); ARMReg rA = gpr.GetReg(false);
ARMReg RA = gpr.R(inst.RA); ARMReg RA = gpr.R(a);
ARMReg RD = gpr.R(d);
MOVI2R(rA, inst.SIMM_16 << 16); MOVI2R(rA, inst.SIMM_16 << 16);
ADD(RD, RA, rA); ADD(RD, RA, rA);
} }
else else
MOVI2R(RD, inst.SIMM_16 << 16); gpr.SetImmediate(d, inst.SIMM_16 << 16);
} }
void JitArm::addx(UGeckoInstruction inst) void JitArm::addx(UGeckoInstruction inst)
{ {
@ -120,9 +126,15 @@ void JitArm::mulli(UGeckoInstruction inst)
{ {
INSTRUCTION_START INSTRUCTION_START
JITDISABLE(Integer) JITDISABLE(Integer)
u32 a = inst.RA, d = inst.RD;
ARMReg RA = gpr.R(inst.RA); if (gpr.IsImm(a))
ARMReg RD = gpr.R(inst.RD); {
gpr.SetImmediate(d, gpr.GetImm(a) * inst.SIMM_16);
return;
}
ARMReg RA = gpr.R(a);
ARMReg RD = gpr.R(d);
ARMReg rA = gpr.GetReg(); ARMReg rA = gpr.GetReg();
MOVI2R(rA, inst.SIMM_16); MOVI2R(rA, inst.SIMM_16);
MUL(RD, RA, rA); MUL(RD, RA, rA);
@ -133,9 +145,15 @@ void JitArm::ori(UGeckoInstruction inst)
{ {
INSTRUCTION_START INSTRUCTION_START
JITDISABLE(Integer) JITDISABLE(Integer)
u32 a = inst.RA, s = inst.RS;
ARMReg RA = gpr.R(inst.RA); if (gpr.IsImm(s))
ARMReg RS = gpr.R(inst.RS); {
gpr.SetImmediate(s, gpr.GetImm(a) | inst.UIMM);
return;
}
ARMReg RA = gpr.R(a);
ARMReg RS = gpr.R(s);
ARMReg rA = gpr.GetReg(); ARMReg rA = gpr.GetReg();
MOVI2R(rA, inst.UIMM); MOVI2R(rA, inst.UIMM);
ORR(RA, RS, rA); ORR(RA, RS, rA);