summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-07-23 00:35:02 -0700
committerJason Ekstrand <[email protected]>2018-07-24 20:39:43 -0700
commitb3b170ade9cc3abe6b861a549292c9ec230844bc (patch)
tree8bfbf09c5beae9e4b3d234d55646a656d8eb56ae /src/compiler
parent2b3064c07316057755a3fbb732d0e315f25aff8a (diff)
nir: Add a couple of iand/ior optimizations
Spotted in a shader in Batman: Arkham City. Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index ba277fdfd0e..7fc4ff1d407 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -377,6 +377,10 @@ optimizations = [
(('ixor', a, a), 0),
(('ixor', a, 0), a),
(('inot', ('inot', a)), a),
+ (('ior', ('iand', a, b), b), b),
+ (('ior', ('ior', a, b), b), ('ior', a, b)),
+ (('iand', ('ior', a, b), b), b),
+ (('iand', ('iand', a, b), b), ('iand', a, b)),
# DeMorgan's Laws
(('iand', ('inot', a), ('inot', b)), ('inot', ('ior', a, b))),
(('ior', ('inot', a), ('inot', b)), ('inot', ('iand', a, b))),