diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp index a92de073b4..d35f6d3a6e 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp @@ -368,43 +368,37 @@ void Jit64::dcbz(UGeckoInstruction inst) MOV(32, R(RSCRATCH), gpr.R(b)); if (a) ADD(32, R(RSCRATCH), gpr.R(a)); + AND(32, R(RSCRATCH), Imm32(~31)); - if (!UReg_MSR(MSR).DR) + if (UReg_MSR(MSR).DR) { - // If address translation is turned off, just call the general-case code. - AND(32, R(RSCRATCH), Imm32(~31)); - MOV(32, M(&PC), Imm32(jit->js.compilerPC)); - BitSet32 registersInUse = CallerSavedRegistersInUse(); - ABI_PushRegistersAndAdjustStack(registersInUse, 0); - ABI_CallFunctionR((void*)&PowerPC::ClearCacheLine, RSCRATCH); - ABI_PopRegistersAndAdjustStack(registersInUse, 0); - return; + // Perform lookup to see if we can use fast path. + MOV(32, R(RSCRATCH2), R(RSCRATCH)); + SHR(32, R(RSCRATCH2), Imm8(PowerPC::BAT_INDEX_SHIFT)); + TEST(32, MScaled(RSCRATCH2, SCALE_4, (u32)(u64)PowerPC::dbat_table), Imm32(2)); + FixupBranch slow = J_CC(CC_Z, true); + + // Fast path: compute full address, then zero out 32 bytes of memory. + PXOR(XMM0, R(XMM0)); + MOVAPS(MComplex(RMEM, RSCRATCH, SCALE_1, 0), XMM0); + MOVAPS(MComplex(RMEM, RSCRATCH, SCALE_1, 16), XMM0); + + // Slow path: call the general-case code. + SwitchToFarCode(); + SetJumpTarget(slow); } - - // Perform lookup to see if we can use fast path. - MOV(32, R(RSCRATCH2), R(RSCRATCH)); - SHR(32, R(RSCRATCH), Imm8(PowerPC::BAT_INDEX_SHIFT)); - TEST(32, MScaled(RSCRATCH, SCALE_4, (u32)(u64)PowerPC::dbat_table), Imm32(2)); - FixupBranch slow = J_CC(CC_Z, true); - - // Fast path: compute full address, then zero out 32 bytes of memory. - AND(32, R(RSCRATCH2), Imm8(~31)); - PXOR(XMM0, R(XMM0)); - MOVAPS(MComplex(RMEM, RSCRATCH2, SCALE_1, 0), XMM0); - MOVAPS(MComplex(RMEM, RSCRATCH2, SCALE_1, 16), XMM0); - - // Slow path: mask the address, then call the general-case code. - SwitchToFarCode(); - SetJumpTarget(slow); - AND(32, R(RSCRATCH2), Imm32(~31)); MOV(32, M(&PC), Imm32(jit->js.compilerPC)); BitSet32 registersInUse = CallerSavedRegistersInUse(); ABI_PushRegistersAndAdjustStack(registersInUse, 0); - ABI_CallFunctionR(&PowerPC::ClearCacheLine, RSCRATCH2); + ABI_CallFunctionR(&PowerPC::ClearCacheLine, RSCRATCH); ABI_PopRegistersAndAdjustStack(registersInUse, 0); - FixupBranch end = J(true); - SwitchToNearCode(); - SetJumpTarget(end); + + if (UReg_MSR(MSR).DR) + { + FixupBranch end = J(true); + SwitchToNearCode(); + SetJumpTarget(end); + } } void Jit64::stX(UGeckoInstruction inst)