OSDN Git Service

PR tree-optimization/43074
authorirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Feb 2010 11:35:03 +0000 (11:35 +0000)
committerirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Feb 2010 11:35:03 +0000 (11:35 +0000)
* tree-vectorizer.h (VECTORIZABLE_CYCLE_DEF): New.
* tree-vect-loop.c (vect_analyze_loop_operations): Add
vectorizable cycles in hybrid SLP check.
* tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Likewise.

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/fast-math-pr43074.c [new file with mode: 0644]
gcc/tree-vect-loop.c
gcc/tree-vect-slp.c
gcc/tree-vectorizer.h

index 8387923..4495a31 100644 (file)
@@ -1,3 +1,11 @@
+2010-02-16  Ira Rosen <irar@il.ibm.com>
+
+       PR tree-optimization/43074
+       * tree-vectorizer.h (VECTORIZABLE_CYCLE_DEF): New.
+       * tree-vect-loop.c (vect_analyze_loop_operations): Add
+       vectorizable cycles in hybrid SLP check.
+       * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Likewise.
+
 2010-02-16  Richard Guenther  <rguenther@suse.de>
 
        * alias.c (memrefs_conflict_p): Distinguish must-alias from
index 1c51234..7e06ff7 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-16  Ira Rosen <irar@il.ibm.com>
+
+       PR tree-optimization/43074
+       * gcc.dg/vect/fast-math-pr43074.c: New test.
+
 2010-02-16  Jakub Jelinek  <jakub@redhat.com>
 
        * lib/prune.exp: Prune variable tracking size limit exceeded
diff --git a/gcc/testsuite/gcc.dg/vect/fast-math-pr43074.c b/gcc/testsuite/gcc.dg/vect/fast-math-pr43074.c
new file mode 100644 (file)
index 0000000..80077ba
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+float
+pvslockprocess(float *fout, float *fin, int framesize)
+{
+  int i;
+  float mag=0.0f, diff;
+  for (i = 0; i < framesize; i += 2) {
+      mag += fin[i];
+      fout[i] = fin[i];
+      fout[i+1] = fin[i+1];
+  }
+  return mag;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
index 9e17eb3..16aa242 100644 (file)
@@ -1184,7 +1184,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo)
          if (!vect_analyze_stmt (stmt, &need_to_vectorize, NULL))
            return false;
 
-          if (STMT_VINFO_RELEVANT_P (stmt_info) && !PURE_SLP_STMT (stmt_info))
+          if ((STMT_VINFO_RELEVANT_P (stmt_info)
+               || VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_info)))
+              && !PURE_SLP_STMT (stmt_info))
+
             /* STMT needs both SLP and loop-based vectorization.  */
             only_slp_in_loop = false;
         }
index bbf2bd3..5a11b84 100644 (file)
@@ -1102,6 +1102,7 @@ vect_detect_hybrid_slp_stmts (slp_tree node)
   gimple stmt;
   imm_use_iterator imm_iter;
   gimple use_stmt;
+  stmt_vec_info stmt_vinfo; 
 
   if (!node)
     return;
@@ -1110,9 +1111,10 @@ vect_detect_hybrid_slp_stmts (slp_tree node)
     if (PURE_SLP_STMT (vinfo_for_stmt (stmt))
        && TREE_CODE (gimple_op (stmt, 0)) == SSA_NAME)
       FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, gimple_op (stmt, 0))
-       if (vinfo_for_stmt (use_stmt)
-           && !STMT_SLP_TYPE (vinfo_for_stmt (use_stmt))
-            && STMT_VINFO_RELEVANT (vinfo_for_stmt (use_stmt)))
+       if ((stmt_vinfo = vinfo_for_stmt (use_stmt))
+           && !STMT_SLP_TYPE (stmt_vinfo)
+            && (STMT_VINFO_RELEVANT (stmt_vinfo)
+                || VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_vinfo))))
          vect_mark_slp_stmts (node, hybrid, i);
 
   vect_detect_hybrid_slp_stmts (SLP_TREE_LEFT (node));
index b7c6316..2217a7c 100644 (file)
@@ -66,6 +66,10 @@ enum vect_def_type {
   vect_unknown_def_type
 };
 
+#define VECTORIZABLE_CYCLE_DEF(D) (((D) == vect_reduction_def)           \
+                                   || ((D) == vect_double_reduction_def) \
+                                   || ((D) == vect_nested_cycle))
+
 /* Define verbosity levels.  */
 enum verbosity_levels {
   REPORT_NONE,