SPU LLVM: Stop inverting float-to-int saturation on ARM64

- Fix CFLTS saturation in the approximate and accurate xfloat paths
- Original fix credit to jpolo1224 of armsx3 https://github.com/ARMSX2/ARMSX3/commit/424514fde67adb83540d39feea860b5eb17b3500
- Accurate-xfloat follow-up https://github.com/ARMSX2/ARMSX3/commit/19d23eb6913c34cb63c00861bf95e58c3144e78e

Co-authored-by: jpolo1224 <[email protected]>
This commit is contained in:
Malcolm
2026-09-16 14:04:34 +03:00
committed by Elad
co-authored by jpolo1224
parent 394a9e4b52
commit e13ee15791
+10
View File
@@ -9238,7 +9238,12 @@ public:
}
r.value = m_ir->CreateFPToSI(a.value, get_type<s32[4]>());
#if defined(ARCH_ARM64)
set_vr(op.rt, select(fcmp_ord(a >= fsplat<f64[4]>(std::exp2(31.f))), splat<s32[4]>(0x7fffffff),
select(fcmp_ord(a < fsplat<f64[4]>(-std::exp2(31.f))), splat<s32[4]>(0x80000000), r)));
#else
set_vr(op.rt, r ^ sext<s32[4]>(fcmp_ord(a >= fsplat<f64[4]>(std::exp2(31.f)))));
#endif
}
else
{
@@ -9253,7 +9258,12 @@ public:
value_t<s32[4]> r;
r.value = m_ir->CreateFPToSI(a.value, get_type<s32[4]>());
#if defined(ARCH_ARM64)
const auto sat_hi = bitcast<s32[4]>(a) > splat<s32[4]>(((31 + 127) << 23) - 1);
set_vr(op.rt, select(sat_hi, splat<s32[4]>(0x7fffffff), select(fcmp_uno(a != a), splat<s32[4]>(0x80000000), r)));
#else
set_vr(op.rt, r ^ sext<s32[4]>(bitcast<s32[4]>(a) > splat<s32[4]>(((31 + 127) << 23) - 1)));
#endif
}
}