SPU LLVM: Fix LSA masking for PUTLLC16, disable RTIME checks
This commit is contained in:
@@ -5689,9 +5689,15 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point, s
|
|||||||
{
|
{
|
||||||
case MFC_GETLLAR_CMD:
|
case MFC_GETLLAR_CMD:
|
||||||
{
|
{
|
||||||
|
// Get LSA and apply mask for GETLLAR
|
||||||
|
// TODO: Simplify this to be a value returning function
|
||||||
|
auto old_lsa = get_reg(s_reg_mfc_lsa);
|
||||||
|
inherit_const_mask_value(s_reg_mfc_lsa, old_lsa, 0, ~SPU_LS_MASK_128);
|
||||||
|
|
||||||
|
// Restore LSA
|
||||||
auto lsa = get_reg(s_reg_mfc_lsa);
|
auto lsa = get_reg(s_reg_mfc_lsa);
|
||||||
inherit_const_mask_value(s_reg_mfc_lsa, lsa, 0, ~SPU_LS_MASK_128);
|
vregs[s_reg_mfc_lsa] = old_lsa;
|
||||||
lsa = get_reg(s_reg_mfc_lsa);
|
|
||||||
const u32 lsa_pc = atomic16.lsa_last_pc == SPU_LS_SIZE ? bpc : atomic16.lsa_last_pc;
|
const u32 lsa_pc = atomic16.lsa_last_pc == SPU_LS_SIZE ? bpc : atomic16.lsa_last_pc;
|
||||||
|
|
||||||
if (atomic16.active)
|
if (atomic16.active)
|
||||||
@@ -5743,7 +5749,7 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point, s
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vregs[s_reg_mfc_lsa].compare_with_mask_indifference(*val, SPU_LS_MASK_1))
|
if (vregs[s_reg_mfc_lsa].compare_with_mask_indifference(*val, SPU_LS_MASK_16))
|
||||||
{
|
{
|
||||||
regs[reg_it] = s_reg_mfc_lsa;
|
regs[reg_it] = s_reg_mfc_lsa;
|
||||||
continue;
|
continue;
|
||||||
@@ -5753,7 +5759,7 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point, s
|
|||||||
{
|
{
|
||||||
const auto& _reg = vregs[i];
|
const auto& _reg = vregs[i];
|
||||||
|
|
||||||
if (_reg == *val)
|
if (_reg.compare_with_mask_indifference(*val, SPU_LS_MASK_16))
|
||||||
{
|
{
|
||||||
regs[reg_it] = i;
|
regs[reg_it] = i;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1292,7 +1292,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
|
|||||||
const auto diff = m_ir->CreateZExt(m_ir->CreateSub(dest, _lsa), get_type<u64>());
|
const auto diff = m_ir->CreateZExt(m_ir->CreateSub(dest, _lsa), get_type<u64>());
|
||||||
|
|
||||||
const auto _new = m_ir->CreateAlignedLoad(get_type<u128>(), _ptr<u128>(m_lsptr, dest), llvm::MaybeAlign{16});
|
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 auto _rdata = m_ir->CreateAlignedLoad(get_type<u128>(), _ptr<u128>(spu_ptr<u8>(&spu_thread::rdata), m_ir->CreateAnd(diff, 0x70)), llvm::MaybeAlign{16});
|
||||||
|
|
||||||
const bool is_accurate_op = !!g_cfg.core.spu_accurate_reservations;
|
const bool is_accurate_op = !!g_cfg.core.spu_accurate_reservations;
|
||||||
|
|
||||||
@@ -1360,7 +1360,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
|
|||||||
|
|
||||||
llvm::Value* old_val{};
|
llvm::Value* old_val{};
|
||||||
|
|
||||||
if (is_accurate_op)
|
if (true || is_accurate_op)
|
||||||
{
|
{
|
||||||
old_val = m_ir->CreateLoad(get_type<u64>(), spu_ptr<u64>(&spu_thread::rtime));
|
old_val = m_ir->CreateLoad(get_type<u64>(), spu_ptr<u64>(&spu_thread::rtime));
|
||||||
}
|
}
|
||||||
@@ -1373,7 +1373,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
|
|||||||
|
|
||||||
const auto cmp_res2 = m_ir->CreateAtomicCmpXchg(rptr2, old_val, m_ir->CreateAdd(old_val, m_ir->getInt64(128)), llvm::MaybeAlign{16}, llvm::AtomicOrdering::SequentiallyConsistent, llvm::AtomicOrdering::SequentiallyConsistent);
|
const auto cmp_res2 = m_ir->CreateAtomicCmpXchg(rptr2, old_val, m_ir->CreateAdd(old_val, m_ir->getInt64(128)), llvm::MaybeAlign{16}, llvm::AtomicOrdering::SequentiallyConsistent, llvm::AtomicOrdering::SequentiallyConsistent);
|
||||||
|
|
||||||
if (is_accurate_op)
|
if (true || is_accurate_op)
|
||||||
{
|
{
|
||||||
m_ir->CreateCondBr(m_ir->CreateExtractValue(cmp_res2, 1), _success, _fail);
|
m_ir->CreateCondBr(m_ir->CreateExtractValue(cmp_res2, 1), _success, _fail);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user