diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-02 11:54:09 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-02 11:54:09 +0000 |
commit | 1d62df1c1d25ec827399172d15d046f50ddfbb5e (patch) | |
tree | 536b79dc2d2049d0001860af4f3197fa19933676 /gcc/tree-vect-loop.c | |
parent | 7cea39c9458cf9e4f98b22ab1b59de12bc2f203b (diff) | |
download | gcc-1d62df1c1d25ec827399172d15d046f50ddfbb5e.tar.gz |
PR tree-optimization/57741
* tree-vect-loop.c (vect_is_simple_iv_evolution): Disallow
non-INTEGRAL_TYPE_P non-SCALAR_FLOAT_TYPE_P SSA_NAME step_exprs,
or SCALAR_FLOAT_TYPE_P SSA_NAMEs if !flag_associative_math.
Allow REAL_CST step_exprs if flag_associative_math.
(get_initial_def_for_induction): Handle SCALAR_FLOAT_TYPE_P step_expr.
* gcc.dg/vect/pr57741-1.c: New test.
* gcc.dg/vect/pr57741-2.c: New test.
* gcc.dg/vect/pr57741-3.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200600 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index c9b10213257..41eac972a97 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -538,7 +538,12 @@ vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init, if (TREE_CODE (step_expr) != INTEGER_CST && (TREE_CODE (step_expr) != SSA_NAME || ((bb = gimple_bb (SSA_NAME_DEF_STMT (step_expr))) - && flow_bb_inside_loop_p (get_loop (cfun, loop_nb), bb)))) + && flow_bb_inside_loop_p (get_loop (cfun, loop_nb), bb)) + || (!INTEGRAL_TYPE_P (TREE_TYPE (step_expr)) + && (!SCALAR_FLOAT_TYPE_P (TREE_TYPE (step_expr)) + || !flag_associative_math))) + && (TREE_CODE (step_expr) != REAL_CST + || !flag_associative_math)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, @@ -3276,7 +3281,13 @@ get_initial_def_for_induction (gimple iv_phi) { /* iv_loop is the loop to be vectorized. Generate: vec_step = [VF*S, VF*S, VF*S, VF*S] */ - expr = build_int_cst (TREE_TYPE (step_expr), vf); + if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (step_expr))) + { + expr = build_int_cst (integer_type_node, vf); + expr = fold_convert (TREE_TYPE (step_expr), expr); + } + else + expr = build_int_cst (TREE_TYPE (step_expr), vf); new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr), expr, step_expr); if (TREE_CODE (step_expr) == SSA_NAME) @@ -3339,7 +3350,13 @@ get_initial_def_for_induction (gimple iv_phi) gcc_assert (!nested_in_vect_loop); /* Create the vector that holds the step of the induction. */ - expr = build_int_cst (TREE_TYPE (step_expr), nunits); + if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (step_expr))) + { + expr = build_int_cst (integer_type_node, nunits); + expr = fold_convert (TREE_TYPE (step_expr), expr); + } + else + expr = build_int_cst (TREE_TYPE (step_expr), nunits); new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr), expr, step_expr); if (TREE_CODE (step_expr) == SSA_NAME) |