On 12/15/2015 09:28 AM, Kristian Høgsberg Kristensen wrote: > This optimizes a + b - b to just a. Modest shader-db results (BDW): > > total instructions in shared programs: 7842452 -> 7841862 (-0.01%) > instructions in affected programs: 61938 -> 61348 (-0.95%) > total loops in shared programs: 2131 -> 2131 (0.00%) > helped: 263 > HURT: 0 > GAINED: 0 > LOST: 0 >
In HSW, I get these shader-db results: total instructions in shared programs: 6257265 -> 6256788 (-0.01%) instructions in affected programs: 46601 -> 46124 (-1.02%) helped: 218 HURT: 0 total cycles in shared programs: 56010026 -> 56007760 (-0.00%) cycles in affected programs: 1048392 -> 1046126 (-0.22%) helped: 199 HURT: 154 total loops in shared programs: 1979 -> 1979 (0.00%) loops in affected programs: 0 -> 0 helped: 0 HURT: 0 LOST: 0 GAINED: 0 I wonder where those cycle HURTs come from. In any case, the net result is positive. Patch is: Reviewed-by: Eduardo Lima Mitev <el...@igalia.com> > but the optimization turns > > gl_VertexID - gl_BaseVertexARB > > into just a reference to SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, which the > i965 hardware supports natively. That means we can avoid using the > internal vertex buffer for gl_BaseVertexARB in this case. > --- > src/glsl/nir/nir_opt_algebraic.py | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/src/glsl/nir/nir_opt_algebraic.py > b/src/glsl/nir/nir_opt_algebraic.py > index cb715c0..1fdad3d 100644 > --- a/src/glsl/nir/nir_opt_algebraic.py > +++ b/src/glsl/nir/nir_opt_algebraic.py > @@ -62,6 +62,10 @@ optimizations = [ > (('iadd', ('imul', a, b), ('imul', a, c)), ('imul', a, ('iadd', b, c))), > (('fadd', ('fneg', a), a), 0.0), > (('iadd', ('ineg', a), a), 0), > + (('iadd', ('ineg', a), ('iadd', a, b)), b), > + (('iadd', a, ('iadd', ('ineg', a), b)), b), > + (('fadd', ('fneg', a), ('fadd', a, b)), b), > + (('fadd', a, ('fadd', ('fneg', a), b)), b), > (('fmul', a, 0.0), 0.0), > (('imul', a, 0), 0), > (('umul_unorm_4x8', a, 0), 0), > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev