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?
>
> > 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.
Jakub