nir: Allow nir_opt_algebraic to see booleanness through &&, ||, ^, !.
authorEric Anholt <eric@anholt.net>
Fri, 20 Feb 2015 08:57:04 +0000 (00:57 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 21 Feb 2015 22:57:14 +0000 (14:57 -0800)
commit8e1152cb33e53a9d31a6c239dd77b0b4b7613ea8
treef5d395039eb6be908c8762bdf9492319dfc3e7c8
parentdc982f4a859d800ec3eba95d3c55bbe6af8d6518
nir: Allow nir_opt_algebraic to see booleanness through &&, ||, ^, !.

We have some useful optimizations to drop things like 'ine a, 0' on a
boolean argument, but if 'a' came from logical operations on bools, it
couldn't tell.  These kinds of constructs appear as a result of TGSI->NIR
quite frequently (at least with if flattening), so being a little more
aggressive in detecting booleans can pay off.

v2: Add ixor as a booleanness-preserving op (Suggestion by Connor).

vc4 results:
total instructions in shared programs: 40207 -> 39881 (-0.81%)
instructions in affected programs:     6677 -> 6351 (-4.88%)

Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/glsl/nir/nir_search.c