From 2f0dc9bd0fac47055d875baeca1cada6fd4e4129 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Thu, 5 Jul 2018 15:01:38 +0300 Subject: [PATCH] PPU LLVM: simplify VSUBCUW, VSUBUBS, VSUBUHS, VSUBUWS --- rpcs3/Emu/Cell/PPUTranslator.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUTranslator.cpp b/rpcs3/Emu/Cell/PPUTranslator.cpp index 304664829b..eb6b393c27 100644 --- a/rpcs3/Emu/Cell/PPUTranslator.cpp +++ b/rpcs3/Emu/Cell/PPUTranslator.cpp @@ -1477,7 +1477,7 @@ void PPUTranslator::VSUBCUW(ppu_opcode_t op) { const auto a = get_vr(op.va); const auto b = get_vr(op.vb); - set_vr(op.vd, eval(~ucarry(b, eval(a - b), a) >> 31)); + set_vr(op.vd, zext(a >= b)); } void PPUTranslator::VSUBFP(ppu_opcode_t op) @@ -1529,11 +1529,11 @@ void PPUTranslator::VSUBUBM(ppu_opcode_t op) void PPUTranslator::VSUBUBS(ppu_opcode_t op) { - const auto a = get_vr(op.va); - const auto b = get_vr(op.vb); + const auto a = get_vr(op.va); + const auto b = get_vr(op.vb); const auto d = eval(a - b); - const auto x = eval(ucarry(b, d, a) >> 7); - set_vr(op.vd, eval(d & ~x)); + const auto x = eval(a < b); + set_vr(op.vd, select(x, splat(0), d)); SetSat(IsNotZero(x.value)); } @@ -1546,11 +1546,11 @@ void PPUTranslator::VSUBUHM(ppu_opcode_t op) void PPUTranslator::VSUBUHS(ppu_opcode_t op) { - const auto a = get_vr(op.va); - const auto b = get_vr(op.vb); + const auto a = get_vr(op.va); + const auto b = get_vr(op.vb); const auto d = eval(a - b); - const auto x = eval(ucarry(b, d, a) >> 15); - set_vr(op.vd, eval(d & ~x)); + const auto x = eval(a < b); + set_vr(op.vd, select(x, splat(0), d)); SetSat(IsNotZero(x.value)); } @@ -1563,11 +1563,11 @@ void PPUTranslator::VSUBUWM(ppu_opcode_t op) void PPUTranslator::VSUBUWS(ppu_opcode_t op) { - const auto a = get_vr(op.va); - const auto b = get_vr(op.vb); + const auto a = get_vr(op.va); + const auto b = get_vr(op.vb); const auto d = eval(a - b); - const auto x = eval(ucarry(b, d, a) >> 31); - set_vr(op.vd, eval(d & ~x)); + const auto x = eval(a < b); + set_vr(op.vd, select(x, splat(0), d)); SetSat(IsNotZero(x.value)); }