atomic.hpp: add some features and optimizations

Add atomic_t<>::observe() (relaxed load)
Add atomic_fence_XXX() (barrier functions)
Get rid of MFENCE instruction, replace with no-op LOCK OR on stack.
Remove <atomic> dependence from stdafx.h and relevant headers.
This commit is contained in:
Nekotekina 2020-12-06 12:10:00 +03:00
parent 77aa9e58f2
commit b16cc618b5
14 changed files with 171 additions and 60 deletions

View file

@ -1208,7 +1208,7 @@ static T ppu_load_acquire_reservation(ppu_thread& ppu, u32 addr)
perf_meter<"LARX"_u32> perf0;
// Do not allow stores accessed from the same cache line to past reservation load
std::atomic_thread_fence(std::memory_order_seq_cst);
atomic_fence_seq_cst();
if (addr % sizeof(T))
{
@ -1322,7 +1322,7 @@ static T ppu_load_acquire_reservation(ppu_thread& ppu, u32 addr)
else
{
mov_rdata(ppu.rdata, vm::_ref<spu_rdata_t>(addr & -128));
std::atomic_thread_fence(std::memory_order_acquire);
atomic_fence_acquire();
// Load relevant 64 bits of reservation data
std::memcpy(&rdata, &ppu.rdata[addr & 0x78], 8);