On Wed, 17 Dec 2025, Jakub Jelinek wrote:

> On Wed, Dec 17, 2025 at 03:05:09PM +0100, Jakub Jelinek wrote:
> > On Wed, Dec 17, 2025 at 02:59:43PM +0100, Richard Biener wrote:
> > > At some point the permute vector element type had to match the value
> > > elemnt in size which easily leads to overflow for char element types
> > > as shown in the testcase.  This was relaxed for constant permute
> > > masks, so use ssizetype.
> > 
> > I wasn't aware of such a change.  Bet it will not work properly when
> > targets get fixed size 256+ byte vectors but as such targets don't
> > exist this is just whether GIMPLE passes can handle that and vector lowering
> > handles it too, right?

Right.

> > > Bootstrap and regtest running on x86_64-unknown-linux-gnu.
> > > 
> > > OK if that succeeds?
> > > 
> > > Thanks,
> > > Richard.
> > > 
> > >   PR c/123156
> > > gcc/c-family/
> > >   * c-common.cc (c_build_shufflevector): Use ssizetype for the
> > >   permute vector element type.
> > > 
> > > gcc/testsuite/
> > >   * gcc.dg/torture/builtin-shufflevector-pr123156.c: New testcase.
> > 
> > LGTM.
> 
> Although, if there are bugs in that like PR123175, perhaps it would be safer
> to do that solely if the number of elements * 2 doesn't fit into the
> precision.

Note this was as I also tried to remove the padding of the input vectors.
The patch as-is should be conservative enough, we're using ssizetype
permute mask elements in the vectorizer all the time.

Richard.

>       Jakub
> 
> 

-- 
Richard Biener <[email protected]>
SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
HRB 36809 (AG Nuernberg)

Reply via email to