summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-30 11:43:55 +0000
committerirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-30 11:43:55 +0000
commitb3d251d46f2a61670d50b41b2d7508ff84c8d687 (patch)
tree0e4073cf8b4d9f6d0452db545138ce59f7532485
parenta7d6b13e4e072e6ca8b8b0e9614e6607b8a27886 (diff)
downloadgcc-b3d251d46f2a61670d50b41b2d7508ff84c8d687.tar.gz
PR tree-optimization/36648
* tree-vect-transform.c (vect_do_peeling_for_loop_bound): Divide number of prolog iterations by step. Fix the comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137272 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/vect/pr36648.cc24
-rw-r--r--gcc/tree-vect-transform.c29
4 files changed, 46 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b4695d3eeac..a7832ec0adc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-30 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/36648
+ * tree-vect-transform.c (vect_do_peeling_for_loop_bound): Divide
+ number of prolog iterations by step. Fix the comment.
+
2008-06-30 Richard Guenther <rguenther@suse.de>
PR middle-end/36671
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e1c86aeff2d..a23526877dd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-30 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/36648
+ * g++.dg/vect/pr36648.cc: New testcase.
+
2008-06-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/36655
diff --git a/gcc/testsuite/g++.dg/vect/pr36648.cc b/gcc/testsuite/g++.dg/vect/pr36648.cc
new file mode 100644
index 00000000000..b2933034b55
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr36648.cc
@@ -0,0 +1,24 @@
+/* { dg-require-effective-target vect_float } */
+
+struct vector
+{
+ vector() : x(0), y(0), z(0) { }
+ float x,y,z;
+};
+
+struct Foo
+{
+ int dummy;
+ /* Misaligned access. */
+ vector array_of_vectors[4];
+};
+
+Foo foo;
+
+int main() { }
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } }*/
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
+
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c
index 4110b335d74..1fa786da0b9 100644
--- a/gcc/tree-vect-transform.c
+++ b/gcc/tree-vect-transform.c
@@ -6725,16 +6725,14 @@ vect_do_peeling_for_loop_bound (loop_vec_info loop_vinfo, tree *ratio)
Else, compute address misalignment in bytes:
addr_mis = addr & (vectype_size - 1)
- prolog_niters = min ( LOOP_NITERS , (VF - addr_mis/elem_size)&(VF-1) )
-
- (elem_size = element type size; an element is the scalar element
- whose type is the inner type of the vectype)
+ prolog_niters = min (LOOP_NITERS, ((VF - addr_mis/elem_size)&(VF-1))/step)
- For interleaving,
+ (elem_size = element type size; an element is the scalar element whose type
+ is the inner type of the vectype)
- prolog_niters = min ( LOOP_NITERS ,
- (VF/group_size - addr_mis/elem_size)&(VF/group_size-1) )
- where group_size is the size of the interleaved group.
+ When the step of the data-ref in the loop is not 1 (as in interleaved data
+ and SLP), the number of iterations of the prolog must be divided by the step
+ (which is equal to the size of interleaved group).
The above formulas assume that VF == number of elements in the vector. This
may not hold when there are multiple-types in the loop.
@@ -6756,18 +6754,12 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters)
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
int vectype_align = TYPE_ALIGN (vectype) / BITS_PER_UNIT;
tree niters_type = TREE_TYPE (loop_niters);
- int group_size = 1;
+ int step = 1;
int element_size = GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (DR_REF (dr))));
int nelements = TYPE_VECTOR_SUBPARTS (vectype);
if (STMT_VINFO_STRIDED_ACCESS (stmt_info))
- {
- /* For interleaved access element size must be multiplied by the size of
- the interleaved group. */
- group_size = DR_GROUP_SIZE (vinfo_for_stmt (
- DR_GROUP_FIRST_DR (stmt_info)));
- element_size *= group_size;
- }
+ step = DR_GROUP_SIZE (vinfo_for_stmt (DR_GROUP_FIRST_DR (stmt_info)));
pe = loop_preheader_edge (loop);
@@ -6778,8 +6770,9 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters)
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "known alignment = %d.", byte_misalign);
- iters = build_int_cst (niters_type,
- (nelements - elem_misalign)&(nelements/group_size-1));
+
+ iters = build_int_cst (niters_type,
+ (((nelements - elem_misalign) & (nelements - 1)) / step));
}
else
{