When expanding to RTL we always use vec_perm_indices with two operands
which can make a difference with respect to supported vs. unsupported.
So the following adjusts a query in match.pd for target support which
got this "wrong" and using 1 for a equal operand permute.
PR middle-end/118795
* match.pd (vec_perm <vec_perm <a, b>> -> vec_perm <a, b>):
Use the appropriate check to see whether the original
outer permute was supported.
* g++.dg/torture/pr118795.C: New testcase.
(with
{
vec_perm_indices sel0 (builder0, 2, nelts);
- vec_perm_indices sel1 (builder1, 1, nelts);
+ vec_perm_indices sel1 (builder1, 2, nelts);
for (int i = 0; i < nelts; i++)
builder2.quick_push (sel0[sel1[i].to_constant ()]);
--- /dev/null
+// { dg-do compile }
+
+unsigned char *a();
+struct b {
+ void c() const;
+};
+void b::c() const {
+ unsigned char *d = a(), *e = a();
+ for (long f; f; ++f) {
+ e[0] = e[1] = e[2] = d[0];
+ e[3] = d[0];
+ d += 4;
+ e += 4;
+ }
+}