diff options
author | Ira Rosen <irar@il.ibm.com> | 2010-10-11 12:18:47 +0000 |
---|---|---|
committer | Ira Rosen <irar@gcc.gnu.org> | 2010-10-11 12:18:47 +0000 |
commit | 4907769827b246d80145601c6fa5caf84f04f941 (patch) | |
tree | 5be2c3e76b5811cc4125f6b3ca857977cbda9646 /gcc | |
parent | a6510374cc351047417e6211b7f8391a1eeebf30 (diff) | |
download | gcc-4907769827b246d80145601c6fa5caf84f04f941.zip gcc-4907769827b246d80145601c6fa5caf84f04f941.tar.gz gcc-4907769827b246d80145601c6fa5caf84f04f941.tar.bz2 |
re PR tree-optimization/45902 (CPU2006 benchmark sphinx3 fails with vectorization)
PR tree-optimization/45902
* tree-vect-slp.c (vect_get_constant_vectors): Use statement's
vector type for constants, unless it's a pointer.
From-SVN: r165302
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr45902.c | 43 | ||||
-rw-r--r-- | gcc/tree-vect-slp.c | 15 |
4 files changed, 65 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 594946d..fd0bc367 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-10-11 Ira Rosen <irar@il.ibm.com> + + PR tree-optimization/45902 + * tree-vect-slp.c (vect_get_constant_vectors): Use statement's + vector type for constants, unless it's a pointer. + 2010-10-11 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> * config/s390/s390.md (*mov<mode>cc): lgoc -> locg and stgoc -> stocg. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 46b7174..315e688 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-10-11 Ira Rosen <irar@il.ibm.com> + + PR tree-optimization/45902 + * gcc.dg/vect/45902.c: New test. + 2010-10-11 Jakub Jelinek <jakub@redhat.com> PR target/45870 diff --git a/gcc/testsuite/gcc.dg/vect/pr45902.c b/gcc/testsuite/gcc.dg/vect/pr45902.c new file mode 100644 index 0000000..1690b3a --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr45902.c @@ -0,0 +1,43 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdlib.h> +#include "tree-vect.h" + +#define N 128 + +short res[N]; +short a[N]; + +int +main1 () +{ + int i; + + for (i = 0; i < N/4; i+=4) + { + res[i] = a[i] >> 8; + res[i+1] = a[i+1] >> 8; + res[i+2] = a[i+2] >> 8; + res[i+3] = a[i+3] >> 8; + } +} + +int +main () +{ + int i; + + for (i = 0; i < N; i++) + a[i] = i; + + main1 (); + + for (i = 0; i < N; i++) + if (res[i] != a[i] >> 8) + abort (); + + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 2dbe328..784db84 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1895,13 +1895,20 @@ vect_get_constant_vectors (slp_tree slp_node, VEC(tree,heap) **vec_oprnds, } if (CONSTANT_CLASS_P (op)) - constant_p = true; + { + constant_p = true; + if (POINTER_TYPE_P (TREE_TYPE (gimple_assign_lhs (stmt)))) + vector_type = get_vectype_for_scalar_type (TREE_TYPE (op)); + else + vector_type = STMT_VINFO_VECTYPE (stmt_vinfo); + } else - constant_p = false; + { + constant_p = false; + vector_type = get_vectype_for_scalar_type (TREE_TYPE (op)); + } - vector_type = get_vectype_for_scalar_type (TREE_TYPE (op)); gcc_assert (vector_type); - nunits = TYPE_VECTOR_SUBPARTS (vector_type); /* NUMBER_OF_COPIES is the number of times we need to use the same values in |