instructions. */
static unsigned int
aarch64_sve_in_loop_reduction_latency (vec_info *vinfo,
+ slp_tree node,
stmt_vec_info stmt_info,
const sve_vec_cost *sve_costs)
{
- switch (vect_reduc_type (vinfo, stmt_info))
+ switch (vect_reduc_type (vinfo, node))
{
case EXTRACT_LAST_REDUCTION:
return sve_costs->clast_cost;
- If VEC_FLAGS & VEC_ANY_SVE, return the loop carry latency of the
SVE implementation. */
static unsigned int
-aarch64_in_loop_reduction_latency (vec_info *vinfo, stmt_vec_info stmt_info,
+aarch64_in_loop_reduction_latency (vec_info *vinfo,
+ slp_tree node,
+ stmt_vec_info stmt_info,
unsigned int vec_flags)
{
const cpu_vector_cost *vec_costs = aarch64_tune_params.vec_costs;
if (sve_costs)
{
unsigned int latency
- = aarch64_sve_in_loop_reduction_latency (vinfo, stmt_info, sve_costs);
+ = aarch64_sve_in_loop_reduction_latency (vinfo, node,
+ stmt_info, sve_costs);
if (latency)
return latency;
}
&& sve_costs)
{
unsigned int latency
- = aarch64_sve_in_loop_reduction_latency (vinfo, stmt_info, sve_costs);
+ = aarch64_sve_in_loop_reduction_latency (vinfo, node,
+ stmt_info, sve_costs);
if (latency)
return latency;
}
&& vect_is_reduction (stmt_info))
{
unsigned int base
- = aarch64_in_loop_reduction_latency (m_vinfo, stmt_info, m_vec_flags);
- if (aarch64_force_single_cycle (m_vinfo, stmt_info))
+ = aarch64_in_loop_reduction_latency (m_vinfo, node,
+ stmt_info, m_vec_flags);
+ if (m_costing_for_scalar
+ || aarch64_force_single_cycle (m_vinfo, stmt_info))
/* ??? Ideally we'd use a tree to reduce the copies down to 1 vector,
and then accumulate that, but at the moment the loop-carried
dependency includes all copies. */
have only accounted for one. */
if (stmt_info
&& (kind == vector_stmt || kind == vec_to_scalar)
- && vect_reduc_type (m_vinfo, stmt_info) == COND_REDUCTION)
+ && vect_reduc_type (m_vinfo, node) == COND_REDUCTION)
ops->general_ops += count;
/* Count the predicate operations needed by an SVE comparison. */
/* If STMT_INFO describes a reduction, return the vect_reduction_type
of the reduction it describes, otherwise return -1. */
inline int
-vect_reduc_type (vec_info *vinfo, stmt_vec_info stmt_info)
+vect_reduc_type (vec_info *vinfo, slp_tree node)
{
if (loop_vec_info loop_vinfo = dyn_cast<loop_vec_info> (vinfo))
- if (STMT_VINFO_REDUC_DEF (stmt_info))
- {
- stmt_vec_info reduc_info = info_for_reduction (loop_vinfo, stmt_info);
- return int (STMT_VINFO_REDUC_TYPE (reduc_info));
- }
+ {
+ stmt_vec_info stmt_info = SLP_TREE_REPRESENTATIVE (node);
+ if (STMT_VINFO_REDUC_DEF (stmt_info))
+ {
+ stmt_vec_info reduc_info
+ = info_for_reduction (loop_vinfo, stmt_info);
+ return int (STMT_VINFO_REDUC_TYPE (reduc_info));
+ }
+ }
return -1;
}