From fc23380f6b3ffb73380569627429d6788e4ad9fb Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 13 Aug 2015 23:21:38 +0200 Subject: [PATCH] JitArm64: Implement dcbt This is a 1:1 copy&paste from Jit64. --- Source/Core/Core/PowerPC/JitArm64/Jit.h | 1 + .../PowerPC/JitArm64/JitArm64_LoadStore.cpp | 20 +++++++++++++++++++ .../Core/PowerPC/JitArm64/JitArm64_Tables.cpp | 4 ++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.h b/Source/Core/Core/PowerPC/JitArm64/Jit.h index 20d3b8a4de..920b512ba9 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.h +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.h @@ -127,6 +127,7 @@ public: void stX(UGeckoInstruction inst); void lmw(UGeckoInstruction inst); void stmw(UGeckoInstruction inst); + void dcbt(UGeckoInstruction inst); // LoadStore floating point void lfXX(UGeckoInstruction inst); diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp index 133ff3e936..29f9bbddfe 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp @@ -623,3 +623,23 @@ void JitArm64::stmw(UGeckoInstruction inst) gpr.Unlock(WA, WB); } + +void JitArm64::dcbt(UGeckoInstruction inst) +{ + INSTRUCTION_START + JITDISABLE(bJITLoadStoreOff); + + // Prefetch. Since we don't emulate the data cache, we don't need to do anything. + + // If a dcbst follows a dcbt, it probably isn't a case of dynamic code + // modification, so don't bother invalidating the jit block cache. + // This is important because invalidating the block cache when we don't + // need to is terrible for performance. + // (Invalidating the jit block cache on dcbst is a heuristic.) + if (MergeAllowedNextInstructions(1) && + js.op[1].inst.OPCD == 31 && js.op[1].inst.SUBOP10 == 54 && + js.op[1].inst.RA == inst.RA && js.op[1].inst.RB == inst.RB) + { + js.skipInstructions = 1; + } +} diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp index 7bf211bdc5..f3d36791fa 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp @@ -222,8 +222,8 @@ static GekkoOPTemplate table31[] = {54, &JitArm64::FallBackToInterpreter}, // dcbst {86, &JitArm64::FallBackToInterpreter}, // dcbf - {246, &JitArm64::DoNothing}, // dcbtst - {278, &JitArm64::DoNothing}, // dcbt + {246, &JitArm64::dcbt}, // dcbtst + {278, &JitArm64::dcbt}, // dcbt {470, &JitArm64::FallBackToInterpreter}, // dcbi {758, &JitArm64::DoNothing}, // dcba {1014, &JitArm64::FallBackToInterpreter}, // dcbz