Jit64: Optimize dcbx being called in a loop over a large memory region.

This commit is contained in:
Admiral H. Curtiss
2021-08-10 20:40:01 +02:00
parent df1e59409b
commit 8b2f5d5006
3 changed files with 116 additions and 6 deletions

View File

@ -230,6 +230,22 @@ void InvalidateICacheLine(u32 address)
g_jit->GetBlockCache()->InvalidateICacheLine(address);
}
void InvalidateICacheLines(u32 address, u32 count)
{
// This corresponds to a PPC code loop that:
// - calls some form of dcb* instruction on 'address'
// - increments 'address' by the size of a cache line (0x20 bytes)
// - decrements 'count' by 1
// - jumps back to the dcb* instruction if 'count' != 0
// with an extra optimization for the case of a single cache line invalidation
if (count == 1)
InvalidateICacheLine(address);
if (count == 0 || count >= static_cast<u32>(0x1'0000'0000 / 32))
InvalidateICache(address & ~0x1f, 0xffffffff, false);
else
InvalidateICache(address & ~0x1f, 32 * count, false);
}
void CompileExceptionCheck(ExceptionType type)
{
if (!g_jit)