SPU ASMJIT: fix BISLED

Properly prevent losing branch target (addr) vs get_events result (flags).
Move get_events() to the beginning.
Match BISL indirect_branch() args.
This commit is contained in:
Nekotekina 2019-05-17 22:28:07 +03:00
parent 6416fee986
commit 85920253b3

View File

@ -2688,25 +2688,26 @@ void spu_recompiler::IRET(spu_opcode_t op)
void spu_recompiler::BISLED(spu_opcode_t op) void spu_recompiler::BISLED(spu_opcode_t op)
{ {
get_events();
c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3));
c->and_(*addr, 0x3fffc);
const XmmLink& vr = XmmAlloc(); const XmmLink& vr = XmmAlloc();
c->lea(*qw0, get_pc(m_pos + 4)); c->lea(*qw0, get_pc(m_pos + 4));
c->and_(qw0->r32(), 0x3fffc);
c->movd(vr, qw0->r32()); c->movd(vr, qw0->r32());
c->pand(vr, XmmConst(_mm_set1_epi32(0x3fffc)));
c->pslldq(vr, 12); c->pslldq(vr, 12);
c->movdqa(SPU_OFF_128(gpr, op.rt), vr); c->movdqa(SPU_OFF_128(gpr, op.rt), vr);
asmjit::Label branch_label = c->newLabel(); asmjit::Label branch_label = c->newLabel();
get_events();
c->jne(branch_label); c->jne(branch_label);
after.emplace_back([=] after.emplace_back([=]
{ {
c->align(asmjit::kAlignCode, 16); c->align(asmjit::kAlignCode, 16);
c->bind(branch_label); c->bind(branch_label);
branch_indirect(op); c->and_(*addr, 0x3fffc);
branch_indirect(op, true, false);
}); });
} }