diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f659c2e8afab..1ce145f89295 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2008-09-21 Ira Rosen + + PR tree-optimization/37539 + * tree-vect-transform.c (vect_transform_strided_load): Save vector + statement in related statement field only for the first load of the + group of loads with the same data reference. + 2008-09-20 Adam Nemet * config/mips/mips.h (TUNE_OCTEON): New macro. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a2c85e21df49..6f92376669a8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-09-21 Ira Rosen + + PR tree-optimization/37539 + * gcc.dg/vect/pr37539.c: New test. + 2008-09-20 Eric Botcazou PR rtl-optimization/33642 diff --git a/gcc/testsuite/gcc.dg/vect/pr37539.c b/gcc/testsuite/gcc.dg/vect/pr37539.c new file mode 100644 index 000000000000..1d569a9986e9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr37539.c @@ -0,0 +1,45 @@ +/* { dg-require-effective-target vect_int } */ + +#include +#include "tree-vect.h" + +__attribute__ ((noinline)) void +ayuv2yuyv_ref (int *d, int *src, int n) +{ + char *dest = (char *)d; + int i; + + for(i=0;i>16; + dest[i*4 + 1] = (src[i*2 + 1])>>8; + dest[i*4 + 2] = (src[i*2 + 0])>>16; + dest[i*4 + 3] = (src[i*2 + 0])>>0; + } + + /* Check results. */ + for(i=0;i>16 + || dest[i*4 + 1] != (src[i*2 + 1])>>8 + || dest[i*4 + 2] != (src[i*2 + 0])>>16 + || dest[i*4 + 3] != (src[i*2 + 0])>>0) + abort(); + } +} + +int main () +{ + int d[256], src[128], i; + + for (i = 0; i < 128; i++) + src[i] = i; + + ayuv2yuyv_ref(d, src, 128); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_strided_wide } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + + + diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c index 06d6791e6391..4965da4ad0cf 100644 --- a/gcc/tree-vect-transform.c +++ b/gcc/tree-vect-transform.c @@ -5947,17 +5947,24 @@ vect_transform_strided_load (gimple stmt, VEC(tree,heap) *dr_chain, int size, STMT_VINFO_VEC_STMT (vinfo_for_stmt (next_stmt)) = new_stmt; else { - gimple prev_stmt = - STMT_VINFO_VEC_STMT (vinfo_for_stmt (next_stmt)); - gimple rel_stmt = - STMT_VINFO_RELATED_STMT (vinfo_for_stmt (prev_stmt)); - while (rel_stmt) - { - prev_stmt = rel_stmt; - rel_stmt = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (rel_stmt)); - } - STMT_VINFO_RELATED_STMT (vinfo_for_stmt (prev_stmt)) = new_stmt; + if (!DR_GROUP_SAME_DR_STMT (vinfo_for_stmt (next_stmt))) + { + gimple prev_stmt = + STMT_VINFO_VEC_STMT (vinfo_for_stmt (next_stmt)); + gimple rel_stmt = + STMT_VINFO_RELATED_STMT (vinfo_for_stmt (prev_stmt)); + while (rel_stmt) + { + prev_stmt = rel_stmt; + rel_stmt = + STMT_VINFO_RELATED_STMT (vinfo_for_stmt (rel_stmt)); + } + + STMT_VINFO_RELATED_STMT (vinfo_for_stmt (prev_stmt)) = + new_stmt; + } } + next_stmt = DR_GROUP_NEXT_DR (vinfo_for_stmt (next_stmt)); gap_count = 1; /* If NEXT_STMT accesses the same DR as the previous statement,