These appear in a single Dirt Showdown compute shader. With this
VGPR spilling in the radeonsi NIR backend is reduced.
---
 src/compiler/nir/nir_opt_algebraic.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 808679d0bbb..97ffc75d1c3 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -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))
-- 
2.17.1

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to