From 69d2aade06017139c9e5be9c749f84d33766c1de Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 6 Oct 2011 19:49:36 +0200 Subject: re PR tree-optimization/50596 (Problems in vectorization of condition expression) PR tree-optimization/50596 * tree-vectorizer.h (vect_is_simple_cond): New prototype. (NUM_PATTERNS): Change to 6. * tree-vect-patterns.c (vect_recog_mixed_size_cond_pattern): New function. (vect_vect_recog_func_ptrs): Add vect_recog_mixed_size_cond_pattern. (vect_mark_pattern_stmts): Don't create stmt_vinfo for def_stmt if it already has one, and don't set STMT_VINFO_VECTYPE in it if it is already set. * tree-vect-stmts.c (vect_mark_stmts_to_be_vectorized): Handle COND_EXPR in pattern stmts. (vect_is_simple_cond): No longer static. * lib/target-supports.exp (check_effective_target_vect_cond_mixed): New. * gcc.dg/vect/vect-cond-8.c: New test. From-SVN: r179626 --- gcc/tree-vect-stmts.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'gcc/tree-vect-stmts.c') diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 8c2edad..2110c96 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -652,9 +652,25 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo) have to scan the RHS or function arguments instead. */ if (is_gimple_assign (stmt)) { - for (i = 1; i < gimple_num_ops (stmt); i++) + enum tree_code rhs_code = gimple_assign_rhs_code (stmt); + tree op = gimple_assign_rhs1 (stmt); + + i = 1; + if (rhs_code == COND_EXPR && COMPARISON_CLASS_P (op)) + { + if (!process_use (stmt, TREE_OPERAND (op, 0), loop_vinfo, + live_p, relevant, &worklist) + || !process_use (stmt, TREE_OPERAND (op, 1), loop_vinfo, + live_p, relevant, &worklist)) + { + VEC_free (gimple, heap, worklist); + return false; + } + i = 2; + } + for (; i < gimple_num_ops (stmt); i++) { - tree op = gimple_op (stmt, i); + op = gimple_op (stmt, i); if (!process_use (stmt, op, loop_vinfo, live_p, relevant, &worklist)) { @@ -4682,7 +4698,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, Returns whether a COND can be vectorized. Checks whether condition operands are supportable using vec_is_simple_use. */ -static bool +bool vect_is_simple_cond (tree cond, loop_vec_info loop_vinfo, tree *comp_vectype) { tree lhs, rhs; -- cgit v1.1