aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pop <sebastian.pop@amd.com>2010-03-30 19:58:35 +0000
committerSebastian Pop <spop@gcc.gnu.org>2010-03-30 19:58:35 +0000
commit8533c9d8ac498572eec1978b30860b487e47ade3 (patch)
tree22b4bb57614eef3adf7e4f9f22fb36de4a3af545
parentce0ecb98c2297112599b26191d5294187016307c (diff)
downloadgcc-8533c9d8ac498572eec1978b30860b487e47ade3.zip
gcc-8533c9d8ac498572eec1978b30860b487e47ade3.tar.gz
gcc-8533c9d8ac498572eec1978b30860b487e47ade3.tar.bz2
Replace type != type comparisons with types_compatible_p.
2010-03-30 Sebastian Pop <sebastian.pop@amd.com> PR middle-end/43430 * tree-vect-slp.c (vect_get_and_check_slp_defs): Replace type pointer comparisons with types_compatible_p. * tree-vect-stmts.c (vectorizable_call): Same. (vectorizable_condition): Same. * gcc.dg/vect/pr43430-1.c: New. From-SVN: r157833
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr43430-1.c39
-rw-r--r--gcc/tree-vect-slp.c10
-rw-r--r--gcc/tree-vect-stmts.c5
5 files changed, 61 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3dae6a0..a533a7f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2010-03-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/43430
+ * tree-vect-slp.c (vect_get_and_check_slp_defs): Replace type
+ pointer comparisons with types_compatible_p.
+ * tree-vect-stmts.c (vectorizable_call): Same.
+ (vectorizable_condition): Same.
+
2010-03-30 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* config/s390/s390.c (s390_emit_prologue): Omit issuing a dynamic
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ddc9128..c9ede61 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/43430
+ * gcc.dg/vect/pr43430-1.c: New.
+
2010-03-30 Jason Merrill <jason@redhat.com>
PR c++/43559
diff --git a/gcc/testsuite/gcc.dg/vect/pr43430-1.c b/gcc/testsuite/gcc.dg/vect/pr43430-1.c
new file mode 100644
index 0000000..9a36983
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr43430-1.c
@@ -0,0 +1,39 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+
+typedef int uint8_t;
+uint8_t data_ch1[N + 1] =
+ { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 };
+uint8_t data_ch2[N + 1] =
+ { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 };
+#define SUM 480
+
+__attribute__ ((noinline)) int
+foo (uint8_t * s1, uint8_t * s2, int stride)
+{
+ int score = 0;
+ int x;
+ for (x = 0; x < N; x++)
+ score += ((s1[x] - s1[x + stride] + s2[x + stride]) >= 0 ?
+ s1[x] + s2[x + stride] :
+ s2[x + stride]);
+
+ if (score != SUM)
+ abort ();
+
+ return 0;
+}
+
+int
+main (void)
+{
+ check_vect ();
+ return foo (data_ch1, data_ch2, 1);
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 13c96de..77fd929 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -246,14 +246,16 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
if ((i == 0
&& (*first_stmt_dt0 != dt[i]
|| (*first_stmt_def0_type && def
- && *first_stmt_def0_type != TREE_TYPE (def))))
+ && !types_compatible_p (*first_stmt_def0_type,
+ TREE_TYPE (def)))))
|| (i == 1
&& (*first_stmt_dt1 != dt[i]
|| (*first_stmt_def1_type && def
- && *first_stmt_def1_type != TREE_TYPE (def))))
+ && !types_compatible_p (*first_stmt_def1_type,
+ TREE_TYPE (def)))))
|| (!def
- && TREE_TYPE (*first_stmt_const_oprnd)
- != TREE_TYPE (oprnd)))
+ && !types_compatible_p (TREE_TYPE (*first_stmt_const_oprnd),
+ TREE_TYPE (oprnd))))
{
if (vect_print_dump_info (REPORT_SLP))
fprintf (vect_dump, "Build SLP failed: different types ");
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index c280e81..48bf1bd 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -1268,7 +1268,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt)
/* We can only handle calls with arguments of the same type. */
if (rhs_type
- && rhs_type != TREE_TYPE (op))
+ && !types_compatible_p (rhs_type, TREE_TYPE (op)))
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "argument types differ.");
@@ -3863,7 +3863,8 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
/* We do not handle two different vector types for the condition
and the values. */
- if (TREE_TYPE (TREE_OPERAND (cond_expr, 0)) != TREE_TYPE (vectype))
+ if (!types_compatible_p (TREE_TYPE (TREE_OPERAND (cond_expr, 0)),
+ TREE_TYPE (vectype)))
return false;
if (TREE_CODE (then_clause) == SSA_NAME)