+2012-06-14 Bill Schmidt <wschmidt@linux.ibm.com>
+
+ * tree-vectorizer.h (vect_get_stmt_cost): Move from tree-vect-stmts.c.
+ (cost_for_stmt): Remove decl.
+ (vect_get_single_scalar_iteration_cost): Correct typo in name.
+ * tree-vect-loop.c (vect_get_cost): Remove.
+ (vect_get_single_scalar_iteration_cost): Correct typo in name; use
+ vect_get_stmt_cost rather than vect_get_cost.
+ (vect_get_known_peeling_cost): Use vect_get_stmt_cost rather than
+ vect_get_cost.
+ (vect_estimate_min_profitable_iters): Correct typo in call to
+ vect_get_single_scalar_iteration_cost; use vect_get_stmt_cost rather
+ than vect_get_cost.
+ (vect_model_reduction_cost): Use vect_get_stmt_cost rather than
+ vect_get_cost.
+ (vect_model_induction_cost): Likewise.
+ * tree-vect-data-refs.c (vect_peeling_hash_get_lowest_cost): Correct
+ typo in call to vect_get_single_scalar_iteration_cost.
+ * tree-vect-stmts.c (vect_get_stmt_cost): Move to tree-vectorizer.h.
+ (cost_for_stmt): Remove unnecessary function.
+ * Makefile.in (TREE_VECTORIZER_H): Update dependencies.
+
2012-06-14 Richard Earnshaw <rearnsha@arm.com>
* arm.opt (mfp=2, mfp=3, mfpe, mfpe=2, mfpe=3): Delete options.
}
-/* Get cost by calling cost target builtin. */
-
-static inline int
-vect_get_cost (enum vect_cost_for_stmt type_of_cost)
-{
- tree dummy_type = NULL;
- int dummy = 0;
-
- return targetm.vectorize.builtin_vectorization_cost (type_of_cost,
- dummy_type, dummy);
-}
-
-
/* Function vect_analyze_loop_operations.
Scan the loop stmts and make sure they are all vectorizable. */
/* Calculate the cost of one scalar iteration of the loop. */
int
-vect_get_single_scalar_iteraion_cost (loop_vec_info loop_vinfo)
+vect_get_single_scalar_iteration_cost (loop_vec_info loop_vinfo)
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
if (STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt)))
{
if (DR_IS_READ (STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt))))
- stmt_cost = vect_get_cost (scalar_load);
+ stmt_cost = vect_get_stmt_cost (scalar_load);
else
- stmt_cost = vect_get_cost (scalar_store);
+ stmt_cost = vect_get_stmt_cost (scalar_store);
}
else
- stmt_cost = vect_get_cost (scalar_stmt);
+ stmt_cost = vect_get_stmt_cost (scalar_stmt);
scalar_single_iter_cost += stmt_cost * factor;
}
/* If peeled iterations are known but number of scalar loop
iterations are unknown, count a taken branch per peeled loop. */
- peel_guard_costs = 2 * vect_get_cost (cond_branch_taken);
+ peel_guard_costs = 2 * vect_get_stmt_cost (cond_branch_taken);
}
else
{
if (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo)
|| LOOP_REQUIRES_VERSIONING_FOR_ALIAS (loop_vinfo))
- vec_outside_cost += vect_get_cost (cond_branch_taken);
+ vec_outside_cost += vect_get_stmt_cost (cond_branch_taken);
/* Count statements in scalar loop. Using this as scalar cost for a single
iteration for now.
}
}
- scalar_single_iter_cost = vect_get_single_scalar_iteraion_cost (loop_vinfo);
+ scalar_single_iter_cost = vect_get_single_scalar_iteration_cost (loop_vinfo);
/* Add additional cost for the peeled instructions in prologue and epilogue
loop.
branch per peeled loop. Even if scalar loop iterations are known,
vector iterations are not known since peeled prologue iterations are
not known. Hence guards remain the same. */
- peel_guard_costs += 2 * (vect_get_cost (cond_branch_taken)
- + vect_get_cost (cond_branch_not_taken));
+ peel_guard_costs += 2 * (vect_get_stmt_cost (cond_branch_taken)
+ + vect_get_stmt_cost (cond_branch_not_taken));
vec_outside_cost += (peel_iters_prologue * scalar_single_iter_cost)
+ (peel_iters_epilogue * scalar_single_iter_cost)
+ peel_guard_costs;
/* Cost model check occurs at versioning. */
if (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo)
|| LOOP_REQUIRES_VERSIONING_FOR_ALIAS (loop_vinfo))
- scalar_outside_cost += vect_get_cost (cond_branch_not_taken);
+ scalar_outside_cost += vect_get_stmt_cost (cond_branch_not_taken);
else
{
/* Cost model check occurs at prologue generation. */
if (LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo) < 0)
- scalar_outside_cost += 2 * vect_get_cost (cond_branch_taken)
- + vect_get_cost (cond_branch_not_taken);
+ scalar_outside_cost += 2 * vect_get_stmt_cost (cond_branch_taken)
+ + vect_get_stmt_cost (cond_branch_not_taken);
/* Cost model check occurs at epilogue generation. */
else
- scalar_outside_cost += 2 * vect_get_cost (cond_branch_taken);
+ scalar_outside_cost += 2 * vect_get_stmt_cost (cond_branch_taken);
}
}
/* Cost of reduction op inside loop. */
STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info)
- += ncopies * vect_get_cost (vector_stmt);
+ += ncopies * vect_get_stmt_cost (vector_stmt);
stmt = STMT_VINFO_STMT (stmt_info);
code = gimple_assign_rhs_code (orig_stmt);
/* Add in cost for initial definition. */
- outer_cost += vect_get_cost (scalar_to_vec);
+ outer_cost += vect_get_stmt_cost (scalar_to_vec);
/* Determine cost of epilogue code.
if (!nested_in_vect_loop_p (loop, orig_stmt))
{
if (reduc_code != ERROR_MARK)
- outer_cost += vect_get_cost (vector_stmt)
- + vect_get_cost (vec_to_scalar);
+ outer_cost += vect_get_stmt_cost (vector_stmt)
+ + vect_get_stmt_cost (vec_to_scalar);
else
{
int vec_size_in_bits = tree_low_cst (TYPE_SIZE (vectype), 1);
/* Final reduction via vector shifts and the reduction operator. Also
requires scalar extract. */
outer_cost += ((exact_log2(nelements) * 2)
- * vect_get_cost (vector_stmt)
- + vect_get_cost (vec_to_scalar));
+ * vect_get_stmt_cost (vector_stmt)
+ + vect_get_stmt_cost (vec_to_scalar));
else
/* Use extracts and reduction op for final reduction. For N elements,
we have N extracts and N-1 reduction ops. */
outer_cost += ((nelements + nelements - 1)
- * vect_get_cost (vector_stmt));
+ * vect_get_stmt_cost (vector_stmt));
}
}
{
/* loop cost for vec_loop. */
STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info)
- = ncopies * vect_get_cost (vector_stmt);
+ = ncopies * vect_get_stmt_cost (vector_stmt);
/* prologue cost for vec_init and vec_step. */
STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info)
- = 2 * vect_get_cost (scalar_to_vec);
+ = 2 * vect_get_stmt_cost (scalar_to_vec);
if (vect_print_dump_info (REPORT_COST))
fprintf (vect_dump, "vect_model_induction_cost: inside_cost = %d, "
}
-/* Get cost by calling cost target builtin. */
-
-static inline
-int vect_get_stmt_cost (enum vect_cost_for_stmt type_of_cost)
-{
- tree dummy_type = NULL;
- int dummy = 0;
-
- return targetm.vectorize.builtin_vectorization_cost (type_of_cost,
- dummy_type, dummy);
-}
-
-
-/* Get cost for STMT. */
-
-int
-cost_for_stmt (gimple stmt)
-{
- stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
-
- switch (STMT_VINFO_TYPE (stmt_info))
- {
- case load_vec_info_type:
- return vect_get_stmt_cost (scalar_load);
- case store_vec_info_type:
- return vect_get_stmt_cost (scalar_store);
- case op_vec_info_type:
- case condition_vec_info_type:
- case assignment_vec_info_type:
- case reduc_vec_info_type:
- case induc_vec_info_type:
- case type_promotion_vec_info_type:
- case type_demotion_vec_info_type:
- case type_conversion_vec_info_type:
- case call_vec_info_type:
- return vect_get_stmt_cost (scalar_stmt);
- case undef_vec_info_type:
- default:
- gcc_unreachable ();
- }
-}
-
/* Function vect_model_simple_cost.
Models cost for simple operations, i.e. those that only emit ncopies of a
#define GCC_TREE_VECTORIZER_H
#include "tree-data-ref.h"
+#include "target.h"
typedef source_location LOC;
#define UNKNOWN_LOC UNKNOWN_LOCATION
return res;
}
+/* Get cost by calling cost target builtin. */
+
+static inline
+int vect_get_stmt_cost (enum vect_cost_for_stmt type_of_cost)
+{
+ tree dummy_type = NULL;
+ int dummy = 0;
+
+ return targetm.vectorize.builtin_vectorization_cost (type_of_cost,
+ dummy_type, dummy);
+}
+
/*-----------------------------------------------------------------*/
/* Info on data references alignment. */
/*-----------------------------------------------------------------*/
extern void vect_finish_stmt_generation (gimple, gimple,
gimple_stmt_iterator *);
extern bool vect_mark_stmts_to_be_vectorized (loop_vec_info);
-extern int cost_for_stmt (gimple);
extern tree vect_get_vec_def_for_operand (tree, gimple, tree *);
extern tree vect_init_vector (gimple, tree, tree,
gimple_stmt_iterator *);
extern tree get_initial_def_for_reduction (gimple, tree, tree *);
extern int vect_min_worthwhile_factor (enum tree_code);
extern int vect_get_known_peeling_cost (loop_vec_info, int, int *, int);
-extern int vect_get_single_scalar_iteraion_cost (loop_vec_info);
+extern int vect_get_single_scalar_iteration_cost (loop_vec_info);
/* In tree-vect-slp.c. */
extern void vect_free_slp_instance (slp_instance);