summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-03-29 22:59:39 -0700
committerEric Anholt <[email protected]>2015-04-01 10:57:01 -0700
commit6e8d4a2f8043a3a7a28175326e63770aa9511ee7 (patch)
tree7e8502480d2b8006471d0202a650ef53fb06bd61 /src
parent26261bca2137eb1ca57e53f4efb95bcb3f1419df (diff)
nir: Recognize a pattern for doing b2f without the opcode.
Since we have patterns based on b2f, generate them if we see the b2f equivalent using an iand. This is common when generating NIR from TGSI. Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/nir/nir_opt_algebraic.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index 66b456d1164..301d7a8ebcf 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -99,6 +99,7 @@ optimizations = [
# Emulating booleans
(('fmul', ('b2f', a), ('b2f', b)), ('b2f', ('iand', a, b))),
(('fsat', ('fadd', ('b2f', a), ('b2f', b))), ('b2f', ('ior', a, b))),
+ (('iand', 'a@bool', 1.0), ('b2f', a)),
# Comparison with the same args. Note that these are not done for
# the float versions because NaN always returns false on float
# inequalities.