diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8076302d94b..9b4a6fe9412 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-12-30 Ira Rosen + + PR tree-optimization/41956 + * tree-vect-slp.c (vect_supported_load_permutation_p): Add check that + the load indices differ. + 2009-12-30 Uros Bizjak PR target/42549 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 99f3dafa819..1c49c2d5a37 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-12-30 Ira Rosen + + PR tree-optimization/41956 + * gcc.dg/vect/pr41956.c: New test. + 2009-12-30 Uros Bizjak PR target/42549 diff --git a/gcc/testsuite/gcc.dg/vect/pr41956.c b/gcc/testsuite/gcc.dg/vect/pr41956.c new file mode 100644 index 00000000000..455f5051007 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr41956.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ + +void K (int *gpwgts, int *badminpwgt, int *badmaxpwgt) +{ + int i; + for (i = 0; i < 10; i += 2) { + badminpwgt[i] = badminpwgt[i+1] = gpwgts[i]+gpwgts[i]; + badmaxpwgt[i] = badmaxpwgt[i+1] = gpwgts[i]+gpwgts[i]; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 3222f8b450e..a3be6786d94 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -796,6 +796,7 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size, { int i = 0, j, prev = -1, next, k; bool supported; + sbitmap load_index; /* FORNOW: permutations are only supported in SLP. */ if (!slp_instn) @@ -816,6 +817,8 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size, return false; supported = true; + load_index = sbitmap_alloc (group_size); + sbitmap_zero (load_index); for (j = 0; j < group_size; j++) { for (i = j * group_size, k = 0; @@ -830,7 +833,17 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size, prev = next; } + + if (TEST_BIT (load_index, prev)) + { + supported = false; + break; + } + + SET_BIT (load_index, prev); } + + sbitmap_free (load_index); if (supported && i == group_size * group_size && vect_supported_slp_permutation_p (slp_instn))