diff --git a/rpcs3/Emu/Cell/SPURecompiler.cpp b/rpcs3/Emu/Cell/SPURecompiler.cpp index 3bb3ced322..5a58e9d2d4 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -6257,8 +6257,10 @@ public: return; } + const auto _max = fsplat(std::exp2(32.f)); r.value = m_ir->CreateFPToUI(a.value, get_type()); - set_vr(op.rt, r & sext(fcmp(a, fsplat(0.)))); + r.value = m_ir->CreateSelect(m_ir->CreateFCmpUGE(a.value, _max.value), splat(-1).eval(m_ir), (r & sext(fcmp(a, fsplat(0.)))).eval(m_ir)); + set_vr(op.rt, r); } else { @@ -6272,8 +6274,10 @@ public: a = eval(a * s); value_t r; + const auto _max = fsplat(std::exp2(32.f)); r.value = m_ir->CreateFPToUI(a.value, get_type()); - set_vr(op.rt, r & ~(bitcast(a) >> 31)); + r.value = m_ir->CreateSelect(m_ir->CreateFCmpUGE(a.value, _max.value), splat(-1).eval(m_ir), (r & ~(bitcast(a) >> 31)).eval(m_ir)); + set_vr(op.rt, r); } }