diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.h b/Source/Core/Core/Src/PowerPC/Jit64/Jit.h index d02b2ccc53..8e3f637904 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.h @@ -275,6 +275,10 @@ public: void lbzx(UGeckoInstruction inst); void lwzx(UGeckoInstruction inst); void lhax(UGeckoInstruction inst); + + void lwzux(UGeckoInstruction inst); + + void stwux(UGeckoInstruction inst); void lmw(UGeckoInstruction inst); void stmw(UGeckoInstruction inst); diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp index 086ac074fd..acfc331ce2 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp @@ -230,6 +230,31 @@ return; } + void Jit64::lwzux(UGeckoInstruction inst) + { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + {Default(inst); return;} // turn off from debugger + INSTRUCTION_START; + + int a = inst.RA, b = inst.RB, d = inst.RD; + if (!a || a == d || a == b) + { + Default(inst); + return; + } + gpr.Lock(a, b, d); + + gpr.LoadToX64(d, b == d, true); + gpr.LoadToX64(a, true, true); + ADD(32, gpr.R(a), gpr.R(b)); + MOV(32, R(EAX), gpr.R(a)); + SafeLoadRegToEAX(EAX, 32, 0, false); + MOV(32, gpr.R(d), R(EAX)); + + gpr.UnlockAll(); + return; + } + // Zero cache line. void Jit64::dcbz(UGeckoInstruction inst) { @@ -390,6 +415,32 @@ } } + void Jit64::stwux(UGeckoInstruction inst) + { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + {Default(inst); return;} // turn off from debugger + INSTRUCTION_START; + + int a = inst.RA, b = inst.RB, s = inst.RS; + if (!a || a == s || a == b) + { + Default(inst); + return; + } + gpr.Lock(a, b, s); + gpr.FlushLockX(ABI_PARAM1, ABI_PARAM2); + + gpr.LoadToX64(a, true, true); + ADD(32, gpr.R(a), gpr.R(b)); + MOV(32, R(ABI_PARAM2), gpr.R(a)); + MOV(32, R(ABI_PARAM1), gpr.R(s)); + SafeWriteRegToReg(ABI_PARAM1, ABI_PARAM2, 32, 0); + + gpr.UnlockAll(); + gpr.UnlockAllX(); + return; + } + // A few games use these heavily in video codecs. void Jit64::lmw(UGeckoInstruction inst) { diff --git a/Source/Core/Core/Src/PowerPC/PPCTables.cpp b/Source/Core/Core/Src/PowerPC/PPCTables.cpp index fbe51954ed..1e6887c191 100644 --- a/Source/Core/Core/Src/PowerPC/PPCTables.cpp +++ b/Source/Core/Core/Src/PowerPC/PPCTables.cpp @@ -311,7 +311,7 @@ static GekkoOPTemplate table31[] = //load word {23, Interpreter::lwzx, &Jit64::lwzx, {"lwzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}}, - {55, Interpreter::lwzux, &Jit64::Default, {"lwzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}}, + {55, Interpreter::lwzux, &Jit64::lwzux, {"lwzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}}, //load halfword {279, Interpreter::lhzx, &Jit64::Default, {"lhzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}}, @@ -339,7 +339,7 @@ static GekkoOPTemplate table31[] = //store word {151, Interpreter::stwx, &Jit64::Default, {"stwx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}}, - {183, Interpreter::stwux, &Jit64::Default, {"stwux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}}, + {183, Interpreter::stwux, &Jit64::stwux, {"stwux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}}, //store halfword {407, Interpreter::sthx, &Jit64::Default, {"sthx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},