Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPU: Enable PUTLLC16 with RTIME checks #15686

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
SPU: Enable PUTLLC16 with RTIME checks
  • Loading branch information
elad335 committed Jun 10, 2024
commit 3886c9c3316ca6afc495b00ae7ef4ae4d625567b
6 changes: 0 additions & 6 deletions rpcs3/Emu/Cell/SPUCommonRecompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6686,12 +6686,6 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point, s
auto& stats = g_fxo->get<putllc16_statistics_t>();
had_putllc_evaluation = true;

if (!g_cfg.core.spu_debug)
{
// TODO
continue;
}

if (!pattern.ls_write)
{
spu_log.success("PUTLLC0 Pattern Detected! (put_pc=0x%x, %s) (putllc0=%d, putllc16+0=%d, all=%d)", pattern.put_pc, func_hash, ++stats.nowrite, ++stats.single, +stats.all);
Expand Down
9 changes: 5 additions & 4 deletions rpcs3/Emu/Cell/SPULLVMRecompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1221,9 +1221,10 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
return;
}

const u64 rtime = _spu->rtime;
auto& res = vm::reservation_acquire(eal);

if (res & 127)
if (res != rtime)
{
_spu->ch_atomic_stat.set_value(MFC_PUTLLC_FAILURE);
_spu->set_events(SPU_EVENT_LR);
Expand All @@ -1234,11 +1235,11 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
rsx::reservation_lock rsx_lock(raddr, 128);

// Touch memory
vm::_ref<atomic_t<u8>>(dest).compare_and_swap_test(0, 0);
vm::_ref<atomic_t<u8>>(dest ^ (4096 / 2)).compare_and_swap_test(0, 0);

auto [old_res, ok] = res.fetch_op([&](u64& rval)
{
if (rval & 127)// || rtime != rval)
if (rtime != rval)
{
return false;
}
Expand Down Expand Up @@ -1293,7 +1294,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
const auto _new = m_ir->CreateAlignedLoad(get_type<u128>(), _ptr<u128>(m_lsptr, dest), llvm::MaybeAlign{16});
const auto _rdata = m_ir->CreateAlignedLoad(get_type<u128>(), _ptr<u128>(spu_ptr<u8>(&spu_thread::rdata), m_ir->CreateAnd(diff, 0x7f)), llvm::MaybeAlign{16});

const bool is_accurate_op = false && !!g_cfg.core.spu_accurate_reservations;
const bool is_accurate_op = !!g_cfg.core.spu_accurate_reservations;

const auto compare_data_change_res = is_accurate_op ? m_ir->getTrue() : m_ir->CreateICmpNE(_new, _rdata);

Expand Down