On Thu, 25 Jan 2018, Marc Glisse wrote: > On Thu, 25 Jan 2018, Richard Biener wrote: > > > --- gcc/match.pd (revision 257047) > > +++ gcc/match.pd (working copy) > > @@ -1939,6 +1939,37 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > > (minus (convert (view_convert:stype @1)) > > (convert (view_convert:stype @2))))))) > > > > +/* (A * C) +- (B * C) -> (A+-B) * C and (A * C) +- A -> A * (C+-1). > > + Modeled after fold_plusminus_mult_expr. */ > > +(if (!TYPE_SATURATING (type) > > + && (!FLOAT_TYPE_P (type) || flag_associative_math)) > > + (for plusminus (plus minus) > > + (simplify > > + (plusminus (mult:s @0 @1) (mult:cs @0 @2)) > > No :c on the first mult, so we don't actually handle A*C+B*C?
Hmm, I somehow convinced myself that it's only necessary on one of the mults... but you are of course right. Will re-test with that fixed. Richard.