asimd_two_regs_misc: Use {Get,Set}Vector

This commit is contained in:
MerryMage 2020-05-28 21:05:30 +01:00
parent 11cec1e3b6
commit f8062345bb

View file

@ -15,22 +15,24 @@ bool ArmTranslatorVisitor::asimd_VSWP(bool D, size_t Vd, bool Q, bool M, size_t
} }
// Swapping the same register results in the same contents. // Swapping the same register results in the same contents.
const auto d = ToExtRegD(Vd, D); const auto d = ToVector(Q, Vd, D);
const auto m = ToExtRegD(Vm, M); const auto m = ToVector(Q, Vm, M);
if (d == m) { if (d == m) {
return true; return true;
} }
const size_t regs = Q ? 2 : 1; if (Q) {
for (size_t i = 0; i < regs; i++) { const auto reg_d = ir.GetVector(d);
const auto d_index = d + i; const auto reg_m = ir.GetVector(m);
const auto m_index = m + i;
const auto reg_d = ir.GetExtendedRegister(d_index); ir.SetVector(m, reg_d);
const auto reg_m = ir.GetExtendedRegister(m_index); ir.SetVector(d, reg_m);
} else {
const auto reg_d = ir.GetExtendedRegister(d);
const auto reg_m = ir.GetExtendedRegister(m);
ir.SetExtendedRegister(m_index, reg_d); ir.SetExtendedRegister(m, reg_d);
ir.SetExtendedRegister(d_index, reg_m); ir.SetExtendedRegister(d, reg_m);
} }
return true; return true;