summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 702fcbfa57d..073e79900cb 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -377,6 +377,11 @@ optimizations = [
(('iand', ('uge(is_used_once)', a, b), ('uge', a, c)), ('uge', a, ('umax', b, c))),
(('iand', ('uge(is_used_once)', a, c), ('uge', b, c)), ('uge', ('umin', a, b), c)),
+ # Common pattern like 'if (i == 0 || i == 1 || ...)'
+ (('ior', ('ieq', a, 0), ('ieq', a, 1)), ('uge', 1, a)),
+ (('ior', ('uge', 1, a), ('ieq', a, 2)), ('uge', 2, a)),
+ (('ior', ('uge', 2, a), ('ieq', a, 3)), ('uge', 3, a)),
+
(('ior', 'a@bool', ('ieq', a, False)), True),
(('ior', a, ('inot', a)), -1),