Commit e4057a39 by Richard Sandiford Committed by Richard Sandiford

[34/46] Alter interface to vect_get_vec_def_for_stmt_copy

This patch makes vect_get_vec_def_for_stmt_copy take a vec_info
rather than a vect_def_type.  If the vector operand passed in is
defined in the vectorised region, we should look for copies in
the normal way.  If it's defined in an external statement
(such as by vect_init_vector_1) we should just use the original value.

2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vectorizer.h (vect_get_vec_defs_for_stmt_copy)
	(vect_get_vec_def_for_stmt_copy): Take a vec_info rather than
	a vect_def_type for the first argument.
	* tree-vect-stmts.c (vect_get_vec_defs_for_stmt_copy): Likewise.
	(vect_get_vec_def_for_stmt_copy): Likewise.  Return the original
	operand if it isn't defined by a vectorized statement.
	(vect_build_gather_load_calls): Remove the mask_dt argument and
	update calls to vect_get_vec_def_for_stmt_copy.
	(vectorizable_bswap): Likewise the dt argument.
	(vectorizable_call): Update calls to vectorizable_bswap and
	vect_get_vec_def_for_stmt_copy.
	(vectorizable_simd_clone_call, vectorizable_assignment)
	(vectorizable_shift, vectorizable_operation, vectorizable_condition)
	(vectorizable_comparison): Update calls to
	vect_get_vec_def_for_stmt_copy.
	(vectorizable_store): Likewise.  Remove now-unnecessary calls to
	vect_is_simple_use.
	(vect_get_loop_based_defs): Remove dt argument and update call
	to vect_get_vec_def_for_stmt_copy.
	(vectorizable_conversion): Update calls to vect_get_loop_based_defs
	and vect_get_vec_def_for_stmt_copy.
	(vectorizable_load): Update calls to vect_build_gather_load_calls
	and vect_get_vec_def_for_stmt_copy.
	* tree-vect-loop.c (vect_create_epilog_for_reduction)
	(vectorizable_reduction, vectorizable_live_operation): Update calls
	to vect_get_vec_def_for_stmt_copy.

