nir/opt_algebraic: optimizations for add umax/umin with zero

For unsigned comparisons with zero these ops can be eliminated.

v2: Add comparison optimizations with -1 (Rhys Perry)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net> (v1)
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10583>
This commit is contained in:
Gert Wollny
2021-05-02 23:48:05 +02:00
parent 301ceab7ce
commit a199697642

View File

@@ -553,7 +553,11 @@ optimizations.extend([
(('imin', a, a), a),
(('imax', a, a), a),
(('umin', a, a), a),
(('umin', a, 0), 0),
(('umin', a, -1), a),
(('umax', a, a), a),
(('umax', a, 0), a),
(('umax', a, -1), -1),
(('fmax', ('fmax', a, b), b), ('fmax', a, b)),
(('umax', ('umax', a, b), b), ('umax', a, b)),
(('imax', ('imax', a, b), b), ('imax', a, b)),