From fd6829f7576da07e3bb90de8821834d3ce44610c Mon Sep 17 00:00:00 2001 From: Whatcookie Date: Sat, 29 Jul 2023 02:01:01 -0400 Subject: [PATCH] SPU LLVM: AVX-512 optimization for CFLTU (#14384) - Takes advantage of vrangeps and the new float to uint instructions from AVX-512 - Down from 6 to 3 instructions TODO: Somehow ensure that this is what llvm outputs using CreateFPToUI? --- rpcs3/Emu/Cell/SPURecompiler.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rpcs3/Emu/Cell/SPURecompiler.cpp b/rpcs3/Emu/Cell/SPURecompiler.cpp index 1dd9acab29..5c88bba127 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -9871,6 +9871,15 @@ public: a = eval(a * s); value_t r; + + if (m_use_avx512) + { + const auto sc = clamp_smax(a); + r.value = m_ir->CreateFPToUI(sc.value, get_type()); + set_vr(op.rt, r); + return; + } + r.value = m_ir->CreateFPToUI(a.value, get_type()); set_vr(op.rt, select(bitcast(a) > splat(((32 + 127) << 23) - 1), splat(-1), r & ~(bitcast(a) >> 31))); }