diff --git a/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp b/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp index 587649ef66..dbaf7eafbc 100644 --- a/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp +++ b/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp @@ -2477,7 +2477,7 @@ void spu_recompiler::WRCH(spu_opcode_t op) Label ret = c->newLabel(); c->mov(qw0->r32(), SPU_OFF_32(gpr, op.rt, &v128::_u32, 3)); c->mov(SPU_OFF_32(ch_tag_mask), qw0->r32()); - c->cmp(SPU_OFF_32(ch_tag_upd), 0); + c->cmp(SPU_OFF_32(ch_tag_upd), MFC_TAG_UPDATE_IMMEDIATE); c->jnz(upd); after.emplace_back([=, this, pos = m_pos] diff --git a/rpcs3/Emu/Cell/SPURecompiler.cpp b/rpcs3/Emu/Cell/SPURecompiler.cpp index 377da39d65..b14fadb962 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -5715,23 +5715,16 @@ public: const auto stat_ptr = spu_ptr(&spu_thread::ch_tag_stat); const auto stat_val = m_ir->CreateOr(m_ir->CreateZExt(completed, get_type()), INT64_MIN); - if (upd == 0) + if (upd == MFC_TAG_UPDATE_IMMEDIATE) { - m_ir->CreateStore(m_ir->getInt32(0), upd_ptr); + m_ir->CreateStore(m_ir->getInt32(MFC_TAG_UPDATE_IMMEDIATE), upd_ptr); m_ir->CreateStore(stat_val, stat_ptr); return; } - else if (upd == 1) + else if (upd <= MFC_TAG_UPDATE_ALL) { - const auto cond = m_ir->CreateICmpNE(completed, m_ir->getInt32(0)); - m_ir->CreateStore(m_ir->CreateSelect(cond, m_ir->getInt32(0), m_ir->getInt32(1)), upd_ptr); - m_ir->CreateStore(m_ir->CreateSelect(cond, stat_val, m_ir->getInt64(0)), stat_ptr); - return; - } - else if (upd == 2) - { - const auto cond = m_ir->CreateICmpEQ(completed, tag_mask); - m_ir->CreateStore(m_ir->CreateSelect(cond, m_ir->getInt32(0), m_ir->getInt32(2)), upd_ptr); + const auto cond = upd == MFC_TAG_UPDATE_ANY ? m_ir->CreateICmpNE(completed, m_ir->getInt32(0)) : m_ir->CreateICmpEQ(completed, tag_mask); + m_ir->CreateStore(m_ir->CreateSelect(cond, m_ir->getInt32(MFC_TAG_UPDATE_IMMEDIATE), m_ir->getInt32(static_cast(upd))), upd_ptr); m_ir->CreateStore(m_ir->CreateSelect(cond, stat_val, m_ir->getInt64(0)), stat_ptr); return; } diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index 7c96b57ac9..626b6fbce7 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -1889,15 +1889,15 @@ void spu_thread::do_mfc(bool wait) { const u32 completed = get_mfc_completed(); - if (completed && ch_tag_upd == 1) + if (completed && ch_tag_upd == MFC_TAG_UPDATE_ANY) { ch_tag_stat.set_value(completed); - ch_tag_upd = 0; + ch_tag_upd = MFC_TAG_UPDATE_IMMEDIATE; } - else if (completed == ch_tag_mask && ch_tag_upd == 2) + else if (completed == ch_tag_mask && ch_tag_upd == MFC_TAG_UPDATE_ALL) { ch_tag_stat.set_value(completed); - ch_tag_upd = 0; + ch_tag_upd = MFC_TAG_UPDATE_IMMEDIATE; } } @@ -2769,15 +2769,15 @@ bool spu_thread::set_ch_value(u32 ch, u32 value) { const u32 completed = get_mfc_completed(); - if (completed && ch_tag_upd == 1) + if (completed && ch_tag_upd == MFC_TAG_UPDATE_ANY) { ch_tag_stat.set_value(completed); - ch_tag_upd = 0; + ch_tag_upd = MFC_TAG_UPDATE_IMMEDIATE; } - else if (completed == value && ch_tag_upd == 2) + else if (completed == value && ch_tag_upd == MFC_TAG_UPDATE_ALL) { ch_tag_stat.set_value(completed); - ch_tag_upd = 0; + ch_tag_upd = MFC_TAG_UPDATE_IMMEDIATE; } } @@ -2786,7 +2786,7 @@ bool spu_thread::set_ch_value(u32 ch, u32 value) case MFC_WrTagUpdate: { - if (value > 2) + if (value > MFC_TAG_UPDATE_ALL) { break; } @@ -2795,17 +2795,17 @@ bool spu_thread::set_ch_value(u32 ch, u32 value) if (!value) { - ch_tag_upd = 0; + ch_tag_upd = MFC_TAG_UPDATE_IMMEDIATE; ch_tag_stat.set_value(completed); } - else if (completed && value == 1) + else if (completed && value == MFC_TAG_UPDATE_ANY) { - ch_tag_upd = 0; + ch_tag_upd = MFC_TAG_UPDATE_IMMEDIATE; ch_tag_stat.set_value(completed); } - else if (completed == ch_tag_mask && value == 2) + else if (completed == ch_tag_mask && value == MFC_TAG_UPDATE_ALL) { - ch_tag_upd = 0; + ch_tag_upd = MFC_TAG_UPDATE_IMMEDIATE; ch_tag_stat.set_value(completed); } else