public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2570] tree-optimization/101615 - SLP permute opt of existing vectors
@ 2021-07-28 13:14 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-07-28 13:14 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:6bb6e2044ced33d08175361b8e39a9c5d4a868a6
commit r12-2570-g6bb6e2044ced33d08175361b8e39a9c5d4a868a6
Author: Richard Biener <rguenther@suse.de>
Date: Wed Jul 28 14:16:35 2021 +0200
tree-optimization/101615 - SLP permute opt of existing vectors
This fixes one issue discovered when analyzing PR101615, namely
we happily push permutes to pre-existing vectors but end up
not actually permuting them. In fact we don't want to, so force
materialization on the external.
It doesn't fix the original testcase though.
2021-07-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/101615
* tree-vect-slp.c (vect_optimize_slp): Pre-existing vector
external nodes cannot be permuted so make them perm_out 0.
* gcc.dg/vect/bb-slp-pr101615-1.c: New testcase.
Diff:
---
gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-1.c | 30 +++++++++++++++++++++++++++
gcc/tree-vect-slp.c | 6 ++++--
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-1.c
new file mode 100644
index 00000000000..d1c9c02d517
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-1.c
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+/* { dg-additional-options "-w -Wno-psabi" } */
+
+#include "tree-vect.h"
+
+typedef int v4si __attribute__((vector_size(16)));
+
+int a[4];
+int b[4];
+
+void __attribute__((noipa))
+foo (v4si x)
+{
+ b[0] = a[3] + x[0];
+ b[1] = a[2] + x[1];
+ b[2] = a[1] + x[2];
+ b[3] = a[0] + x[3];
+}
+
+int main()
+{
+ check_vect ();
+ for (int i = 0; i < 4; ++i)
+ a[i] = i;
+ v4si x = (v4si) { 8, 6, 4, 2 };
+ foo (x);
+ if (b[0] != 11 || b[1] != 8 || b[2] != 5 || b[3] != 2)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index b9d88c2d943..07cc24a60e1 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -3648,8 +3648,10 @@ vect_optimize_slp (vec_info *vinfo)
slp_tree node = vertices[idx].node;
/* Handle externals and constants optimistically throughout the
- iteration. */
- if (SLP_TREE_DEF_TYPE (node) == vect_external_def
+ iteration. But treat existing vectors as fixed since we
+ do not handle permuting them below. */
+ if ((SLP_TREE_DEF_TYPE (node) == vect_external_def
+ && !SLP_TREE_VEC_DEFS (node).exists ())
|| SLP_TREE_DEF_TYPE (node) == vect_constant_def)
continue;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-28 13:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28 13:14 [gcc r12-2570] tree-optimization/101615 - SLP permute opt of existing vectors Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).