mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-13 07:14:49 +00:00
PPU LLVM: rewrite more packing instructions
Rewritten VPKUHUM, VPKUHUS, VPKUWUM, VPKUWUS. Decoupled saturation test from sat pack pattern.
This commit is contained in:
parent
e7c827f73b
commit
86b194014b
@ -1372,34 +1372,36 @@ void PPUTranslator::VPKSWUS(ppu_opcode_t op)
|
||||
|
||||
void PPUTranslator::VPKUHUM(ppu_opcode_t op)
|
||||
{
|
||||
const auto ab = GetVrs(VrType::vi16, op.va, op.vb);
|
||||
const auto src = Shuffle(ab[0], ab[1], { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 });
|
||||
SetVr(op.vd, src); // Truncate
|
||||
const auto [a, b] = get_vrs<u8[16]>(op.va, op.vb);
|
||||
const auto r = shuffle2(b, a, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30);
|
||||
set_vr(op.vd, r);
|
||||
}
|
||||
|
||||
void PPUTranslator::VPKUHUS(ppu_opcode_t op)
|
||||
{
|
||||
const auto ab = GetVrs(VrType::vi16, op.va, op.vb);
|
||||
const auto src = Shuffle(ab[0], ab[1], { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 });
|
||||
const auto saturated = Saturate(src, ICmpInst::ICMP_UGT, m_ir->getInt16(0xff));
|
||||
SetVr(op.vd, saturated.first);
|
||||
SetSat(IsNotZero(saturated.second));
|
||||
const auto [a, b] = get_vrs<u16[8]>(op.va, op.vb);
|
||||
const auto ta = bitcast<u8[16]>(min(a, splat<u16[8]>(0xff)));
|
||||
const auto tb = bitcast<u8[16]>(min(b, splat<u16[8]>(0xff)));
|
||||
const auto r = shuffle2(tb, ta, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30);
|
||||
set_vr(op.vd, r);
|
||||
SetSat(IsNotZero(eval((a | b) >> 8).value));
|
||||
}
|
||||
|
||||
void PPUTranslator::VPKUWUM(ppu_opcode_t op)
|
||||
{
|
||||
const auto ab = GetVrs(VrType::vi32, op.va, op.vb);
|
||||
const auto src = Shuffle(ab[0], ab[1], { 0, 1, 2, 3, 4, 5, 6, 7 });
|
||||
SetVr(op.vd, src); // Truncate
|
||||
const auto [a, b] = get_vrs<u16[8]>(op.va, op.vb);
|
||||
const auto r = shuffle2(b, a, 0, 2, 4, 6, 8, 10, 12, 14);
|
||||
set_vr(op.vd, r);
|
||||
}
|
||||
|
||||
void PPUTranslator::VPKUWUS(ppu_opcode_t op)
|
||||
{
|
||||
const auto ab = GetVrs(VrType::vi32, op.va, op.vb);
|
||||
const auto src = Shuffle(ab[0], ab[1], { 0, 1, 2, 3, 4, 5, 6, 7 });
|
||||
const auto saturated = Saturate(src, ICmpInst::ICMP_UGT, m_ir->getInt32(0xffff));
|
||||
SetVr(op.vd, saturated.first);
|
||||
SetSat(IsNotZero(saturated.second));
|
||||
const auto [a, b] = get_vrs<u32[4]>(op.va, op.vb);
|
||||
const auto ta = bitcast<u16[8]>(min(a, splat<u32[4]>(0xffff)));
|
||||
const auto tb = bitcast<u16[8]>(min(b, splat<u32[4]>(0xffff)));
|
||||
const auto r = shuffle2(tb, ta, 0, 2, 4, 6, 8, 10, 12, 14);
|
||||
set_vr(op.vd, r);
|
||||
SetSat(IsNotZero(eval((a | b) >> 16).value));
|
||||
}
|
||||
|
||||
void PPUTranslator::VREFP(ppu_opcode_t op)
|
||||
|
Loading…
x
Reference in New Issue
Block a user