summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-25 07:25:55 +0000
committerirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-25 07:25:55 +0000
commit93a6f154cc3b25ef070e827c2607d340145bfd3c (patch)
tree63f9e8f60f8675155450474eb8880ff6b2b25fe3
parent50c9119ebf29d6ed5b3638e660207afec8ed309d (diff)
downloadgcc-93a6f154cc3b25ef070e827c2607d340145bfd3c.tar.gz
PR tree-optimization/33866
* tree-vect-transform.c (vectorizable_store): Check operands of all the stmts in the group of strided accesses. Get def stmt type for each store in the group and pass it to vect_get_vec_def_for_stmt_copy (). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129623 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr33866.c31
-rw-r--r--gcc/tree-vect-transform.c29
4 files changed, 68 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bff2ce29910..ad09b5864ad 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2007-10-25 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/33866
+ * tree-vect-transform.c (vectorizable_store): Check operands of all the
+ stmts in the group of strided accesses. Get def stmt type for each store
+ in the group and pass it to vect_get_vec_def_for_stmt_copy ().
+
2007-10-25 Uros Bizjak <ubizjak@gmail.com>
* config/i386/constraints.md (Y0): Rename register constraint to Yz.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fa36f524d1a..0164f1f8fde 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2007-10-25 Martin Michlmayr <tbm@cyrius.com>
+ Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/33866
+ * gcc.dg/vect/pr33866.c: New testcase.
+
2007-10-24 Uros Bizjak <ubizjak@gmail.com>
* gcc.target/i386/pr11001-*.c: Remove -m32 from compile flags.
diff --git a/gcc/testsuite/gcc.dg/vect/pr33866.c b/gcc/testsuite/gcc.dg/vect/pr33866.c
new file mode 100644
index 00000000000..fbb97ebca21
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr33866.c
@@ -0,0 +1,31 @@
+/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
+/* { dg-do compile } */
+
+typedef struct
+{
+ long *coords;
+}
+fill_iter_info;
+
+extern H5Diterate (fill_iter_info *);
+
+void test_select_fill_hyper_simple (long *offset)
+{
+ long start[2];
+ int num_points;
+ long points[16][2];
+ fill_iter_info iter_info;
+ int i, j;
+ iter_info.coords = (long *) points;
+ for (i = 0, num_points = 0; j < (int) start[1]; j++, num_points++)
+ {
+ points[num_points][0] = i + start[0];
+ points[num_points][1] = j + start[1];
+ }
+ H5Diterate (&iter_info);
+}
+
+/* Needs interleaving support. */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_interleave } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c
index 1f07605d67d..4b88bdf7f43 100644
--- a/gcc/tree-vect-transform.c
+++ b/gcc/tree-vect-transform.c
@@ -4578,7 +4578,7 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
int nunits = TYPE_VECTOR_SUBPARTS (vectype);
int ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits;
int j;
- tree next_stmt, first_stmt;
+ tree next_stmt, first_stmt = NULL_TREE;
bool strided_store = false;
unsigned int group_size, i;
VEC(tree,heap) *dr_chain = NULL, *oprnds = NULL, *result_chain = NULL;
@@ -4640,9 +4640,28 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
if (STMT_VINFO_STRIDED_ACCESS (stmt_info))
{
strided_store = true;
+ first_stmt = DR_GROUP_FIRST_DR (stmt_info);
if (!vect_strided_store_supported (vectype)
&& !PURE_SLP_STMT (stmt_info) && !slp)
- return false;
+ return false;
+
+ if (first_stmt == stmt)
+ {
+ /* STMT is the leader of the group. Check the operands of all the
+ stmts of the group. */
+ next_stmt = DR_GROUP_NEXT_DR (stmt_info);
+ while (next_stmt)
+ {
+ op = GIMPLE_STMT_OPERAND (next_stmt, 1);
+ if (!vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt))
+ {
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "use not simple.");
+ return false;
+ }
+ next_stmt = DR_GROUP_NEXT_DR (vinfo_for_stmt (next_stmt));
+ }
+ }
}
if (!vec_stmt) /* transformation not required. */
@@ -4657,7 +4676,6 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
if (strided_store)
{
- first_stmt = DR_GROUP_FIRST_DR (stmt_info);
first_dr = STMT_VINFO_DATA_REF (vinfo_for_stmt (first_stmt));
group_size = DR_GROUP_SIZE (vinfo_for_stmt (first_stmt));
@@ -4803,8 +4821,9 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
OPRNDS are of size 1. */
for (i = 0; i < group_size; i++)
{
- vec_oprnd = vect_get_vec_def_for_stmt_copy (dt,
- VEC_index (tree, oprnds, i));
+ op = VEC_index (tree, oprnds, i);
+ vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt);
+ vec_oprnd = vect_get_vec_def_for_stmt_copy (dt, op);
VEC_replace(tree, dr_chain, i, vec_oprnd);
VEC_replace(tree, oprnds, i, vec_oprnd);
}