diff options
author | Bill Schmidt <wschmidt@linux.ibm.com> | 2012-06-14 12:21:36 +0000 |
---|---|---|
committer | William Schmidt <wschmidt@gcc.gnu.org> | 2012-06-14 12:21:36 +0000 |
commit | b6cef4e04d49e6d7ae7b6b6db19dc9162b7c2a53 (patch) | |
tree | a0aed9af70716fc07eefe673995535d93b3c99a5 | |
parent | df3781485406ededf60d901bbcbbcbeeaf0529b9 (diff) | |
download | gcc-b6cef4e04d49e6d7ae7b6b6db19dc9162b7c2a53.zip gcc-b6cef4e04d49e6d7ae7b6b6db19dc9162b7c2a53.tar.gz gcc-b6cef4e04d49e6d7ae7b6b6db19dc9162b7c2a53.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 22 | ||||
-rw-r--r-- | gcc/Makefile.in | 2 | ||||
-rw-r--r-- | gcc/tree-vect-data-refs.c | 2 | ||||
-rw-r--r-- | gcc/tree-vect-loop.c | 57 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.c | 42 | ||||
-rw-r--r-- | gcc/tree-vectorizer.h | 16 |
6 files changed, 60 insertions, 81 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c7f2d67..be5790c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +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. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 9107a32..a404a5f 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -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) \ $(STREAMER_HOOKS_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 GSTAB_H = gstab.h stab.def BITMAP_H = bitmap.h $(HASHTAB_H) statistics.h diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 077d7f24..ed967f2 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -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, - vect_get_single_scalar_iteraion_cost (loop_vinfo)); + vect_get_single_scalar_iteration_cost (loop_vinfo)); if (inside_cost < min->inside_cost || (inside_cost == min->inside_cost && outside_cost < min->outside_cost)) diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 93a785a..55046e4 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -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. 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, /* 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); @@ -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 (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; } @@ -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 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 { @@ -2547,7 +2534,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo) 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. @@ -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 loop. @@ -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, 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; @@ -2722,16 +2709,16 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo) /* 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); } } @@ -2842,7 +2829,7 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code, /* 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); @@ -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); /* 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. @@ -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 (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); @@ -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 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)); } } @@ -2944,10 +2931,10 @@ vect_model_induction_cost (stmt_vec_info stmt_info, int ncopies) { /* 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, " diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 46edf10..9fa57e1 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -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. Models cost for simple operations, i.e. those that only emit ncopies of a diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index e8ca7cb..4c5ea36 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #define GCC_TREE_VECTORIZER_H #include "tree-data-ref.h" +#include "target.h" typedef source_location LOC; #define UNKNOWN_LOC UNKNOWN_LOCATION @@ -769,6 +770,18 @@ vect_pow2 (int x) 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. */ /*-----------------------------------------------------------------*/ @@ -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, 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 *); @@ -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 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); |