From-SVN: r263149
parent d7609678
2018-07-31 Richard Sandiford <richard.sandiford@arm.com> 2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
* tree-vectorizer.h (vect_get_vec_defs_for_stmt_copy)
(vect_get_vec_def_for_stmt_copy): Take a vec_info rather than
a vect_def_type for the first argument.
* tree-vect-stmts.c (vect_get_vec_defs_for_stmt_copy): Likewise.
(vect_get_vec_def_for_stmt_copy): Likewise. Return the original
operand if it isn't defined by a vectorized statement.
(vect_build_gather_load_calls): Remove the mask_dt argument and
update calls to vect_get_vec_def_for_stmt_copy.
(vectorizable_bswap): Likewise the dt argument.
(vectorizable_call): Update calls to vectorizable_bswap and
vect_get_vec_def_for_stmt_copy.
(vectorizable_simd_clone_call, vectorizable_assignment)
(vectorizable_shift, vectorizable_operation, vectorizable_condition)
(vectorizable_comparison): Update calls to
vect_get_vec_def_for_stmt_copy.
(vectorizable_store): Likewise. Remove now-unnecessary calls to
vect_is_simple_use.
(vect_get_loop_based_defs): Remove dt argument and update call
to vect_get_vec_def_for_stmt_copy.
(vectorizable_conversion): Update calls to vect_get_loop_based_defs
and vect_get_vec_def_for_stmt_copy.
(vectorizable_load): Update calls to vect_build_gather_load_calls
and vect_get_vec_def_for_stmt_copy.
* tree-vect-loop.c (vect_create_epilog_for_reduction)
(vectorizable_reduction, vectorizable_live_operation): Update calls
to vect_get_vec_def_for_stmt_copy.
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
* tree-vect-data-refs.c (vect_record_base_alignment): Replace vec_info * tree-vect-data-refs.c (vect_record_base_alignment): Replace vec_info
and gimple stmt arguments with a stmt_vec_info. and gimple stmt arguments with a stmt_vec_info.
(vect_record_base_alignments): Update calls accordingly. (vect_record_base_alignments): Update calls accordingly.
......
...@@ -4421,7 +4421,6 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, ...@@ -4421,7 +4421,6 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs,
bool nested_in_vect_loop = false; bool nested_in_vect_loop = false;
auto_vec<gimple *> new_phis; auto_vec<gimple *> new_phis;
auto_vec<stmt_vec_info> inner_phis; auto_vec<stmt_vec_info> inner_phis;
enum vect_def_type dt = vect_unknown_def_type;
int j, i; int j, i;
auto_vec<tree> scalar_results; auto_vec<tree> scalar_results;
unsigned int group_size = 1, k, ratio; unsigned int group_size = 1, k, ratio;
...@@ -4528,8 +4527,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, ...@@ -4528,8 +4527,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs,
phi_info = STMT_VINFO_RELATED_STMT (phi_info); phi_info = STMT_VINFO_RELATED_STMT (phi_info);
if (nested_in_vect_loop) if (nested_in_vect_loop)
vec_init_def vec_init_def
= vect_get_vec_def_for_stmt_copy (initial_def_dt, = vect_get_vec_def_for_stmt_copy (loop_vinfo, vec_init_def);
vec_init_def);
} }
/* Set the loop-entry arg of the reduction-phi. */ /* Set the loop-entry arg of the reduction-phi. */
...@@ -4556,7 +4554,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, ...@@ -4556,7 +4554,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs,
/* Set the loop-latch arg for the reduction-phi. */ /* Set the loop-latch arg for the reduction-phi. */
if (j > 0) if (j > 0)
def = vect_get_vec_def_for_stmt_copy (vect_unknown_def_type, def); def = vect_get_vec_def_for_stmt_copy (loop_vinfo, def);
add_phi_arg (phi, def, loop_latch_edge (loop), UNKNOWN_LOCATION); add_phi_arg (phi, def, loop_latch_edge (loop), UNKNOWN_LOCATION);
...@@ -4697,7 +4695,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, ...@@ -4697,7 +4695,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs,
new_phis.quick_push (phi); new_phis.quick_push (phi);
else else
{ {
def = vect_get_vec_def_for_stmt_copy (dt, def); def = vect_get_vec_def_for_stmt_copy (loop_vinfo, def);
STMT_VINFO_RELATED_STMT (prev_phi_info) = phi_info; STMT_VINFO_RELATED_STMT (prev_phi_info) = phi_info;
} }
...@@ -7111,19 +7109,22 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -7111,19 +7109,22 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
vec_oprnds0[0] = gimple_get_lhs (new_stmt_info->stmt); vec_oprnds0[0] = gimple_get_lhs (new_stmt_info->stmt);
else else
vec_oprnds0[0] vec_oprnds0[0]
= vect_get_vec_def_for_stmt_copy (dts[0], vec_oprnds0[0]); = vect_get_vec_def_for_stmt_copy (loop_vinfo,
vec_oprnds0[0]);
if (single_defuse_cycle && reduc_index == 1) if (single_defuse_cycle && reduc_index == 1)
vec_oprnds1[0] = gimple_get_lhs (new_stmt_info->stmt); vec_oprnds1[0] = gimple_get_lhs (new_stmt_info->stmt);
else else
vec_oprnds1[0] vec_oprnds1[0]
= vect_get_vec_def_for_stmt_copy (dts[1], vec_oprnds1[0]); = vect_get_vec_def_for_stmt_copy (loop_vinfo,
vec_oprnds1[0]);
if (op_type == ternary_op) if (op_type == ternary_op)
{ {
if (single_defuse_cycle && reduc_index == 2) if (single_defuse_cycle && reduc_index == 2)
vec_oprnds2[0] = gimple_get_lhs (new_stmt_info->stmt); vec_oprnds2[0] = gimple_get_lhs (new_stmt_info->stmt);
else else
vec_oprnds2[0] vec_oprnds2[0]
= vect_get_vec_def_for_stmt_copy (dts[2], vec_oprnds2[0]); = vect_get_vec_def_for_stmt_copy (loop_vinfo,
vec_oprnds2[0]);
} }
} }
} }
...@@ -7945,8 +7946,7 @@ vectorizable_live_operation (stmt_vec_info stmt_info, ...@@ -7945,8 +7946,7 @@ vectorizable_live_operation (stmt_vec_info stmt_info,
/* For multiple copies, get the last copy. */ /* For multiple copies, get the last copy. */
for (int i = 1; i < ncopies; ++i) for (int i = 1; i < ncopies; ++i)
vec_lhs = vect_get_vec_def_for_stmt_copy (vect_unknown_def_type, vec_lhs = vect_get_vec_def_for_stmt_copy (loop_vinfo, vec_lhs);
vec_lhs);
/* Get the last lane in the vector. */ /* Get the last lane in the vector. */
bitstart = int_const_binop (MINUS_EXPR, vec_bitsize, bitsize); bitstart = int_const_binop (MINUS_EXPR, vec_bitsize, bitsize);
......
...@@ -1580,8 +1580,7 @@ vect_get_vec_def_for_operand (tree op, stmt_vec_info stmt_vinfo, tree vectype) ...@@ -1580,8 +1580,7 @@ vect_get_vec_def_for_operand (tree op, stmt_vec_info stmt_vinfo, tree vectype)
created in case the vectorized result cannot fit in one vector, and several created in case the vectorized result cannot fit in one vector, and several
copies of the vector-stmt are required. In this case the vector-def is copies of the vector-stmt are required. In this case the vector-def is
retrieved from the vector stmt recorded in the STMT_VINFO_RELATED_STMT field retrieved from the vector stmt recorded in the STMT_VINFO_RELATED_STMT field
of the stmt that defines VEC_OPRND. of the stmt that defines VEC_OPRND. VINFO describes the vectorization.
DT is the type of the vector def VEC_OPRND.
Context: Context:
In case the vectorization factor (VF) is bigger than the number In case the vectorization factor (VF) is bigger than the number
...@@ -1625,29 +1624,24 @@ vect_get_vec_def_for_operand (tree op, stmt_vec_info stmt_vinfo, tree vectype) ...@@ -1625,29 +1624,24 @@ vect_get_vec_def_for_operand (tree op, stmt_vec_info stmt_vinfo, tree vectype)
STMT_VINFO_RELATED_STMT field of 'VS1.0' we obtain the next copy - 'VS1.1', STMT_VINFO_RELATED_STMT field of 'VS1.0' we obtain the next copy - 'VS1.1',
and return its def ('vx.1'). and return its def ('vx.1').
Overall, to create the above sequence this function will be called 3 times: Overall, to create the above sequence this function will be called 3 times:
vx.1 = vect_get_vec_def_for_stmt_copy (dt, vx.0); vx.1 = vect_get_vec_def_for_stmt_copy (vinfo, vx.0);
vx.2 = vect_get_vec_def_for_stmt_copy (dt, vx.1); vx.2 = vect_get_vec_def_for_stmt_copy (vinfo, vx.1);
vx.3 = vect_get_vec_def_for_stmt_copy (dt, vx.2); */ vx.3 = vect_get_vec_def_for_stmt_copy (vinfo, vx.2); */
tree tree
vect_get_vec_def_for_stmt_copy (enum vect_def_type dt, tree vec_oprnd) vect_get_vec_def_for_stmt_copy (vec_info *vinfo, tree vec_oprnd)
{ {
gimple *vec_stmt_for_operand; stmt_vec_info def_stmt_info = vinfo->lookup_def (vec_oprnd);
stmt_vec_info def_stmt_info; if (!def_stmt_info)
/* Do nothing; can reuse same def. */
/* Do nothing; can reuse same def. */
if (dt == vect_external_def || dt == vect_constant_def )
return vec_oprnd; return vec_oprnd;
vec_stmt_for_operand = SSA_NAME_DEF_STMT (vec_oprnd); def_stmt_info = STMT_VINFO_RELATED_STMT (def_stmt_info);
def_stmt_info = vinfo_for_stmt (vec_stmt_for_operand);
gcc_assert (def_stmt_info); gcc_assert (def_stmt_info);
vec_stmt_for_operand = STMT_VINFO_RELATED_STMT (def_stmt_info); if (gphi *phi = dyn_cast <gphi *> (def_stmt_info->stmt))
gcc_assert (vec_stmt_for_operand); vec_oprnd = PHI_RESULT (phi);
if (gimple_code (vec_stmt_for_operand) == GIMPLE_PHI)
vec_oprnd = PHI_RESULT (vec_stmt_for_operand);
else else
vec_oprnd = gimple_get_lhs (vec_stmt_for_operand); vec_oprnd = gimple_get_lhs (def_stmt_info->stmt);
return vec_oprnd; return vec_oprnd;
} }
...@@ -1656,19 +1650,19 @@ vect_get_vec_def_for_stmt_copy (enum vect_def_type dt, tree vec_oprnd) ...@@ -1656,19 +1650,19 @@ vect_get_vec_def_for_stmt_copy (enum vect_def_type dt, tree vec_oprnd)
stmt. See vect_get_vec_def_for_stmt_copy () for details. */ stmt. See vect_get_vec_def_for_stmt_copy () for details. */
void void
vect_get_vec_defs_for_stmt_copy (enum vect_def_type *dt, vect_get_vec_defs_for_stmt_copy (vec_info *vinfo,
vec<tree> *vec_oprnds0, vec<tree> *vec_oprnds0,
vec<tree> *vec_oprnds1) vec<tree> *vec_oprnds1)
{ {
tree vec_oprnd = vec_oprnds0->pop (); tree vec_oprnd = vec_oprnds0->pop ();
vec_oprnd = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd); vec_oprnd = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd);
vec_oprnds0->quick_push (vec_oprnd); vec_oprnds0->quick_push (vec_oprnd);
if (vec_oprnds1 && vec_oprnds1->length ()) if (vec_oprnds1 && vec_oprnds1->length ())
{ {
vec_oprnd = vec_oprnds1->pop (); vec_oprnd = vec_oprnds1->pop ();
vec_oprnd = vect_get_vec_def_for_stmt_copy (dt[1], vec_oprnd); vec_oprnd = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd);
vec_oprnds1->quick_push (vec_oprnd); vec_oprnds1->quick_push (vec_oprnd);
} }
} }
...@@ -2662,7 +2656,7 @@ vect_build_gather_load_calls (stmt_vec_info stmt_info, ...@@ -2662,7 +2656,7 @@ vect_build_gather_load_calls (stmt_vec_info stmt_info,
gimple_stmt_iterator *gsi, gimple_stmt_iterator *gsi,
stmt_vec_info *vec_stmt, stmt_vec_info *vec_stmt,
gather_scatter_info *gs_info, gather_scatter_info *gs_info,
tree mask, vect_def_type mask_dt) tree mask)
{ {
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
...@@ -2767,8 +2761,8 @@ vect_build_gather_load_calls (stmt_vec_info stmt_info, ...@@ -2767,8 +2761,8 @@ vect_build_gather_load_calls (stmt_vec_info stmt_info,
op = vec_oprnd0 op = vec_oprnd0
= vect_get_vec_def_for_operand (gs_info->offset, stmt_info); = vect_get_vec_def_for_operand (gs_info->offset, stmt_info);
else else
op = vec_oprnd0 op = vec_oprnd0 = vect_get_vec_def_for_stmt_copy (loop_vinfo,
= vect_get_vec_def_for_stmt_copy (gs_info->offset_dt, vec_oprnd0); vec_oprnd0);
if (!useless_type_conversion_p (idxtype, TREE_TYPE (op))) if (!useless_type_conversion_p (idxtype, TREE_TYPE (op)))
{ {
...@@ -2791,7 +2785,8 @@ vect_build_gather_load_calls (stmt_vec_info stmt_info, ...@@ -2791,7 +2785,8 @@ vect_build_gather_load_calls (stmt_vec_info stmt_info,
if (j == 0) if (j == 0)
vec_mask = vect_get_vec_def_for_operand (mask, stmt_info); vec_mask = vect_get_vec_def_for_operand (mask, stmt_info);
else else
vec_mask = vect_get_vec_def_for_stmt_copy (mask_dt, vec_mask); vec_mask = vect_get_vec_def_for_stmt_copy (loop_vinfo,
vec_mask);
mask_op = vec_mask; mask_op = vec_mask;
if (!useless_type_conversion_p (masktype, TREE_TYPE (vec_mask))) if (!useless_type_conversion_p (masktype, TREE_TYPE (vec_mask)))
...@@ -2951,11 +2946,11 @@ vect_get_data_ptr_increment (data_reference *dr, tree aggr_type, ...@@ -2951,11 +2946,11 @@ vect_get_data_ptr_increment (data_reference *dr, tree aggr_type,
static bool static bool
vectorizable_bswap (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, vectorizable_bswap (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
stmt_vec_info *vec_stmt, slp_tree slp_node, stmt_vec_info *vec_stmt, slp_tree slp_node,
tree vectype_in, enum vect_def_type *dt, tree vectype_in, stmt_vector_for_cost *cost_vec)
stmt_vector_for_cost *cost_vec)
{ {
tree op, vectype; tree op, vectype;
gcall *stmt = as_a <gcall *> (stmt_info->stmt); gcall *stmt = as_a <gcall *> (stmt_info->stmt);
vec_info *vinfo = stmt_info->vinfo;
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
unsigned ncopies; unsigned ncopies;
unsigned HOST_WIDE_INT nunits, num_bytes; unsigned HOST_WIDE_INT nunits, num_bytes;
...@@ -3021,7 +3016,7 @@ vectorizable_bswap (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -3021,7 +3016,7 @@ vectorizable_bswap (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
if (j == 0) if (j == 0)
vect_get_vec_defs (op, NULL, stmt_info, &vec_oprnds, NULL, slp_node); vect_get_vec_defs (op, NULL, stmt_info, &vec_oprnds, NULL, slp_node);
else else
vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds, NULL); vect_get_vec_defs_for_stmt_copy (vinfo, &vec_oprnds, NULL);
/* Arguments are ready. create the new vector stmt. */ /* Arguments are ready. create the new vector stmt. */
unsigned i; unsigned i;
...@@ -3301,7 +3296,7 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -3301,7 +3296,7 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
|| gimple_call_builtin_p (stmt, BUILT_IN_BSWAP32) || gimple_call_builtin_p (stmt, BUILT_IN_BSWAP32)
|| gimple_call_builtin_p (stmt, BUILT_IN_BSWAP64))) || gimple_call_builtin_p (stmt, BUILT_IN_BSWAP64)))
return vectorizable_bswap (stmt_info, gsi, vec_stmt, slp_node, return vectorizable_bswap (stmt_info, gsi, vec_stmt, slp_node,
vectype_in, dt, cost_vec); vectype_in, cost_vec);
else else
{ {
if (dump_enabled_p ()) if (dump_enabled_p ())
...@@ -3450,7 +3445,7 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -3450,7 +3445,7 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
= vect_get_vec_def_for_operand (op, stmt_info); = vect_get_vec_def_for_operand (op, stmt_info);
else else
vec_oprnd0 vec_oprnd0
= vect_get_vec_def_for_stmt_copy (dt[i], orig_vargs[i]); = vect_get_vec_def_for_stmt_copy (vinfo, orig_vargs[i]);
orig_vargs[i] = vargs[i] = vec_oprnd0; orig_vargs[i] = vargs[i] = vec_oprnd0;
} }
...@@ -3582,16 +3577,16 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -3582,16 +3577,16 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
vec_oprnd0 vec_oprnd0
= vect_get_vec_def_for_operand (op, stmt_info); = vect_get_vec_def_for_operand (op, stmt_info);
vec_oprnd1 vec_oprnd1
= vect_get_vec_def_for_stmt_copy (dt[i], vec_oprnd0); = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd0);
} }
else else
{ {
vec_oprnd1 = gimple_call_arg (new_stmt_info->stmt, vec_oprnd1 = gimple_call_arg (new_stmt_info->stmt,
2 * i + 1); 2 * i + 1);
vec_oprnd0 vec_oprnd0
= vect_get_vec_def_for_stmt_copy (dt[i], vec_oprnd1); = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd1);
vec_oprnd1 vec_oprnd1
= vect_get_vec_def_for_stmt_copy (dt[i], vec_oprnd0); = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd0);
} }
vargs.quick_push (vec_oprnd0); vargs.quick_push (vec_oprnd0);
...@@ -4103,7 +4098,7 @@ vectorizable_simd_clone_call (stmt_vec_info stmt_info, ...@@ -4103,7 +4098,7 @@ vectorizable_simd_clone_call (stmt_vec_info stmt_info,
vec_oprnd0 = arginfo[i].op; vec_oprnd0 = arginfo[i].op;
if ((m & (k - 1)) == 0) if ((m & (k - 1)) == 0)
vec_oprnd0 vec_oprnd0
= vect_get_vec_def_for_stmt_copy (arginfo[i].dt, = vect_get_vec_def_for_stmt_copy (vinfo,
vec_oprnd0); vec_oprnd0);
} }
arginfo[i].op = vec_oprnd0; arginfo[i].op = vec_oprnd0;
...@@ -4134,7 +4129,7 @@ vectorizable_simd_clone_call (stmt_vec_info stmt_info, ...@@ -4134,7 +4129,7 @@ vectorizable_simd_clone_call (stmt_vec_info stmt_info,
= vect_get_vec_def_for_operand (op, stmt_info); = vect_get_vec_def_for_operand (op, stmt_info);
else else
vec_oprnd0 vec_oprnd0
= vect_get_vec_def_for_stmt_copy (arginfo[i].dt, = vect_get_vec_def_for_stmt_copy (vinfo,
arginfo[i].op); arginfo[i].op);
arginfo[i].op = vec_oprnd0; arginfo[i].op = vec_oprnd0;
if (k == 1) if (k == 1)
...@@ -4440,9 +4435,9 @@ vect_gen_widened_results_half (enum tree_code code, ...@@ -4440,9 +4435,9 @@ vect_gen_widened_results_half (enum tree_code code,
static void static void
vect_get_loop_based_defs (tree *oprnd, stmt_vec_info stmt_info, vect_get_loop_based_defs (tree *oprnd, stmt_vec_info stmt_info,
enum vect_def_type dt, vec<tree> *vec_oprnds, vec<tree> *vec_oprnds, int multi_step_cvt)
int multi_step_cvt)
{ {
vec_info *vinfo = stmt_info->vinfo;
tree vec_oprnd; tree vec_oprnd;
/* Get first vector operand. */ /* Get first vector operand. */
...@@ -4451,12 +4446,12 @@ vect_get_loop_based_defs (tree *oprnd, stmt_vec_info stmt_info, ...@@ -4451,12 +4446,12 @@ vect_get_loop_based_defs (tree *oprnd, stmt_vec_info stmt_info,
if (TREE_CODE (TREE_TYPE (*oprnd)) != VECTOR_TYPE) if (TREE_CODE (TREE_TYPE (*oprnd)) != VECTOR_TYPE)
vec_oprnd = vect_get_vec_def_for_operand (*oprnd, stmt_info); vec_oprnd = vect_get_vec_def_for_operand (*oprnd, stmt_info);
else else
vec_oprnd = vect_get_vec_def_for_stmt_copy (dt, *oprnd); vec_oprnd = vect_get_vec_def_for_stmt_copy (vinfo, *oprnd);
vec_oprnds->quick_push (vec_oprnd); vec_oprnds->quick_push (vec_oprnd);
/* Get second vector operand. */ /* Get second vector operand. */
vec_oprnd = vect_get_vec_def_for_stmt_copy (dt, vec_oprnd); vec_oprnd = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd);
vec_oprnds->quick_push (vec_oprnd); vec_oprnds->quick_push (vec_oprnd);
*oprnd = vec_oprnd; *oprnd = vec_oprnd;
...@@ -4464,7 +4459,7 @@ vect_get_loop_based_defs (tree *oprnd, stmt_vec_info stmt_info, ...@@ -4464,7 +4459,7 @@ vect_get_loop_based_defs (tree *oprnd, stmt_vec_info stmt_info,
/* For conversion in multiple steps, continue to get operands /* For conversion in multiple steps, continue to get operands
recursively. */ recursively. */
if (multi_step_cvt) if (multi_step_cvt)
vect_get_loop_based_defs (oprnd, stmt_info, dt, vec_oprnds, vect_get_loop_based_defs (oprnd, stmt_info, vec_oprnds,
multi_step_cvt - 1); multi_step_cvt - 1);
} }
...@@ -4983,7 +4978,7 @@ vectorizable_conversion (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -4983,7 +4978,7 @@ vectorizable_conversion (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
vect_get_vec_defs (op0, NULL, stmt_info, &vec_oprnds0, vect_get_vec_defs (op0, NULL, stmt_info, &vec_oprnds0,
NULL, slp_node); NULL, slp_node);
else else
vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds0, NULL); vect_get_vec_defs_for_stmt_copy (vinfo, &vec_oprnds0, NULL);
FOR_EACH_VEC_ELT (vec_oprnds0, i, vop0) FOR_EACH_VEC_ELT (vec_oprnds0, i, vop0)
{ {
...@@ -5070,7 +5065,7 @@ vectorizable_conversion (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -5070,7 +5065,7 @@ vectorizable_conversion (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
} }
else else
{ {
vec_oprnd0 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd0); vec_oprnd0 = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd0);
vec_oprnds0.truncate (0); vec_oprnds0.truncate (0);
vec_oprnds0.quick_push (vec_oprnd0); vec_oprnds0.quick_push (vec_oprnd0);
if (op_type == binary_op) if (op_type == binary_op)
...@@ -5078,7 +5073,7 @@ vectorizable_conversion (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -5078,7 +5073,7 @@ vectorizable_conversion (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
if (code == WIDEN_LSHIFT_EXPR) if (code == WIDEN_LSHIFT_EXPR)
vec_oprnd1 = op1; vec_oprnd1 = op1;
else else
vec_oprnd1 = vect_get_vec_def_for_stmt_copy (dt[1], vec_oprnd1 = vect_get_vec_def_for_stmt_copy (vinfo,
vec_oprnd1); vec_oprnd1);
vec_oprnds1.truncate (0); vec_oprnds1.truncate (0);
vec_oprnds1.quick_push (vec_oprnd1); vec_oprnds1.quick_push (vec_oprnd1);
...@@ -5160,8 +5155,7 @@ vectorizable_conversion (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -5160,8 +5155,7 @@ vectorizable_conversion (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
else else
{ {
vec_oprnds0.truncate (0); vec_oprnds0.truncate (0);
vect_get_loop_based_defs (&last_oprnd, stmt_info, dt[0], vect_get_loop_based_defs (&last_oprnd, stmt_info, &vec_oprnds0,
&vec_oprnds0,
vect_pow2 (multi_step_cvt) - 1); vect_pow2 (multi_step_cvt) - 1);
} }
...@@ -5338,7 +5332,7 @@ vectorizable_assignment (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -5338,7 +5332,7 @@ vectorizable_assignment (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
if (j == 0) if (j == 0)
vect_get_vec_defs (op, NULL, stmt_info, &vec_oprnds, NULL, slp_node); vect_get_vec_defs (op, NULL, stmt_info, &vec_oprnds, NULL, slp_node);
else else
vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds, NULL); vect_get_vec_defs_for_stmt_copy (vinfo, &vec_oprnds, NULL);
/* Arguments are ready. create the new vector stmt. */ /* Arguments are ready. create the new vector stmt. */
stmt_vec_info new_stmt_info = NULL; stmt_vec_info new_stmt_info = NULL;
...@@ -5742,7 +5736,7 @@ vectorizable_shift (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -5742,7 +5736,7 @@ vectorizable_shift (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
slp_node); slp_node);
} }
else else
vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds0, &vec_oprnds1); vect_get_vec_defs_for_stmt_copy (vinfo, &vec_oprnds0, &vec_oprnds1);
/* Arguments are ready. Create the new vector stmt. */ /* Arguments are ready. Create the new vector stmt. */
stmt_vec_info new_stmt_info = NULL; stmt_vec_info new_stmt_info = NULL;
...@@ -6120,11 +6114,11 @@ vectorizable_operation (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -6120,11 +6114,11 @@ vectorizable_operation (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
} }
else else
{ {
vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds0, &vec_oprnds1); vect_get_vec_defs_for_stmt_copy (vinfo, &vec_oprnds0, &vec_oprnds1);
if (op_type == ternary_op) if (op_type == ternary_op)
{ {
tree vec_oprnd = vec_oprnds2.pop (); tree vec_oprnd = vec_oprnds2.pop ();
vec_oprnds2.quick_push (vect_get_vec_def_for_stmt_copy (dt[2], vec_oprnds2.quick_push (vect_get_vec_def_for_stmt_copy (vinfo,
vec_oprnd)); vec_oprnd));
} }
} }
...@@ -6533,7 +6527,7 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -6533,7 +6527,7 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
if (modifier == WIDEN) if (modifier == WIDEN)
{ {
src = vec_oprnd1 src = vec_oprnd1
= vect_get_vec_def_for_stmt_copy (rhs_dt, vec_oprnd1); = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd1);
op = permute_vec_elements (vec_oprnd0, vec_oprnd0, perm_mask, op = permute_vec_elements (vec_oprnd0, vec_oprnd0, perm_mask,
stmt_info, gsi); stmt_info, gsi);
} }
...@@ -6542,8 +6536,7 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -6542,8 +6536,7 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
src = permute_vec_elements (vec_oprnd1, vec_oprnd1, perm_mask, src = permute_vec_elements (vec_oprnd1, vec_oprnd1, perm_mask,
stmt_info, gsi); stmt_info, gsi);
op = vec_oprnd0 op = vec_oprnd0
= vect_get_vec_def_for_stmt_copy (gs_info.offset_dt, = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd0);
vec_oprnd0);
} }
else else
gcc_unreachable (); gcc_unreachable ();
...@@ -6551,10 +6544,9 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -6551,10 +6544,9 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
else else
{ {
src = vec_oprnd1 src = vec_oprnd1
= vect_get_vec_def_for_stmt_copy (rhs_dt, vec_oprnd1); = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd1);
op = vec_oprnd0 op = vec_oprnd0
= vect_get_vec_def_for_stmt_copy (gs_info.offset_dt, = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd0);
vec_oprnd0);
} }
if (!useless_type_conversion_p (srctype, TREE_TYPE (src))) if (!useless_type_conversion_p (srctype, TREE_TYPE (src)))
...@@ -6811,11 +6803,8 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -6811,11 +6803,8 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
if (slp) if (slp)
vec_oprnd = vec_oprnds[j]; vec_oprnd = vec_oprnds[j];
else else
{ vec_oprnd = vect_get_vec_def_for_stmt_copy (vinfo,
vect_is_simple_use (op, vinfo, &rhs_dt); vec_oprnd);
vec_oprnd = vect_get_vec_def_for_stmt_copy (rhs_dt,
vec_oprnd);
}
} }
/* Pun the vector to extract from if necessary. */ /* Pun the vector to extract from if necessary. */
if (lvectype != vectype) if (lvectype != vectype)
...@@ -7060,19 +7049,17 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -7060,19 +7049,17 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
for (i = 0; i < group_size; i++) for (i = 0; i < group_size; i++)
{ {
op = oprnds[i]; op = oprnds[i];
vect_is_simple_use (op, vinfo, &rhs_dt); vec_oprnd = vect_get_vec_def_for_stmt_copy (vinfo, op);
vec_oprnd = vect_get_vec_def_for_stmt_copy (rhs_dt, op);
dr_chain[i] = vec_oprnd; dr_chain[i] = vec_oprnd;
oprnds[i] = vec_oprnd; oprnds[i] = vec_oprnd;
} }
if (mask) if (mask)
vec_mask = vect_get_vec_def_for_stmt_copy (mask_dt, vec_mask); vec_mask = vect_get_vec_def_for_stmt_copy (vinfo, vec_mask);
if (dataref_offset) if (dataref_offset)
dataref_offset dataref_offset
= int_const_binop (PLUS_EXPR, dataref_offset, bump); = int_const_binop (PLUS_EXPR, dataref_offset, bump);
else if (STMT_VINFO_GATHER_SCATTER_P (stmt_info)) else if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
vec_offset = vect_get_vec_def_for_stmt_copy (gs_info.offset_dt, vec_offset = vect_get_vec_def_for_stmt_copy (vinfo, vec_offset);
vec_offset);
else else
dataref_ptr = bump_vector_ptr (dataref_ptr, ptr_incr, gsi, dataref_ptr = bump_vector_ptr (dataref_ptr, ptr_incr, gsi,
stmt_info, bump); stmt_info, bump);
...@@ -7680,8 +7667,7 @@ vectorizable_load (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -7680,8 +7667,7 @@ vectorizable_load (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
if (memory_access_type == VMAT_GATHER_SCATTER && gs_info.decl) if (memory_access_type == VMAT_GATHER_SCATTER && gs_info.decl)
{ {
vect_build_gather_load_calls (stmt_info, gsi, vec_stmt, &gs_info, mask, vect_build_gather_load_calls (stmt_info, gsi, vec_stmt, &gs_info, mask);
mask_dt);
return true; return true;
} }
...@@ -8233,13 +8219,12 @@ vectorizable_load (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -8233,13 +8219,12 @@ vectorizable_load (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
dataref_offset = int_const_binop (PLUS_EXPR, dataref_offset, dataref_offset = int_const_binop (PLUS_EXPR, dataref_offset,
bump); bump);
else if (STMT_VINFO_GATHER_SCATTER_P (stmt_info)) else if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
vec_offset = vect_get_vec_def_for_stmt_copy (gs_info.offset_dt, vec_offset = vect_get_vec_def_for_stmt_copy (vinfo, vec_offset);
vec_offset);
else else
dataref_ptr = bump_vector_ptr (dataref_ptr, ptr_incr, gsi, dataref_ptr = bump_vector_ptr (dataref_ptr, ptr_incr, gsi,
stmt_info, bump); stmt_info, bump);
if (mask) if (mask)
vec_mask = vect_get_vec_def_for_stmt_copy (mask_dt, vec_mask); vec_mask = vect_get_vec_def_for_stmt_copy (vinfo, vec_mask);
} }
if (grouped_load || slp_perm) if (grouped_load || slp_perm)
...@@ -8733,6 +8718,7 @@ vectorizable_condition (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -8733,6 +8718,7 @@ vectorizable_condition (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
int reduc_index, slp_tree slp_node, int reduc_index, slp_tree slp_node,
stmt_vector_for_cost *cost_vec) stmt_vector_for_cost *cost_vec)
{ {
vec_info *vinfo = stmt_info->vinfo;
tree scalar_dest = NULL_TREE; tree scalar_dest = NULL_TREE;
tree vec_dest = NULL_TREE; tree vec_dest = NULL_TREE;
tree cond_expr, cond_expr0 = NULL_TREE, cond_expr1 = NULL_TREE; tree cond_expr, cond_expr0 = NULL_TREE, cond_expr1 = NULL_TREE;
...@@ -8994,16 +8980,14 @@ vectorizable_condition (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -8994,16 +8980,14 @@ vectorizable_condition (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
else else
{ {
vec_cond_lhs vec_cond_lhs
= vect_get_vec_def_for_stmt_copy (dts[0], = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnds0.pop ());
vec_oprnds0.pop ());
if (!masked) if (!masked)
vec_cond_rhs vec_cond_rhs
= vect_get_vec_def_for_stmt_copy (dts[1], = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnds1.pop ());
vec_oprnds1.pop ());
vec_then_clause = vect_get_vec_def_for_stmt_copy (dts[2], vec_then_clause = vect_get_vec_def_for_stmt_copy (vinfo,
vec_oprnds2.pop ()); vec_oprnds2.pop ());
vec_else_clause = vect_get_vec_def_for_stmt_copy (dts[3], vec_else_clause = vect_get_vec_def_for_stmt_copy (vinfo,
vec_oprnds3.pop ()); vec_oprnds3.pop ());
} }
...@@ -9135,6 +9119,7 @@ vectorizable_comparison (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -9135,6 +9119,7 @@ vectorizable_comparison (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
stmt_vec_info *vec_stmt, tree reduc_def, stmt_vec_info *vec_stmt, tree reduc_def,
slp_tree slp_node, stmt_vector_for_cost *cost_vec) slp_tree slp_node, stmt_vector_for_cost *cost_vec)
{ {
vec_info *vinfo = stmt_info->vinfo;
tree lhs, rhs1, rhs2; tree lhs, rhs1, rhs2;
tree vectype1 = NULL_TREE, vectype2 = NULL_TREE; tree vectype1 = NULL_TREE, vectype2 = NULL_TREE;
tree vectype = STMT_VINFO_VECTYPE (stmt_info); tree vectype = STMT_VINFO_VECTYPE (stmt_info);
...@@ -9331,9 +9316,9 @@ vectorizable_comparison (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -9331,9 +9316,9 @@ vectorizable_comparison (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
} }
else else
{ {
vec_rhs1 = vect_get_vec_def_for_stmt_copy (dts[0], vec_rhs1 = vect_get_vec_def_for_stmt_copy (vinfo,
vec_oprnds0.pop ()); vec_oprnds0.pop ());
vec_rhs2 = vect_get_vec_def_for_stmt_copy (dts[1], vec_rhs2 = vect_get_vec_def_for_stmt_copy (vinfo,
vec_oprnds1.pop ()); vec_oprnds1.pop ());
} }
......
...@@ -1514,11 +1514,11 @@ extern tree vect_get_vec_def_for_operand_1 (stmt_vec_info, enum vect_def_type); ...@@ -1514,11 +1514,11 @@ extern tree vect_get_vec_def_for_operand_1 (stmt_vec_info, enum vect_def_type);
extern tree vect_get_vec_def_for_operand (tree, stmt_vec_info, tree = NULL); extern tree vect_get_vec_def_for_operand (tree, stmt_vec_info, tree = NULL);
extern void vect_get_vec_defs (tree, tree, stmt_vec_info, vec<tree> *, extern void vect_get_vec_defs (tree, tree, stmt_vec_info, vec<tree> *,
vec<tree> *, slp_tree); vec<tree> *, slp_tree);
extern void vect_get_vec_defs_for_stmt_copy (enum vect_def_type *, extern void vect_get_vec_defs_for_stmt_copy (vec_info *,
vec<tree> *, vec<tree> *); vec<tree> *, vec<tree> *);
extern tree vect_init_vector (stmt_vec_info, tree, tree, extern tree vect_init_vector (stmt_vec_info, tree, tree,
gimple_stmt_iterator *); gimple_stmt_iterator *);
extern tree vect_get_vec_def_for_stmt_copy (enum vect_def_type, tree); extern tree vect_get_vec_def_for_stmt_copy (vec_info *, tree);
extern bool vect_transform_stmt (stmt_vec_info, gimple_stmt_iterator *, extern bool vect_transform_stmt (stmt_vec_info, gimple_stmt_iterator *,
bool *, slp_tree, slp_instance); bool *, slp_tree, slp_instance);
extern void vect_remove_stores (stmt_vec_info); extern void vect_remove_stores (stmt_vec_info);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment