Implement prefetch_write() and prefetch_exec() wrappers

Do some refactoring to prefetch_read() in util/asm.hpp as well.
Make all these function constexpr because they are no-ops.
This commit is contained in:
Nekotekina 2020-11-24 08:18:31 +03:00
parent 5076da8f77
commit 43952e18e2
6 changed files with 57 additions and 23 deletions

View file

@ -869,7 +869,7 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this) noexcept
{
if (cpu != _this)
{
_m_prefetchw(&cpu->state);
utils::prefetch_write(&cpu->state);
return true;
}
@ -946,13 +946,13 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this) noexcept
{
for (u32 i = 0; i < work->prf_size; i++)
{
_m_prefetchw(work->prf_list[0]);
utils::prefetch_write(work->prf_list[0]);
}
}
cpu_counter::for_all_cpu(copy2, [&](cpu_thread* cpu)
{
_m_prefetchw(&cpu->state);
utils::prefetch_write(&cpu->state);
return true;
});

View file

@ -64,6 +64,7 @@
#include <thread>
#include <cfenv>
#include <cctype>
#include "util/asm.hpp"
#include "util/vm.hpp"
const bool s_use_ssse3 = utils::has_ssse3();
@ -1749,8 +1750,8 @@ static bool ppu_store_reservation(ppu_thread& ppu, u32 addr, u64 reg_value)
return false;
}
_m_prefetchw(ppu.rdata);
_m_prefetchw(ppu.rdata + 64);
utils::prefetch_read(ppu.rdata);
utils::prefetch_read(ppu.rdata + 64);
ppu.last_faddr = addr;
ppu.last_ftime = res.load() & -128;
ppu.last_ftsc = __rdtsc();

View file

@ -1932,7 +1932,7 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8*
range_lock = _this->range_lock;
}
_m_prefetchw(range_lock);
utils::prefetch_write(range_lock);
for (u32 size = args.size, size0; is_get; size -= size0, dst += size0, src += size0, eal += size0)
{
@ -2667,8 +2667,8 @@ bool spu_thread::do_putllc(const spu_mfc_cmd& args)
return false;
}
_m_prefetchw(rdata);
_m_prefetchw(rdata + 64);
utils::prefetch_read(rdata);
utils::prefetch_read(rdata + 64);
last_faddr = addr;
last_ftime = res.load() & -128;
last_ftsc = __rdtsc();