PPU LLVM: implement get_vrs<>() adaptor

Make use of structured bindings
This commit is contained in:
Nekotekina 2019-03-30 01:14:52 +03:00
parent d77fed6105
commit 7e0b941e9f
2 changed files with 8 additions and 2 deletions

View File

@ -1331,8 +1331,8 @@ void PPUTranslator::VRSQRTEFP(ppu_opcode_t op)
void PPUTranslator::VSEL(ppu_opcode_t op)
{
const auto abc = GetVrs(VrType::vi32, op.va, op.vb, op.vc);
SetVr(op.vd, m_ir->CreateOr(m_ir->CreateAnd(abc[1], abc[2]), m_ir->CreateAnd(abc[0], m_ir->CreateNot(abc[2]))));
const auto [a, b, c] = get_vrs<u32[4]>(op.va, op.vb, op.vc);
set_vr(op.vd, eval((b & c) | (a & ~c)));
}
void PPUTranslator::VSL(ppu_opcode_t op)

View File

@ -87,6 +87,12 @@ public:
return result;
}
template <typename T, typename... Args>
std::tuple<std::conditional_t<false, Args, value_t<T>>...> get_vrs(const Args&... args)
{
return {get_vr<T>(args)...};
}
template <typename T>
void set_vr(u32 vr, value_t<T> v)
{