aarch64_vector_costs (vec_info *, bool);
unsigned int add_stmt_cost (int count, vect_cost_for_stmt kind,
- stmt_vec_info stmt_info, tree vectype,
+ stmt_vec_info stmt_info, slp_tree, tree vectype,
int misalign,
vect_cost_model_location where) override;
void finish_cost (const vector_costs *) override;
unsigned
aarch64_vector_costs::add_stmt_cost (int count, vect_cost_for_stmt kind,
- stmt_vec_info stmt_info, tree vectype,
- int misalign,
+ stmt_vec_info stmt_info, slp_tree,
+ tree vectype, int misalign,
vect_cost_model_location where)
{
fractional_cost stmt_cost
using vector_costs::vector_costs;
unsigned int add_stmt_cost (int count, vect_cost_for_stmt kind,
- stmt_vec_info stmt_info, tree vectype,
- int misalign,
+ stmt_vec_info stmt_info, slp_tree node,
+ tree vectype, int misalign,
vect_cost_model_location where) override;
};
unsigned
ix86_vector_costs::add_stmt_cost (int count, vect_cost_for_stmt kind,
- stmt_vec_info stmt_info, tree vectype,
- int misalign, vect_cost_model_location where)
+ stmt_vec_info stmt_info, slp_tree,
+ tree vectype, int misalign,
+ vect_cost_model_location where)
{
unsigned retval = 0;
bool scalar_p
using vector_costs::vector_costs;
unsigned int add_stmt_cost (int count, vect_cost_for_stmt kind,
- stmt_vec_info stmt_info, tree vectype,
+ stmt_vec_info stmt_info, slp_tree, tree vectype,
int misalign,
vect_cost_model_location where) override;
void finish_cost (const vector_costs *) override;
unsigned
rs6000_cost_data::add_stmt_cost (int count, vect_cost_for_stmt kind,
- stmt_vec_info stmt_info, tree vectype,
- int misalign, vect_cost_model_location where)
+ stmt_vec_info stmt_info, slp_tree,
+ tree vectype, int misalign,
+ vect_cost_model_location where)
{
unsigned retval = 0;
/* Each length needs one shift to fill into bits 0-7. */
shift_cnt += num_vectors_m1 + 1;
- add_stmt_cost (shift_cnt, scalar_stmt, NULL, NULL_TREE, 0, vect_body);
+ add_stmt_cost (shift_cnt, scalar_stmt, NULL, NULL,
+ NULL_TREE, 0, vect_body);
}
}
{
/* FIXME: Make cost depend on complexity of individual check. */
(void) add_stmt_cost (target_cost_data, 1, vector_stmt,
- NULL, NULL_TREE, 0, vect_prologue);
+ NULL, NULL, NULL_TREE, 0, vect_prologue);
if (dump_enabled_p ())
dump_printf (MSG_NOTE,
"cost model: Adding cost of checks for loop "
{
(void) add_stmt_cost (target_cost_data,
si->count * peel_iters_prologue, si->kind,
- si->stmt_info, si->vectype, si->misalign,
- vect_prologue);
+ si->stmt_info, si->node, si->vectype,
+ si->misalign, vect_prologue);
}
/* Add costs associated with peel_iters_epilogue. */
{
(void) add_stmt_cost (target_cost_data,
si->count * peel_iters_epilogue, si->kind,
- si->stmt_info, si->vectype, si->misalign,
- vect_epilogue);
+ si->stmt_info, si->node, si->vectype,
+ si->misalign, vect_epilogue);
}
/* Add possible cond_branch_taken/cond_branch_not_taken cost. */
being the tie-breaker between vectorizing or not, then it's
probably better not to vectorize. */
(void) add_stmt_cost (target_cost_data, num_masks,
- vector_stmt, NULL, NULL_TREE, 0, vect_prologue);
+ vector_stmt, NULL, NULL, NULL_TREE, 0,
+ vect_prologue);
(void) add_stmt_cost (target_cost_data, num_masks - 1,
- vector_stmt, NULL, NULL_TREE, 0, vect_body);
+ vector_stmt, NULL, NULL, NULL_TREE, 0,
+ vect_body);
}
else if (LOOP_VINFO_FULLY_WITH_LENGTH_P (loop_vinfo))
{
kind = scalar_to_vec;
else
kind = vec_construct;
- record_stmt_cost (cost_vec, 1, kind, NULL, vectype, 0, vect_prologue);
+ record_stmt_cost (cost_vec, 1, kind, node, vectype, 0, vect_prologue);
}
}
}
if (!gsi)
- record_stmt_cost (cost_vec, nperms, vec_perm, NULL, vectype, 0, vect_body);
+ record_stmt_cost (cost_vec, nperms, vec_perm, node, vectype, 0, vect_body);
return true;
}
target model or by saving it in a vector for later processing.
Return a preliminary estimate of the statement's cost. */
-unsigned
+static unsigned
record_stmt_cost (stmt_vector_for_cost *body_cost_vec, int count,
- enum vect_cost_for_stmt kind, stmt_vec_info stmt_info,
+ enum vect_cost_for_stmt kind,
+ stmt_vec_info stmt_info, slp_tree node,
tree vectype, int misalign,
enum vect_cost_model_location where)
{
&& (stmt_info && STMT_VINFO_GATHER_SCATTER_P (stmt_info)))
kind = vector_scatter_store;
- stmt_info_for_cost si = { count, kind, where, stmt_info, vectype, misalign };
+ stmt_info_for_cost si
+ = { count, kind, where, stmt_info, node, vectype, misalign };
body_cost_vec->safe_push (si);
return (unsigned)
(builtin_vectorization_cost (kind, vectype, misalign) * count);
}
+unsigned
+record_stmt_cost (stmt_vector_for_cost *body_cost_vec, int count,
+ enum vect_cost_for_stmt kind, stmt_vec_info stmt_info,
+ tree vectype, int misalign,
+ enum vect_cost_model_location where)
+{
+ return record_stmt_cost (body_cost_vec, count, kind, stmt_info, NULL,
+ vectype, misalign, where);
+}
+
+unsigned
+record_stmt_cost (stmt_vector_for_cost *body_cost_vec, int count,
+ enum vect_cost_for_stmt kind, slp_tree node,
+ tree vectype, int misalign,
+ enum vect_cost_model_location where)
+{
+ return record_stmt_cost (body_cost_vec, count, kind, NULL, node,
+ vectype, misalign, where);
+}
+
unsigned
record_stmt_cost (stmt_vector_for_cost *body_cost_vec, int count,
enum vect_cost_for_stmt kind,
{
gcc_assert (kind == cond_branch_taken || kind == cond_branch_not_taken
|| kind == scalar_stmt);
- return record_stmt_cost (body_cost_vec, count, kind, NULL,
+ return record_stmt_cost (body_cost_vec, count, kind, NULL, NULL,
NULL_TREE, 0, where);
}
void
dump_stmt_cost (FILE *f, int count, enum vect_cost_for_stmt kind,
- stmt_vec_info stmt_info, tree, int misalign, unsigned cost,
+ stmt_vec_info stmt_info, slp_tree node, tree,
+ int misalign, unsigned cost,
enum vect_cost_model_location where)
{
if (stmt_info)
print_gimple_expr (f, STMT_VINFO_STMT (stmt_info), 0, TDF_SLIM);
fprintf (f, " ");
}
+ else if (node)
+ fprintf (f, "node %p ", (void *)node);
else
fprintf (f, "<unknown> ");
fprintf (f, "%d times ", count);
unsigned int
vector_costs::add_stmt_cost (int count, vect_cost_for_stmt kind,
- stmt_vec_info stmt_info, tree vectype,
- int misalign, vect_cost_model_location where)
+ stmt_vec_info stmt_info, slp_tree,
+ tree vectype, int misalign,
+ vect_cost_model_location where)
{
unsigned int cost
= builtin_vectorization_cost (kind, vectype, misalign) * count;
#define GCC_TREE_VECTORIZER_H
typedef class _stmt_vec_info *stmt_vec_info;
+typedef struct _slp_tree *slp_tree;
#include "tree-data-ref.h"
#include "tree-hash-traits.h"
enum vect_cost_for_stmt kind;
enum vect_cost_model_location where;
stmt_vec_info stmt_info;
+ slp_tree node;
tree vectype;
int misalign;
};
/************************************************************************
SLP
************************************************************************/
-typedef struct _slp_tree *slp_tree;
typedef vec<std::pair<unsigned, unsigned> > lane_permutation_t;
typedef vec<unsigned> load_permutation_t;
- WHERE specifies whether the cost occurs in the loop prologue,
the loop body, or the loop epilogue.
- KIND is the kind of statement, which is always meaningful.
- - STMT_INFO, if nonnull, describes the statement that will be
+ - STMT_INFO or NODE, if nonnull, describe the statement that will be
vectorized.
- VECTYPE, if nonnull, is the vector type that the vectorized
statement will operate on. Note that this should be used in
Return the calculated cost as well as recording it. The return
value is used for dumping purposes. */
virtual unsigned int add_stmt_cost (int count, vect_cost_for_stmt kind,
- stmt_vec_info stmt_info, tree vectype,
- int misalign,
+ stmt_vec_info stmt_info,
+ slp_tree node,
+ tree vectype, int misalign,
vect_cost_model_location where);
/* Finish calculating the cost of the code. The results can be
}
extern void dump_stmt_cost (FILE *, int, enum vect_cost_for_stmt,
- stmt_vec_info, tree, int, unsigned,
+ stmt_vec_info, slp_tree, tree, int, unsigned,
enum vect_cost_model_location);
/* Alias targetm.vectorize.add_stmt_cost. */
static inline unsigned
add_stmt_cost (vector_costs *costs, int count,
enum vect_cost_for_stmt kind,
- stmt_vec_info stmt_info, tree vectype, int misalign,
+ stmt_vec_info stmt_info, slp_tree node,
+ tree vectype, int misalign,
enum vect_cost_model_location where)
{
- unsigned cost = costs->add_stmt_cost (count, kind, stmt_info, vectype,
+ unsigned cost = costs->add_stmt_cost (count, kind, stmt_info, node, vectype,
misalign, where);
if (dump_file && (dump_flags & TDF_DETAILS))
- dump_stmt_cost (dump_file, count, kind, stmt_info, vectype, misalign,
+ dump_stmt_cost (dump_file, count, kind, stmt_info, node, vectype, misalign,
cost, where);
return cost;
}
{
gcc_assert (kind == cond_branch_taken || kind == cond_branch_not_taken
|| kind == scalar_stmt);
- return add_stmt_cost (costs, count, kind, NULL, NULL_TREE, 0, where);
+ return add_stmt_cost (costs, count, kind, NULL, NULL, NULL_TREE, 0, where);
}
/* Alias targetm.vectorize.add_stmt_cost. */
static inline unsigned
add_stmt_cost (vector_costs *costs, stmt_info_for_cost *i)
{
- return add_stmt_cost (costs, i->count, i->kind, i->stmt_info,
+ return add_stmt_cost (costs, i->count, i->kind, i->stmt_info, i->node,
i->vectype, i->misalign, i->where);
}
unsigned i;
FOR_EACH_VEC_ELT (*cost_vec, i, cost)
add_stmt_cost (costs, cost->count, cost->kind, cost->stmt_info,
- cost->vectype, cost->misalign, cost->where);
+ cost->node, cost->vectype, cost->misalign, cost->where);
}
/*-----------------------------------------------------------------*/
extern unsigned record_stmt_cost (stmt_vector_for_cost *, int,
enum vect_cost_for_stmt, stmt_vec_info,
tree, int, enum vect_cost_model_location);
+extern unsigned record_stmt_cost (stmt_vector_for_cost *, int,
+ enum vect_cost_for_stmt, slp_tree,
+ tree, int, enum vect_cost_model_location);
extern unsigned record_stmt_cost (stmt_vector_for_cost *, int,
enum vect_cost_for_stmt,
enum vect_cost_model_location);