diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp index 353a560665..6a07ec274c 100644 --- a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp @@ -120,7 +120,7 @@ void JitArm::SafeStoreFromReg(s32 dest, u32 value, s32 regOffset, int accessSize if (is_immediate) { - if ((imm_addr & 0xFFFFF000) == 0xCC008000 && jit->jo.optimizeGatherPipe) + if (jit->jo.optimizeGatherPipe && PowerPC::IsOptimizableGatherPipeWrite(imm_addr)) { MOVI2R(R14, (u32)&GPFifo::m_gatherPipeCount); MOVI2R(R10, (u32)GPFifo::m_gatherPipe); diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp index ec232915b7..17b62e29f5 100644 --- a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp +++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp @@ -350,7 +350,7 @@ void JitArm::stfXX(UGeckoInstruction inst) if (is_immediate) { - if ((imm_addr & 0xFFFFF000) == 0xCC008000 && jit->jo.optimizeGatherPipe) + if (jit->jo.optimizeGatherPipe && PowerPC::IsOptimizableGatherPipeWrite(imm_addr)) { int accessSize; if (flags & BackPatchInfo::FLAG_SIZE_F64) diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStoreFloating.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStoreFloating.cpp index 21b8cbd897..21da40da3f 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStoreFloating.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStoreFloating.cpp @@ -371,7 +371,7 @@ void JitArm64::stfXX(UGeckoInstruction inst) if (is_immediate) { - if ((imm_addr & 0xFFFFF000) == 0xCC008000 && jit->jo.optimizeGatherPipe) + if (jit->jo.optimizeGatherPipe && PowerPC::IsOptimizableGatherPipeWrite(imm_addr)) { int accessSize; if (flags & BackPatchInfo::FLAG_SIZE_F64) diff --git a/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp b/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp index a3833661dc..dfda1c3917 100644 --- a/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp +++ b/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp @@ -477,7 +477,7 @@ bool EmuCodeBlock::WriteToConstAddress(int accessSize, OpArg arg, u32 address, B // If we already know the address through constant folding, we can do some // fun tricks... - if ((address & 0xFFFFF000) == 0xCC008000 && jit->jo.optimizeGatherPipe) + if (jit->jo.optimizeGatherPipe && PowerPC::IsOptimizableGatherPipeWrite(address)) { if (!arg.IsSimpleReg() || arg.GetSimpleReg() != RSCRATCH) MOV(accessSize, R(RSCRATCH), arg); diff --git a/Source/Core/Core/PowerPC/MMU.cpp b/Source/Core/Core/PowerPC/MMU.cpp index a27dc17aa0..18b7aad61c 100644 --- a/Source/Core/Core/PowerPC/MMU.cpp +++ b/Source/Core/Core/PowerPC/MMU.cpp @@ -763,6 +763,14 @@ u32 IsOptimizableMMIOAccess(u32 address, u32 accessSize) return translated; } +bool IsOptimizableGatherPipeWrite(u32 address) +{ + if (!UReg_MSR(MSR).DR) + return false; + + return address == 0xCC008000; +} + // ********************************************************************************* // Warning: Test Area // diff --git a/Source/Core/Core/PowerPC/PowerPC.h b/Source/Core/Core/PowerPC/PowerPC.h index d9af264eaa..bcdec4c573 100644 --- a/Source/Core/Core/PowerPC/PowerPC.h +++ b/Source/Core/Core/PowerPC/PowerPC.h @@ -270,6 +270,7 @@ void InvalidateTLBEntry(u32 address); // memory access. Does not consider page tables. bool IsOptimizableRAMAddress(const u32 address); u32 IsOptimizableMMIOAccess(u32 address, u32 accessSize); +bool IsOptimizableGatherPipeWrite(u32 address); } // namespace