1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2025-01-31 12:31:45 +01:00

SPU LLVM: Fix CFLTU

Clamp properly result from both sides!

TODO: Figure out whats different CreateFPToUi has from CFLTU and why it fails here.
This commit is contained in:
eladash 2019-03-30 13:59:30 +03:00 committed by Ivan
parent 969af86eba
commit eba8e2284b

View File

@ -6257,8 +6257,10 @@ public:
return;
}
const auto _max = fsplat<f64[4]>(std::exp2(32.f));
r.value = m_ir->CreateFPToUI(a.value, get_type<s32[4]>());
set_vr(op.rt, r & sext<s32[4]>(fcmp<llvm::FCmpInst::FCMP_OGE>(a, fsplat<f64[4]>(0.))));
r.value = m_ir->CreateSelect(m_ir->CreateFCmpUGE(a.value, _max.value), splat<s32[4]>(-1).eval(m_ir), (r & sext<s32[4]>(fcmp<llvm::FCmpInst::FCMP_OGE>(a, fsplat<f64[4]>(0.)))).eval(m_ir));
set_vr(op.rt, r);
}
else
{
@ -6272,8 +6274,10 @@ public:
a = eval(a * s);
value_t<s32[4]> r;
const auto _max = fsplat<f32[4]>(std::exp2(32.f));
r.value = m_ir->CreateFPToUI(a.value, get_type<s32[4]>());
set_vr(op.rt, r & ~(bitcast<s32[4]>(a) >> 31));
r.value = m_ir->CreateSelect(m_ir->CreateFCmpUGE(a.value, _max.value), splat<s32[4]>(-1).eval(m_ir), (r & ~(bitcast<s32[4]>(a) >> 31)).eval(m_ir));
set_vr(op.rt, r);
}
}