diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index 2207a60bbe..16ef40787d 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -668,9 +668,6 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc fpr.Start(); js.downcountAmount = 0; - if (!SConfig::GetInstance().bEnableDebugging) - js.downcountAmount += PatchEngine::GetSpeedhackCycles(code_block.m_address); - js.skipInstructions = 0; js.carryFlagSet = false; js.carryFlagInverted = false; @@ -728,6 +725,9 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc js.revertGprLoad = -1; js.revertFprLoad = -1; + if (!SConfig::GetInstance().bEnableDebugging) + js.downcountAmount += PatchEngine::GetSpeedhackCycles(js.compilerPC); + if (i == (code_block.m_num_instructions - 1)) { if (Profiler::g_ProfileBlocks) diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp index 9674a2e6fe..1a7dc42ef6 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp +++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp @@ -582,8 +582,6 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc ibuild.Reset(); js.downcountAmount = 0; - if (!SConfig::GetInstance().bEnableDebugging) - js.downcountAmount += PatchEngine::GetSpeedhackCycles(code_block.m_address); // Translate instructions for (u32 i = 0; i < code_block.m_num_instructions; i++) @@ -594,6 +592,9 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc const GekkoOPInfo* opinfo = GetOpInfo(ops[i].inst); js.downcountAmount += opinfo->numCycles; + if (!SConfig::GetInstance().bEnableDebugging) + js.downcountAmount += PatchEngine::GetSpeedhackCycles(js.compilerPC); + if (i == (code_block.m_num_instructions - 1)) js.isLastInstruction = true; diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp index d12c542399..bdade4d139 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp @@ -481,9 +481,6 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitB gpr.Start(js.gpa); fpr.Start(js.fpa); - if (!SConfig::GetInstance().bEnableDebugging) - js.downcountAmount += PatchEngine::GetSpeedhackCycles(em_address); - // Translate instructions for (u32 i = 0; i < code_block.m_num_instructions; i++) { @@ -493,12 +490,10 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitB js.instructionsLeft = (code_block.m_num_instructions - 1) - i; const GekkoOPInfo* opinfo = ops[i].opinfo; js.downcountAmount += opinfo->numCycles; + js.isLastInstruction = i == (code_block.m_num_instructions - 1); - if (i == (code_block.m_num_instructions - 1)) - { - // WARNING - cmp->branch merging will screw this up. - js.isLastInstruction = true; - } + if (!SConfig::GetInstance().bEnableDebugging) + js.downcountAmount += PatchEngine::GetSpeedhackCycles(js.compilerPC); // Gather pipe writes using a non-immediate address are discovered by profiling. bool gatherPipeIntCheck =