Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[ARM] lfsu implementation.
  • Loading branch information
Sonicadvance1 committed Sep 14, 2013
1 parent aaf8e92 commit 0ae8fa9
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 7 deletions.
1 change: 1 addition & 0 deletions Source/Core/Core/Src/PowerPC/JitArm32/Jit.h
Expand Up @@ -198,6 +198,7 @@ class JitArm : public JitBase, public ArmGen::ARMXCodeBlock

// Floating point loadStore
void lfs(UGeckoInstruction _inst);
void lfsu(UGeckoInstruction _inst);
void lfsx(UGeckoInstruction _inst);
void lfd(UGeckoInstruction _inst);
void stfs(UGeckoInstruction _inst);
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Integer.cpp
Expand Up @@ -27,7 +27,6 @@
#include "JitRegCache.h"
#include "JitAsm.h"
extern u32 Helper_Mask(u8 mb, u8 me);
// ADDI and RLWINMX broken for now

// Assumes that Sign and Zero flags were set by the last operation. Preserves all flags and registers.
// Jit64 ComputerRC is signed
Expand Down Expand Up @@ -204,9 +203,9 @@ void JitArm::arith(UGeckoInstruction inst)
isImm[1] = true;
Imm[1] = inst.UIMM << (shiftedImm ? 16 : 0);
break;
case 29: // addis_rc
case 29: // andis_rc
shiftedImm = true;
case 28: // addi_rc
case 28: // andi_rc
if (gpr.IsImm(s))
{
isImm[0] = true;
Expand Down
41 changes: 38 additions & 3 deletions Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp
Expand Up @@ -56,19 +56,54 @@ void JitArm::lfs(UGeckoInstruction inst)
CMP(rA, EXCEPTION_DSI);
FixupBranch DoNotLoad = B_CC(CC_EQ);

MOVI2R(rA, (u32)&Memory::Read_F32);
MOVI2R(rA, (u32)&Memory::Read_U32);
PUSH(4, R0, R1, R2, R3);
MOV(R0, rB);
BL(rA);

#if !defined(__ARM_PCS_VFP) // SoftFP returns in R0
VMOV(S0, R0);
#endif

VCVT(v0, S0, 0);
VCVT(v1, S0, 0);
POP(4, R0, R1, R2, R3);

gpr.Unlock(rA, rB);
SetJumpTarget(DoNotLoad);
}
void JitArm::lfsu(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITLoadStoreFloatingOff)

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

ARMReg rA = gpr.GetReg();
ARMReg rB = gpr.GetReg();

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

MOVI2R(rB, inst.SIMM_16);
ADD(rB, rB, RA);

LDR(rA, R9, PPCSTATE_OFF(Exceptions));
CMP(rA, EXCEPTION_DSI);
FixupBranch DoNotLoad = B_CC(CC_EQ);

MOVI2R(rA, (u32)&Memory::Read_U32);

MOV(RA, rB);
PUSH(4, R0, R1, R2, R3);
MOV(R0, rB);
BL(rA);

VMOV(S0, R0);

VCVT(v0, S0, 0);
VCVT(v1, S0, 0);
POP(4, R0, R1, R2, R3);


gpr.Unlock(rA, rB);
SetJumpTarget(DoNotLoad);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Tables.cpp
Expand Up @@ -98,7 +98,7 @@ static GekkoOPTemplate primarytable[] =
{47, &JitArm::Default}, //"stmw", OPTYPE_SYSTEM, FL_EVIL, 10}},

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

Expand Down

0 comments on commit 0ae8fa9

Please sign in to comment.