Skip to content

Commit

Permalink
[ARM] Fix IMM support in the register cache.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonicadvance1 committed Aug 5, 2013
1 parent 0d2083c commit 4752eae
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
15 changes: 10 additions & 5 deletions Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Integer.cpp
Expand Up @@ -59,18 +59,23 @@ void JitArm::addi(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(Integer)

ARMReg RD = gpr.R(inst.RD);

if (inst.RA)
u32 d = inst.RD, a = inst.RA;
if (a)
{

if (gpr.IsImm(a) && gpr.IsImm(d))
{
gpr.SetImmediate(d, gpr.GetImm(d) + gpr.GetImm(a) + inst.SIMM_16);
return;
}
ARMReg rA = gpr.GetReg(false);
ARMReg RA = gpr.R(inst.RA);
ARMReg RD = gpr.R(inst.RD);
MOVI2R(rA, (u32)inst.SIMM_16);
ADD(RD, RA, rA);
}
else
MOVI2R(RD, inst.SIMM_16);
gpr.SetImmediate(d, inst.SIMM_16);
}
void JitArm::addis(UGeckoInstruction inst)
{
Expand Down
12 changes: 12 additions & 0 deletions Source/Core/Core/Src/PowerPC/JitArm32/JitRegCache.cpp
Expand Up @@ -194,6 +194,18 @@ ARMReg ArmRegCache::BindToRegister(u32 preg)
}
}

void ArmRegCache::SetImmediate(u32 preg, u32 imm)
{
if (regs[preg].GetType() == REG_REG)
{
// Dump real reg at this point
u32 regindex = regs[preg].GetRegIndex();
ArmCRegs[regindex].PPCReg = 33;
ArmCRegs[regindex].LastLoad = 0;
}
regs[preg].LoadToImm(imm);
}

void ArmRegCache::Flush()
{
for (u8 a = 0; a < 32; ++a)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/PowerPC/JitArm32/JitRegCache.h
Expand Up @@ -134,7 +134,7 @@ class ArmRegCache
ARMReg R(u32 preg); // Returns a cached register
bool IsImm(u32 preg) { return regs[preg].GetType() == REG_IMM; }
u32 GetImm(u32 preg) { return regs[preg].GetImm(); }
void SetImmediate(u32 preg, u32 imm) { regs[preg].LoadToImm(imm); }
void SetImmediate(u32 preg, u32 imm);
ARMReg BindToRegister(u32 preg);
};

Expand Down

0 comments on commit 4752eae

Please sign in to comment.