Re: [PATCH] Avoid mult pattern if that will break reduction constraints

2025-08-28 Thread Richard Biener
On Wed, 27 Aug 2025, Jakub Jelinek wrote: > On Wed, Aug 27, 2025 at 03:50:26PM +0200, Richard Biener wrote: > > Ah, thanks for the write-up how to compute the number of uses. > > > > I'll test the following. > > --- a/gcc/tree-vect-patterns.cc > > +++ b/gcc/tree-vect-patterns.cc > > @@ -4303,6 +4

Re: [PATCH] Avoid mult pattern if that will break reduction constraints

2025-08-27 Thread Jakub Jelinek
On Wed, Aug 27, 2025 at 03:50:26PM +0200, Richard Biener wrote: > Ah, thanks for the write-up how to compute the number of uses. > > I'll test the following. > --- a/gcc/tree-vect-patterns.cc > +++ b/gcc/tree-vect-patterns.cc > @@ -4303,6 +4303,8 @@ vect_synth_mult_by_constant (vec_info *vinfo, tr

Re: [PATCH] Avoid mult pattern if that will break reduction constraints

2025-08-27 Thread Richard Biener
break; > default: > break; > } > if (variant == add_variant) > op_uses++; > if (op_uses > 1) > return NULL; > } > This basically counts how many times the later code will use > the op operand (with synth

Re: [PATCH] Avoid mult pattern if that will break reduction constraints

2025-08-27 Thread Jakub Jelinek
On Wed, Aug 27, 2025 at 02:48:33PM +0200, Richard Biener wrote: > I don't understand how synth-mult works, but it does introduce > multiple uses of a reduction variable which will ultimatively > fail vectorization (or ICE with a pending change). So avoid > applying the pattern. I've tried to do s

[PATCH] Avoid mult pattern if that will break reduction constraints

2025-08-27 Thread Richard Biener
I don't understand how synth-mult works, but it does introduce multiple uses of a reduction variable which will ultimatively fail vectorization (or ICE with a pending change). So avoid applying the pattern. I've tried to do so selectively, possibly preserving pattern-matching x * 4 as x << 2. So