On Thu, Jan 22, 2015 at 7:27 AM, Jason Ekstrand <ja...@jlekstrand.net> wrote: > On Jan 22, 2015 3:41 AM, "Kenneth Graunke" <kenn...@whitecape.org> wrote: >> Matt and I noticed a bunch of "val <- ior a a" operations in a shader, >> so we decided to add an algebraic optimization for that. While there, >> I decided to add a bunch more of them. >> >> total NIR instructions in shared programs: 2023511 -> 2020814 (-0.13%) >> NIR instructions in affected programs: 149634 -> 146937 (-1.80%) >> helped: 1032 >> >> i965 already cleans these up, so the final results aren't impressive: >> >> total i965 instructions in shared programs: 6035392 -> 6035397 (0.00%) >> i965 instructions in affected programs: 764 -> 769 (0.65%) >> HURT: 3 >> >> However, improving the result of the NIR compile is worth doing. >> >> Signed-off-by: Kenneth Graunke <kenn...@whitecape.org> >> --- >> src/glsl/nir/nir_opt_algebraic.py | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/src/glsl/nir/nir_opt_algebraic.py >> b/src/glsl/nir/nir_opt_algebraic.py >> index 169bb41..cf16b19 100644 >> --- a/src/glsl/nir/nir_opt_algebraic.py >> +++ b/src/glsl/nir/nir_opt_algebraic.py >> @@ -68,6 +68,22 @@ optimizations = [ >> (('fadd', ('fmul', a, b), c), ('ffma', a, b, c)), >> (('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)), >> (('fmin', ('fmax', a, 1.0), 0.0), ('fsat', a)), >> + # Logical and bit operations >> + (('fand', a, a), a), > > This isn't correct. The fand operation will normalize to 0.0/1.0. > >> + (('fand', a, 0.0), 0.0), > > This is ok > >> + (('iand', a, a), a), >> + (('iand', a, 0), 0), >> + (('for', a, a), a), >> + (('for', a, 0.0), a), > > Can't do these two either > >> + (('ior', a, a), a), >> + (('ior', a, 0), a), >> + (('fxor', a, a), 0.0), > > This one should be ok > > With the junk optimizations removed, > Reviewed-by: Jason Ekstrand <jason.ekstr...@intel.com>
Same, Reviewed-by: Matt Turner <matts...@gmail.com> _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev