From 0786a0a0886749c1e24bf46990789f0570391da4 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Mon, 2 May 2022 23:05:48 +0300 Subject: [PATCH] PPU LLVM: match interpreter for VEXPTEFP/VLOGEFP --- rpcs3/Emu/Cell/PPUTranslator.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUTranslator.cpp b/rpcs3/Emu/Cell/PPUTranslator.cpp index e6542f0ea3..4eb4814bce 100644 --- a/rpcs3/Emu/Cell/PPUTranslator.cpp +++ b/rpcs3/Emu/Cell/PPUTranslator.cpp @@ -932,31 +932,13 @@ void PPUTranslator::VCTUXS(ppu_opcode_t op) void PPUTranslator::VEXPTEFP(ppu_opcode_t op) { const auto b = get_vr(op.vb); - const auto x0 = eval(fmax(fmin(b, fsplat(127.4999961f)), fsplat(-127.4999961f))); - const auto x1 = eval(x0 + fsplat(0.5f)); - const auto x2 = eval(llvm_calli{"llvm.x86.sse2.cvtps2dq", {x1}} - noncast(zext(fcmp_ord(x1 <= fsplat(0))))); - const auto x3 = eval(x0 - fpcast(x2)); - const auto x4 = eval(x3 * x3); - const auto x5 = eval(x3 * fmuladd(fmuladd(x4, fsplat(0.023093347705f), fsplat(20.20206567f)), x4, fsplat(1513.906801f))); - const auto x6 = eval(x5 * fre(fmuladd(x4, fsplat(233.1842117f), fsplat(4368.211667f)) - x5)); - set_vr(op.vd, (x6 + x6 + fsplat(1.0f)) * bitcast((x2 + 127) << 23)); + set_vr(op.vd, vec_handle_result(llvm_calli{"llvm.exp2.v4f32", {b}})); } void PPUTranslator::VLOGEFP(ppu_opcode_t op) { const auto b = get_vr(op.vb); - const auto _1 = fsplat(1.0f); - const auto _c = fsplat(1.442695040f); - const auto x0 = eval(fmax(b, bitcast(splat(0x00800000)))); - const auto x1 = eval(bitcast((bitcast(x0) & 0x807fffff) | bitcast(_1))); - const auto x2 = eval(fre(x1 + _1)); - const auto x3 = eval((x1 - _1) * x2); - const auto x4 = eval(x3 + x3); - const auto x5 = eval(x4 * x4); - const auto x6 = eval(fmuladd(fmuladd(x5, fsplat(-0.7895802789f), fsplat(16.38666457f)), x5, fsplat(-64.1409953f))); - const auto x7 = eval(fre(fmuladd(fmuladd(x5, fsplat(-35.67227983f), fsplat(312.0937664f)), x5, fsplat(-769.6919436f)))); - const auto x8 = eval(fpcast(bitcast((bitcast(x0) >> 23) - 127))); - set_vr(op.vd, fmuladd(x5 * x6 * x7 * x4, _c, fmuladd(x4, _c, x8))); + set_vr(op.vd, vec_handle_result(llvm_calli{"llvm.log2.v4f32", {b}})); } void PPUTranslator::VMADDFP(ppu_opcode_t op)