nir/opt_algebraic: Optimize [ui](add|sub)_sat with 0.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17468>
This commit is contained in:
Georg Lehmann 2022-07-11 20:55:37 +02:00 committed by Marge Bot
parent 90a8fb0355
commit aac8ddae2f

View file

@ -144,6 +144,10 @@ optimizations = [
(('fadd(is_only_used_as_float)', 'a@16', 0.0), a, '!'+signed_zero_inf_nan_preserve_16),
(('fadd(is_only_used_as_float)', 'a@32', 0.0), a, '!'+signed_zero_inf_nan_preserve_32),
(('iadd', a, 0), a),
(('iadd_sat', a, 0), a),
(('isub_sat', a, 0), a),
(('uadd_sat', a, 0), a),
(('usub_sat', a, 0), a),
(('usadd_4x8_vc4', a, 0), a),
(('usadd_4x8_vc4', a, ~0), ~0),
(('~fadd', ('fmul', a, b), ('fmul', a, c)), ('fmul', a, ('fadd', b, c))),