Commit b6cef4e0 by Bill Schmidt Committed by William Schmidt

tree-vectorizer.h (vect_get_stmt_cost): Move from tree-vect-stmts.c.

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.

From-SVN: r188611
parent df378148
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> 2012-06-14 Richard Earnshaw <rearnsha@arm.com>
* arm.opt (mfp=2, mfp=3, mfpe, mfpe=2, mfpe=3): Delete options. * arm.opt (mfp=2, mfp=3, mfpe, mfpe=2, mfpe=3): Delete options.
......
...@@ -965,7 +965,7 @@ GIMPLE_STREAMER_H = gimple-streamer.h $(LTO_STREAMER_H) $(BASIC_BLOCK_H) \ ...@@ -965,7 +965,7 @@ GIMPLE_STREAMER_H = gimple-streamer.h $(LTO_STREAMER_H) $(BASIC_BLOCK_H) \
TREE_STREAMER_H = tree-streamer.h $(TREE_H) $(LTO_STREAMER_H) \ TREE_STREAMER_H = tree-streamer.h $(TREE_H) $(LTO_STREAMER_H) \
$(STREAMER_HOOKS_H) $(STREAMER_HOOKS_H)
STREAMER_HOOKS_H = streamer-hooks.h $(TREE_H) STREAMER_HOOKS_H = streamer-hooks.h $(TREE_H)
TREE_VECTORIZER_H = tree-vectorizer.h $(TREE_DATA_REF_H) TREE_VECTORIZER_H = tree-vectorizer.h $(TREE_DATA_REF_H) $(TARGET_H)
IPA_PROP_H = ipa-prop.h $(TREE_H) $(VEC_H) $(CGRAPH_H) $(GIMPLE_H) alloc-pool.h IPA_PROP_H = ipa-prop.h $(TREE_H) $(VEC_H) $(CGRAPH_H) $(GIMPLE_H) alloc-pool.h
GSTAB_H = gstab.h stab.def GSTAB_H = gstab.h stab.def
BITMAP_H = bitmap.h $(HASHTAB_H) statistics.h BITMAP_H = bitmap.h $(HASHTAB_H) statistics.h
......
...@@ -1320,7 +1320,7 @@ vect_peeling_hash_get_lowest_cost (void **slot, void *data) ...@@ -1320,7 +1320,7 @@ vect_peeling_hash_get_lowest_cost (void **slot, void *data)
} }
outside_cost += vect_get_known_peeling_cost (loop_vinfo, elem->npeel, &dummy, outside_cost += vect_get_known_peeling_cost (loop_vinfo, elem->npeel, &dummy,
vect_get_single_scalar_iteraion_cost (loop_vinfo)); vect_get_single_scalar_iteration_cost (loop_vinfo));
if (inside_cost < min->inside_cost if (inside_cost < min->inside_cost
|| (inside_cost == min->inside_cost && outside_cost < min->outside_cost)) || (inside_cost == min->inside_cost && outside_cost < min->outside_cost))
......
...@@ -1201,19 +1201,6 @@ vect_analyze_loop_form (struct loop *loop) ...@@ -1201,19 +1201,6 @@ vect_analyze_loop_form (struct loop *loop)
} }
/* 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. /* Function vect_analyze_loop_operations.
Scan the loop stmts and make sure they are all vectorizable. */ Scan the loop stmts and make sure they are all vectorizable. */
...@@ -2385,7 +2372,7 @@ vect_force_simple_reduction (loop_vec_info loop_info, gimple phi, ...@@ -2385,7 +2372,7 @@ vect_force_simple_reduction (loop_vec_info loop_info, gimple phi,
/* Calculate the cost of one scalar iteration of the loop. */ /* Calculate the cost of one scalar iteration of the loop. */
int 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); struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo); basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
...@@ -2434,12 +2421,12 @@ vect_get_single_scalar_iteraion_cost (loop_vec_info loop_vinfo) ...@@ -2434,12 +2421,12 @@ vect_get_single_scalar_iteraion_cost (loop_vec_info loop_vinfo)
if (STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt))) if (STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt)))
{ {
if (DR_IS_READ (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 else
stmt_cost = vect_get_cost (scalar_store); stmt_cost = vect_get_stmt_cost (scalar_store);
} }
else else
stmt_cost = vect_get_cost (scalar_stmt); stmt_cost = vect_get_stmt_cost (scalar_stmt);
scalar_single_iter_cost += stmt_cost * factor; scalar_single_iter_cost += stmt_cost * factor;
} }
...@@ -2466,7 +2453,7 @@ vect_get_known_peeling_cost (loop_vec_info loop_vinfo, int peel_iters_prologue, ...@@ -2466,7 +2453,7 @@ vect_get_known_peeling_cost (loop_vec_info loop_vinfo, int peel_iters_prologue,
/* If peeled iterations are known but number of scalar loop /* If peeled iterations are known but number of scalar loop
iterations are unknown, count a taken branch per peeled 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 else
{ {
...@@ -2547,7 +2534,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo) ...@@ -2547,7 +2534,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
if (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo) if (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo)
|| LOOP_REQUIRES_VERSIONING_FOR_ALIAS (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 /* Count statements in scalar loop. Using this as scalar cost for a single
iteration for now. iteration for now.
...@@ -2618,7 +2605,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo) ...@@ -2618,7 +2605,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
} }
} }
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 /* Add additional cost for the peeled instructions in prologue and epilogue
loop. loop.
...@@ -2648,8 +2635,8 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo) ...@@ -2648,8 +2635,8 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
branch per peeled loop. Even if scalar loop iterations are known, branch per peeled loop. Even if scalar loop iterations are known,
vector iterations are not known since peeled prologue iterations are vector iterations are not known since peeled prologue iterations are
not known. Hence guards remain the same. */ not known. Hence guards remain the same. */
peel_guard_costs += 2 * (vect_get_cost (cond_branch_taken) peel_guard_costs += 2 * (vect_get_stmt_cost (cond_branch_taken)
+ vect_get_cost (cond_branch_not_taken)); + vect_get_stmt_cost (cond_branch_not_taken));
vec_outside_cost += (peel_iters_prologue * scalar_single_iter_cost) vec_outside_cost += (peel_iters_prologue * scalar_single_iter_cost)
+ (peel_iters_epilogue * scalar_single_iter_cost) + (peel_iters_epilogue * scalar_single_iter_cost)
+ peel_guard_costs; + peel_guard_costs;
...@@ -2722,16 +2709,16 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo) ...@@ -2722,16 +2709,16 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
/* Cost model check occurs at versioning. */ /* Cost model check occurs at versioning. */
if (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo) if (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo)
|| LOOP_REQUIRES_VERSIONING_FOR_ALIAS (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 else
{ {
/* Cost model check occurs at prologue generation. */ /* Cost model check occurs at prologue generation. */
if (LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo) < 0) if (LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo) < 0)
scalar_outside_cost += 2 * vect_get_cost (cond_branch_taken) scalar_outside_cost += 2 * vect_get_stmt_cost (cond_branch_taken)
+ vect_get_cost (cond_branch_not_taken); + vect_get_stmt_cost (cond_branch_not_taken);
/* Cost model check occurs at epilogue generation. */ /* Cost model check occurs at epilogue generation. */
else else
scalar_outside_cost += 2 * vect_get_cost (cond_branch_taken); scalar_outside_cost += 2 * vect_get_stmt_cost (cond_branch_taken);
} }
} }
...@@ -2842,7 +2829,7 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code, ...@@ -2842,7 +2829,7 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
/* Cost of reduction op inside loop. */ /* Cost of reduction op inside loop. */
STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info) 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); stmt = STMT_VINFO_STMT (stmt_info);
...@@ -2885,7 +2872,7 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code, ...@@ -2885,7 +2872,7 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
code = gimple_assign_rhs_code (orig_stmt); code = gimple_assign_rhs_code (orig_stmt);
/* Add in cost for initial definition. */ /* 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. /* Determine cost of epilogue code.
...@@ -2895,8 +2882,8 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code, ...@@ -2895,8 +2882,8 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
if (!nested_in_vect_loop_p (loop, orig_stmt)) if (!nested_in_vect_loop_p (loop, orig_stmt))
{ {
if (reduc_code != ERROR_MARK) if (reduc_code != ERROR_MARK)
outer_cost += vect_get_cost (vector_stmt) outer_cost += vect_get_stmt_cost (vector_stmt)
+ vect_get_cost (vec_to_scalar); + vect_get_stmt_cost (vec_to_scalar);
else else
{ {
int vec_size_in_bits = tree_low_cst (TYPE_SIZE (vectype), 1); int vec_size_in_bits = tree_low_cst (TYPE_SIZE (vectype), 1);
...@@ -2914,13 +2901,13 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code, ...@@ -2914,13 +2901,13 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
/* Final reduction via vector shifts and the reduction operator. Also /* Final reduction via vector shifts and the reduction operator. Also
requires scalar extract. */ requires scalar extract. */
outer_cost += ((exact_log2(nelements) * 2) outer_cost += ((exact_log2(nelements) * 2)
* vect_get_cost (vector_stmt) * vect_get_stmt_cost (vector_stmt)
+ vect_get_cost (vec_to_scalar)); + vect_get_stmt_cost (vec_to_scalar));
else else
/* Use extracts and reduction op for final reduction. For N elements, /* Use extracts and reduction op for final reduction. For N elements,
we have N extracts and N-1 reduction ops. */ we have N extracts and N-1 reduction ops. */
outer_cost += ((nelements + nelements - 1) outer_cost += ((nelements + nelements - 1)
* vect_get_cost (vector_stmt)); * vect_get_stmt_cost (vector_stmt));
} }
} }
...@@ -2944,10 +2931,10 @@ vect_model_induction_cost (stmt_vec_info stmt_info, int ncopies) ...@@ -2944,10 +2931,10 @@ vect_model_induction_cost (stmt_vec_info stmt_info, int ncopies)
{ {
/* loop cost for vec_loop. */ /* loop cost for vec_loop. */
STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info) 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. */ /* prologue cost for vec_init and vec_step. */
STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info) 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)) if (vect_print_dump_info (REPORT_COST))
fprintf (vect_dump, "vect_model_induction_cost: inside_cost = %d, " fprintf (vect_dump, "vect_model_induction_cost: inside_cost = %d, "
......
...@@ -727,48 +727,6 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo) ...@@ -727,48 +727,6 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
} }
/* 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. /* Function vect_model_simple_cost.
Models cost for simple operations, i.e. those that only emit ncopies of a Models cost for simple operations, i.e. those that only emit ncopies of a
......
...@@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see
#define GCC_TREE_VECTORIZER_H #define GCC_TREE_VECTORIZER_H
#include "tree-data-ref.h" #include "tree-data-ref.h"
#include "target.h"
typedef source_location LOC; typedef source_location LOC;
#define UNKNOWN_LOC UNKNOWN_LOCATION #define UNKNOWN_LOC UNKNOWN_LOCATION
...@@ -769,6 +770,18 @@ vect_pow2 (int x) ...@@ -769,6 +770,18 @@ vect_pow2 (int x)
return res; 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. */ /* Info on data references alignment. */
/*-----------------------------------------------------------------*/ /*-----------------------------------------------------------------*/
...@@ -843,7 +856,6 @@ extern void vect_model_load_cost (stmt_vec_info, int, bool, slp_tree); ...@@ -843,7 +856,6 @@ extern void vect_model_load_cost (stmt_vec_info, int, bool, slp_tree);
extern void vect_finish_stmt_generation (gimple, gimple, extern void vect_finish_stmt_generation (gimple, gimple,
gimple_stmt_iterator *); gimple_stmt_iterator *);
extern bool vect_mark_stmts_to_be_vectorized (loop_vec_info); 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_get_vec_def_for_operand (tree, gimple, tree *);
extern tree vect_init_vector (gimple, tree, tree, extern tree vect_init_vector (gimple, tree, tree,
gimple_stmt_iterator *); gimple_stmt_iterator *);
...@@ -919,7 +931,7 @@ extern int vect_estimate_min_profitable_iters (loop_vec_info); ...@@ -919,7 +931,7 @@ extern int vect_estimate_min_profitable_iters (loop_vec_info);
extern tree get_initial_def_for_reduction (gimple, tree, tree *); extern tree get_initial_def_for_reduction (gimple, tree, tree *);
extern int vect_min_worthwhile_factor (enum tree_code); 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_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. */ /* In tree-vect-slp.c. */
extern void vect_free_slp_instance (slp_instance); extern void vect_free_slp_instance (slp_instance);
......
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