On 02/22/2016 04:13 PM, Matt Turner wrote: > total instructions in shared programs: 7127270 -> 7103195 (-0.34%) > instructions in affected programs: 1376832 -> 1352757 (-1.75%) > helped: 7394 > HURT: 622 > > GAINED: 4 > LOST: 2 > --- > src/compiler/nir/nir_opt_algebraic.py | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/src/compiler/nir/nir_opt_algebraic.py > b/src/compiler/nir/nir_opt_algebraic.py > index cc2c229..1863033 100644 > --- a/src/compiler/nir/nir_opt_algebraic.py > +++ b/src/compiler/nir/nir_opt_algebraic.py > @@ -227,6 +227,10 @@ optimizations = [ > (('fabs', ('fsub', 0.0, a)), ('fabs', a)), > (('iabs', ('isub', 0, a)), ('iabs', a)), > > + # Propagate negation up multiplication chains > + (('fmul', ('fneg', a), b), ('fneg', ('fmul', a, b))), > + (('imul', ('ineg', a), b), ('ineg', ('fmul', a, b))), > +
We had tried things like this before, and it wasn't clearly a win. Is it a win now because of your early change to try to match a larger expression? My recollection is that doing this thwarted some attempts at generating MAD. Should we also add rules like (('ffma', ('fneg', a), b, c), ('fadd', ('fneg', ('fmul', a, b)), c), 'options->lower_ffma'), Finally, have you looked at the hurt cases? I also seem to recall that cases where one of the operands of the fmul was an immediate were usually better off moving the negation from the > # Misc. lowering > (('fmod', a, b), ('fsub', a, ('fmul', b, ('ffloor', ('fdiv', a, b)))), > 'options->lower_fmod'), > (('uadd_carry', a, b), ('b2i', ('ult', ('iadd', a, b), a)), > 'options->lower_uadd_carry'), > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev