OSDN Git Service

Replace type != type comparisons with types_compatible_p.
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 30 Mar 2010 19:58:35 +0000 (19:58 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 30 Mar 2010 19:58:35 +0000 (19:58 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157833 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr43430-1.c [new file with mode: 0644]
gcc/tree-vect-slp.c
gcc/tree-vect-stmts.c

index 3dae6a0..a533a7f 100644 (file)
@@ -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
index ddc9128..c9ede61 100644 (file)
@@ -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 (file)
index 0000000..9a36983
--- /dev/null
@@ -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" } } */
index 13c96de..77fd929 100644 (file)
@@ -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 ");
index c280e81..48bf1bd 100644 (file)
@@ -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)