diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-12-07 18:40:50 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-12-07 18:40:50 +0000 |
commit | 5ebaa4774fb6de458422c660ae11f1c3b7d96262 (patch) | |
tree | 7f5cb9043bbc4cb3bbc2359234b0e6bd0eb216f1 /gcc/tree-vect-generic.c | |
parent | 734914b6e230b78eb6c34fbd5a2d93b1a919d36a (diff) | |
download | gcc-5ebaa4774fb6de458422c660ae11f1c3b7d96262.zip gcc-5ebaa4774fb6de458422c660ae11f1c3b7d96262.tar.gz gcc-5ebaa4774fb6de458422c660ae11f1c3b7d96262.tar.bz2 |
Use tree_vector_builder instead of build_vector
This patch switches most build_vector calls over to tree_vector_builder,
using explicit encodings where appropriate. Later patches handle
the remaining uses of build_vector.
2017-12-07 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* config/sparc/sparc.c: Include tree-vector-builder.h.
(sparc_fold_builtin): Use tree_vector_builder instead of build_vector.
* expmed.c: Include tree-vector-builder.h.
(make_tree): Use tree_vector_builder instead of build_vector.
* fold-const.c: Include tree-vector-builder.h.
(const_binop): Use tree_vector_builder instead of build_vector.
(const_unop): Likewise.
(native_interpret_vector): Likewise.
(fold_vec_perm): Likewise.
(fold_ternary_loc): Likewise.
* gimple-fold.c: Include tree-vector-builder.h.
(gimple_fold_stmt_to_constant_1): Use tree_vector_builder instead
of build_vector.
* tree-ssa-forwprop.c: Include tree-vector-builder.h.
(simplify_vector_constructor): Use tree_vector_builder instead
of build_vector.
* tree-vect-generic.c: Include tree-vector-builder.h.
(add_rshift): Use tree_vector_builder instead of build_vector.
(expand_vector_divmod): Likewise.
(optimize_vector_constructor): Likewise.
* tree-vect-loop.c: Include tree-vector-builder.h.
(vect_create_epilog_for_reduction): Use tree_vector_builder instead
of build_vector. Explicitly use a stepped encoding for
{ 1, 2, 3, ... }.
* tree-vect-slp.c: Include tree-vector-builder.h.
(vect_get_constant_vectors): Use tree_vector_builder instead
of build_vector.
(vect_transform_slp_perm_load): Likewise.
(vect_schedule_slp_instance): Likewise.
* tree-vect-stmts.c: Include tree-vector-builder.h.
(vectorizable_bswap): Use tree_vector_builder instead of build_vector.
(vect_gen_perm_mask_any): Likewise.
(vectorizable_call): Likewise. Explicitly use a stepped encoding.
* tree.c: (build_vector_from_ctor): Use tree_vector_builder instead
of build_vector.
(build_vector_from_val): Likewise. Explicitly use a duplicate
encoding.
From-SVN: r255475
Diffstat (limited to 'gcc/tree-vect-generic.c')
-rw-r--r-- | gcc/tree-vect-generic.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index b114ff0..aa5542d 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see #include "gimplify-me.h" #include "gimplify.h" #include "tree-cfg.h" +#include "tree-vector-builder.h" static void expand_vector_operations_1 (gimple_stmt_iterator *); @@ -398,11 +399,10 @@ add_rshift (gimple_stmt_iterator *gsi, tree type, tree op0, int *shiftcnts) if (op != unknown_optab && optab_handler (op, TYPE_MODE (type)) != CODE_FOR_nothing) { - auto_vec<tree, 32> vec (nunits); + tree_vector_builder vec (type, nunits, 1); for (i = 0; i < nunits; i++) vec.quick_push (build_int_cst (TREE_TYPE (type), shiftcnts[i])); - return gimplify_build2 (gsi, RSHIFT_EXPR, type, op0, - build_vector (type, vec)); + return gimplify_build2 (gsi, RSHIFT_EXPR, type, op0, vec.build ()); } return NULL_TREE; @@ -635,12 +635,12 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, mask_type = build_same_sized_truth_vector_type (type); zero = build_zero_cst (type); cond = build2 (LT_EXPR, mask_type, op0, zero); - auto_vec<tree, 32> vec (nunits); + tree_vector_builder vec (type, nunits, 1); for (i = 0; i < nunits; i++) vec.quick_push (build_int_cst (TREE_TYPE (type), (HOST_WIDE_INT_1U << shifts[i]) - 1)); - cst = build_vector (type, vec); + cst = vec.build (); addend = make_ssa_name (type); stmt = gimple_build_assign (addend, VEC_COND_EXPR, cond, cst, zero); @@ -674,12 +674,12 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, else { tree mask; - auto_vec<tree, 32> vec (nunits); + tree_vector_builder vec (type, nunits, 1); for (i = 0; i < nunits; i++) vec.quick_push (build_int_cst (TREE_TYPE (type), (HOST_WIDE_INT_1U << shifts[i]) - 1)); - mask = build_vector (type, vec); + mask = vec.build (); op = optab_for_tree_code (BIT_AND_EXPR, type, optab_default); if (op != unknown_optab && optab_handler (op, TYPE_MODE (type)) != CODE_FOR_nothing) @@ -753,10 +753,10 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, return NULL_TREE; } - auto_vec<tree, 32> vec (nunits); + tree_vector_builder vec (type, nunits, 1); for (i = 0; i < nunits; i++) vec.quick_push (build_int_cst (TREE_TYPE (type), mulc[i])); - mulcst = build_vector (type, vec); + mulcst = vec.build (); cur_op = gimplify_build2 (gsi, MULT_HIGHPART_EXPR, type, cur_op, mulcst); @@ -1104,7 +1104,7 @@ optimize_vector_constructor (gimple_stmt_iterator *gsi) } if (all_same) return; - auto_vec<tree, 32> cst (nelts); + tree_vector_builder cst (type, nelts, 1); for (i = 0; i < nelts; i++) { tree this_base = CONSTRUCTOR_ELT (rhs, i)->value; @@ -1127,7 +1127,7 @@ optimize_vector_constructor (gimple_stmt_iterator *gsi) g = gimple_build_assign (make_ssa_name (type), rhs); gsi_insert_before (gsi, g, GSI_SAME_STMT); g = gimple_build_assign (lhs, PLUS_EXPR, gimple_assign_lhs (g), - build_vector (type, cst)); + cst.build ()); gsi_replace (gsi, g, false); } |