diff --git a/rpcs3/Emu/Cell/PPUTranslator.cpp b/rpcs3/Emu/Cell/PPUTranslator.cpp index 31a6179712..78f9ab06d0 100644 --- a/rpcs3/Emu/Cell/PPUTranslator.cpp +++ b/rpcs3/Emu/Cell/PPUTranslator.cpp @@ -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(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(op.va, op.vb); + const auto ta = bitcast(min(a, splat(0xff))); + const auto tb = bitcast(min(b, splat(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(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(op.va, op.vb); + const auto ta = bitcast(min(a, splat(0xffff))); + const auto tb = bitcast(min(b, splat(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)