Re: [1/2] PR88598: Optimise x * { 0 or 1, 0 or 1, ... }

2019-01-07 Thread Richard Biener
On Fri, Jan 4, 2019 at 1:44 PM Richard Sandiford wrote: > > Jakub Jelinek writes: > > On Fri, Jan 04, 2019 at 12:13:13PM +, Richard Sandiford wrote: > >> > Can we avoid the gratuitous use of template here? We were told that C++ > >> > would > >> > be used only when it makes things more

Re: [1/2] PR88598: Optimise x * { 0 or 1, 0 or 1, ... }

2019-01-04 Thread Richard Sandiford
Jakub Jelinek writes: > On Fri, Jan 04, 2019 at 12:13:13PM +, Richard Sandiford wrote: >> > Can we avoid the gratuitous use of template here? We were told that C++ >> > would >> > be used only when it makes things more straightforward and it's the >> > contrary >> > in this case, to wit

Re: [1/2] PR88598: Optimise x * { 0 or 1, 0 or 1, ... }

2019-01-04 Thread Eric Botcazou
> I did it that way so that it would be easy to add things like > zero_or_minus_onep without cut-&-pasting the whole structure. Yes, I inferred that, but people can still templatize afterward if need be. Following this line of reasoning, why to limit yourself to this arbitrary number of 2

Re: [1/2] PR88598: Optimise x * { 0 or 1, 0 or 1, ... }

2019-01-04 Thread Jakub Jelinek
On Fri, Jan 04, 2019 at 12:13:13PM +, Richard Sandiford wrote: > > Can we avoid the gratuitous use of template here? We were told that C++ > > would > > be used only when it makes things more straightforward and it's the > > contrary > > in this case, to wit the need for the ugly RECURSE

Re: [1/2] PR88598: Optimise x * { 0 or 1, 0 or 1, ... }

2019-01-04 Thread Richard Sandiford
Eric Botcazou writes: >> Index: gcc/tree.c >> === >> --- gcc/tree.c 2019-01-04 11:39:24.810266962 + >> +++ gcc/tree.c 2019-01-04 11:40:33.141683783 + >> @@ -11229,6 +11229,60 @@ initializer_zerop (const_tree init,

Re: [1/2] PR88598: Optimise x * { 0 or 1, 0 or 1, ... }

2019-01-04 Thread Eric Botcazou
> Index: gcc/tree.c > === > --- gcc/tree.c2019-01-04 11:39:24.810266962 + > +++ gcc/tree.c2019-01-04 11:40:33.141683783 + > @@ -11229,6 +11229,60 @@ initializer_zerop (const_tree init, bool > } > } > >

[1/2] PR88598: Optimise x * { 0 or 1, 0 or 1, ... }

2019-01-04 Thread Richard Sandiford
The PR has: vect__6.24_42 = vect__5.23_41 * { 0.0, 1.0e+0, 0.0, 0.0 }; which for -fno-signed-zeros -fno-signaling-nans can be simplified to: vect__6.24_42 = vect__5.23_41 & { 0, -1, 0, 0 }; I deliberately didn't handle COMPLEX_CST or CONSTRUCTOR in initializer_each_zero_or_onep since