]> git.ipfire.org Git - thirdparty/gcc.git/commit
middle-end/123175 - fix parts of const VEC_PERM with relaxed input sizes
authorRichard Biener <rguenther@suse.de>
Fri, 9 Jan 2026 08:35:21 +0000 (09:35 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 12 Jan 2026 09:50:08 +0000 (10:50 +0100)
commita4716ece529dfd29d169ccc96979f7c747231f25
tree48630d19feaea43e7f8180976380c54645c3156f
parentc885d2a055828dfbeb30208a1a8a50dcef0004d8
middle-end/123175 - fix parts of const VEC_PERM with relaxed input sizes

The following fixes enough of const VEC_PERM folding and lowering
to deal with the fallout for the two testcases from the PR.  We
usually do not generate such problematic VEC_PERM expressions, but
we allow those since GCC 14.  As can be seen we mishandle those,
including failure to expand/lower them by zero-extending inputs (which is
what __builtin_shufflevector does).

I'm unsure as to what extent we get such permutes but Tamar indicates
that aarch64 can handle those at least.

PR middle-end/123175
* match.pd (vec_perm @0 @1 @2): Fixup for inputs having a
different number of elements than the result.
* tree-vect-generic.cc (lower_vec_perm): Likewise.

* gcc.dg/torture/pr123175-1.c: New testcase.
* gcc.dg/torture/pr123175-2.c: Likewise.
gcc/match.pd
gcc/testsuite/gcc.dg/torture/pr123175-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr123175-2.c [new file with mode: 0644]
gcc/tree-vect-generic.cc