Commit 55bd40ce authored by Timothy Arceri's avatar Timothy Arceri

nir: opt_algebraic add some opts to remove spilling in dirt showdown

These appear in a single Dirt Showdown compute shader. With this
VGPR spilling in the radeonsi NIR backend is reduced.
parent 30fd1dad
......@@ -221,8 +221,19 @@ optimizations = [
(('~bcsel', ('fge', a, b), b, a), ('fmin', a, b)),
(('~bcsel', ('fge', b, a), b, a), ('fmax', a, b)),
(('bcsel', ('inot', a), b, c), ('bcsel', a, c, b)),
(('bcsel', a, b, ('inot', 'a@bool')), ('bcsel', a, b, True)),
(('bcsel', a, ('inot', 'a@bool'), b), ('bcsel', a, False, b)),
(('bcsel', a, ('bcsel', a, b, c), d), ('bcsel', a, b, d)),
(('bcsel', a, 'a@bool', 'b@bool'), ('ior', a, b)),
(('bcsel', a, True, 'b@bool'), ('ior', a, b)),
(('bcsel', a, ('iand', 'a@bool', b), c), ('bcsel', a, b, c)),
(('bcsel', a, b, ('iand', ('inot', 'a@bool'), c)), ('bcsel', a, b, c)),
(('bcsel', a, ('ior', ('inot', 'a@bool'), b), c), ('bcsel', a, b, c)),
(('bcsel', ('fge', a, b), c, ('flt', a, b)), ('bcsel', ('fge', a, b), c, True)),
(('bcsel', ('fge', a, b), ('ior', ('flt', a, b), c), d), ('bcsel', ('fge', a, b), c, d)),
(('bcsel', ('iand', 'a@bool', 'b@bool'), ('bcsel', a, b, True), c), ('bcsel', ('iand', a, b), True, c)),
(('ior', ('bcsel', 'a@bool', 'b@bool', 'c@bool'), ('bcsel', a, True, c)), ('ior', a, c)),
(('ior', ('bcsel', 'a@bool', 'b@bool', 'c@bool'), ('ior', a, c)), ('ior', a, c)),
(('fmin', a, a), a),
(('fmax', a, a), a),
(('imin', a, a), a),
......@@ -287,7 +298,14 @@ optimizations = [
(('ior', 'a@bool', ('ieq', a, False)), True),
(('ior', 'a@bool', ('inot', a)), True),
(('ior', a, ('iand', ('inot', 'a@bool'), 'b@bool')), ('ior', a, b)),
(('ior', ('ior', a, b), a), ('ior', a, b)),
(('iand', ('iand', a, b), a), ('iand', a, b)),
(('iand', ('fge', a, b), ('ior', ('flt', a, b), 'c@bool')), ('iand', ('fge', a, b), c)),
(('iand', ('iand', 'a@bool', 'b@bool'), a), ('iand', a, b)),
(('iand', ('ior', 'a@bool', 'b@bool'), ('inot', 'a@bool')), ('iand', ('inot', 'a@bool'), b)),
(('iand', ('ieq', 'a@32', 0), ('ieq', 'b@32', 0)), ('ieq', ('ior', 'a@32', 'b@32'), 0)),
# These patterns can result when (a < b || a < c) => (a < min(b, c))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment