Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[ARM] Implement LFD. Reorder VFP register allocation a bit.
  • Loading branch information
Sonicadvance1 committed Jul 17, 2013
1 parent dc66b3d commit 86826b2
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 12 deletions.
1 change: 1 addition & 0 deletions Source/Core/Core/Src/PowerPC/JitArm32/Jit.h
Expand Up @@ -189,6 +189,7 @@ class JitArm : public JitBase, public ArmGen::ARMXCodeBlock

// Floating point loadStore
void lfs(UGeckoInstruction _inst);
void lfd(UGeckoInstruction _inst);
};

#endif // _JIT64_H
45 changes: 38 additions & 7 deletions Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp
Expand Up @@ -53,20 +53,51 @@ void JitArm::lfs(UGeckoInstruction inst)
else
MOVI2R(rB, (u32)inst.SIMM_16);

MOVI2R(rA, (u32)&Memory::Read_U32);
ARMReg v0 = fpr.R0(inst.FD, false);
ARMReg v1 = fpr.R1(inst.FD, false);

MOVI2R(rA, (u32)&Memory::Read_F32);
PUSH(4, R0, R1, R2, R3);
MOV(R0, rB);
BL(rA);
MOV(rA, R0);
// XXX: Need to use VCVT here.
VMOV(v0, D0);
VMOV(v1, D0);
POP(4, R0, R1, R2, R3);

gpr.Unlock(rA, rB);
SetJumpTarget(DoNotLoad);
}

void JitArm::lfd(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(LoadStoreFloating)

ARMReg rA = gpr.GetReg();
ARMReg rB = gpr.GetReg();
LDR(rA, R9, PPCSTATE_OFF(Exceptions));
CMP(rA, EXCEPTION_DSI);
FixupBranch DoNotLoad = B_CC(CC_EQ);

if (inst.RA)
{
MOVI2R(rB, inst.SIMM_16);
ARMReg RA = gpr.R(inst.RA);
ADD(rB, rB, RA);
}
else
MOVI2R(rB, (u32)inst.SIMM_16);

ARMReg v0 = fpr.R0(inst.FD, false);
ARMReg v1 = fpr.R1(inst.FD, false);

VMOV(v0, rA, false);
VMOV(v1, rA, false);

MOVI2R(rA, (u32)&Memory::Read_F64);
PUSH(4, R0, R1, R2, R3);
MOV(R0, rB);
BL(rA);
VMOV(v0, D0);
POP(4, R0, R1, R2, R3);

gpr.Unlock(rA, rB);
SetJumpTarget(DoNotLoad);
}

2 changes: 1 addition & 1 deletion Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Tables.cpp
Expand Up @@ -99,7 +99,7 @@ static GekkoOPTemplate primarytable[] =

{48, &JitArm::lfs}, //"lfs", OPTYPE_LOADFP, FL_IN_A}},
{49, &JitArm::Default}, //"lfsu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}},
{50, &JitArm::Default}, //"lfd", OPTYPE_LOADFP, FL_IN_A}},
{50, &JitArm::lfd}, //"lfd", OPTYPE_LOADFP, FL_IN_A}},
{51, &JitArm::Default}, //"lfdu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}},

{52, &JitArm::Default}, //"stfs", OPTYPE_STOREFP, FL_IN_A}},
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/Core/Src/PowerPC/JitArm32/JitFPRCache.cpp
Expand Up @@ -56,9 +56,9 @@ ARMReg *ArmFPRCache::GetPPCAllocationOrder(int &count)
// the ppc side.
static ARMReg allocationOrder[] =
{
D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D10,
D11, D12, D13, D14, D15, D16, D17, D18, D19,
D20, D21, D22, D23, D24, D25, D26, D27
D4, D5, D6, D7, D8, D9, D10, D11, D12, D13,
D14, D15, D16, D17, D18, D19, D20, D21, D22,
D23, D24, D25, D26, D27, D28, D29, D30, D31
};
count = sizeof(allocationOrder) / sizeof(const int);
return allocationOrder;
Expand All @@ -69,7 +69,7 @@ ARMReg *ArmFPRCache::GetAllocationOrder(int &count)
// the host side.
static ARMReg allocationOrder[] =
{
D31, D30, D29, D28
D0, D1, D2, D3
};
count = sizeof(allocationOrder) / sizeof(const int);
return allocationOrder;
Expand Down

0 comments on commit 86826b2

Please sign in to comment.