From 39ad48dfa56c7df6dd08a5e169878cb7877ef488 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Tue, 3 Sep 2013 09:55:15 +0000 Subject: [PATCH] [ARM] lmw implementation. --- Source/Core/Core/Src/PowerPC/JitArm32/Jit.h | 1 + .../Src/PowerPC/JitArm32/JitArm_LoadStore.cpp | 24 +++++++++++++++++++ .../Src/PowerPC/JitArm32/JitArm_Tables.cpp | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h b/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h index a04d9e0dd5..6bea38eee7 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h +++ b/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h @@ -179,6 +179,7 @@ public: // LoadStore void stX(UGeckoInstruction _inst); void lXX(UGeckoInstruction _inst); + void lmw(UGeckoInstruction _inst); void icbi(UGeckoInstruction _inst); void dcbst(UGeckoInstruction _inst); diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStore.cpp index 295de5af66..4abff14e15 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStore.cpp @@ -436,6 +436,30 @@ void JitArm::LoadToReg(ARMReg dest, ARMReg addr, int accessSize, s32 offset) gpr.Unlock(rA); } +// Some games use this heavily in video codecs +// We make the assumption that this pulls from main RAM at /all/ times +void JitArm::lmw(UGeckoInstruction inst) +{ + u32 a = inst.RA; + ARMReg rA = gpr.GetReg(); + ARMReg rB = gpr.GetReg(); + MOVI2R(rA, inst.SIMM_16); + if (a) + ADD(rA, rA, gpr.R(a)); + MOVI2R(rB, Memory::MEMVIEW32_MASK, false); // 1-2 + AND(rA, rA, rB); // 3 + MOVI2R(rB, (u32)Memory::base, false); // 4-5 + ADD(rA, rA, rB); // 6 + + for (int i = inst.RD; i < 32; i++) + { + ARMReg RX = gpr.R(i); + LDR(RX, rA, (i - inst.RD) * 4); + REV(RX, RX); + } + gpr.Unlock(rA, rB); +} + void JitArm::dcbst(UGeckoInstruction inst) { INSTRUCTION_START diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Tables.cpp b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Tables.cpp index 71c3e7c856..338de355df 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Tables.cpp +++ b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Tables.cpp @@ -94,7 +94,7 @@ static GekkoOPTemplate primarytable[] = {38, &JitArm::stX}, //"stb", OPTYPE_STORE, FL_IN_A | FL_IN_S}}, {39, &JitArm::stX}, //"stbu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}}, - {46, &JitArm::Default}, //"lmw", OPTYPE_SYSTEM, FL_EVIL, 10}}, + {46, &JitArm::lmw}, //"lmw", OPTYPE_SYSTEM, FL_EVIL, 10}}, {47, &JitArm::Default}, //"stmw", OPTYPE_SYSTEM, FL_EVIL, 10}}, {48, &JitArm::lfs}, //"lfs", OPTYPE_LOADFP, FL_IN_A}},