nir: Fix i64tof32 lowering
authorBoris Brezillon <boris.brezillon@collabora.com>
Wed, 12 Aug 2020 12:28:48 +0000 (14:28 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 17 Aug 2020 20:31:31 +0000 (20:31 +0000)
commit199bea0fd80e65178a9d12c705a9f0aaf0a36ceb
tree9f0e093bee77a35175795f516bb2c0861a921cfd
parentf9e773b92059f4c13735fa3214d5c505f9e06d66
nir: Fix i64tof32 lowering

The round-to-nearest-even implementation found in lower_2f() is incorrect
for any value having a significand that is not directly representable
and whose non-representable part lies between 1 and half the minimum
representable value. In this case, the significand is rounded up instead
of being rounded down.

Fixes: 936c58c8fcce ("nir: Extend nir_lower_int64() to support i2f/f2i lowering")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Tested-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6290>
src/compiler/nir/nir_lower_int64.c