nir: Add an algebraic optimization for float->double->float

As part of this series, it removes the need for float->double conversion,
just to be able to print a single float.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8254>
This commit is contained in:
Jesse Natalie
2020-06-22 08:12:54 -07:00
committed by Dave Airlie
parent 24669a672f
commit 3f77901342

View File

@@ -1065,6 +1065,10 @@ optimizations.extend([
(('f2f32', ('i2fmp', 'a@32')), ('i2f32', a)),
(('f2f32', ('u2fmp', 'a@32')), ('u2f32', a)),
# Conversions from float32 to float64 and back can be removed as long as
# it doesn't need to be precise, since the conversion may e.g. flush denorms
(('~f2f32', ('f2f64', 'a@32')), a),
(('ffloor', 'a(is_integral)'), a),
(('fceil', 'a(is_integral)'), a),
(('ftrunc', 'a(is_integral)'), a),