diff options
author | Richard Biener <rguenther@suse.de> | 2025-03-25 13:45:36 +0100 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2025-03-26 08:12:48 +0100 |
commit | 3d4bfd43059c3a92b9608d3d17f8c045a58edda1 (patch) | |
tree | bb29e8655ded0ea405438d47c89d30153d07bc49 /gcc | |
parent | e7871b36f17fa58385198c079edf42b5c8e630b6 (diff) | |
download | gcc-3d4bfd43059c3a92b9608d3d17f8c045a58edda1.zip gcc-3d4bfd43059c3a92b9608d3d17f8c045a58edda1.tar.gz gcc-3d4bfd43059c3a92b9608d3d17f8c045a58edda1.tar.bz2 |
middle-end/118795 - fix can_vec_perm_const_p query in match.pd
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/match.pd | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr118795.C | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index 98f6373..ba036e5 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -11121,7 +11121,7 @@ and, (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 ()]); diff --git a/gcc/testsuite/g++.dg/torture/pr118795.C b/gcc/testsuite/g++.dg/torture/pr118795.C new file mode 100644 index 0000000..fc40f81 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr118795.C @@ -0,0 +1,15 @@ +// { 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; + } +} |