compiler: saturate float-to-int conversions

This works around some UB in LLVM, where an out-of-bounds conversion would produce a poison value.
The selected behavior is saturating, except that NaN is mapped to the minimum value.
This commit is contained in:
Nia Weiss
2021-01-15 10:48:07 -05:00
committed by Ron Evans
parent f159429152
commit a867b56e5f
3 changed files with 70 additions and 4 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
+3.333333e-001
+6.666667e-001
+6.666667e-001
3 5 -2 -11
3 5 -2 -11 0 255 -128 127 0 -128
+5.300000e+001 -8.000000e+000 +2.000000e+001
(+6.666667e-001+1.200000e+000i)
+6.666667e-001