diff options
author | Dorit Nuzman <dorit@il.ibm.com> | 2007-01-14 12:42:40 +0000 |
---|---|---|
committer | Dorit Nuzman <dorit@gcc.gnu.org> | 2007-01-14 12:42:40 +0000 |
commit | acdc40dfd2305e16f92e15273dad1cc6d8bee32c (patch) | |
tree | c1d065e5ba09e4c5a85904acf9038d65101037cd /gcc | |
parent | 37fc8424ac5a0896dc43a0d506d434b60c55452d (diff) | |
download | gcc-acdc40dfd2305e16f92e15273dad1cc6d8bee32c.zip gcc-acdc40dfd2305e16f92e15273dad1cc6d8bee32c.tar.gz gcc-acdc40dfd2305e16f92e15273dad1cc6d8bee32c.tar.bz2 |
param.h (MIN_VECT_LOOP_BOUND): New.
* param.h (MIN_VECT_LOOP_BOUND): New.
* params.def (MIN_VECT_LOOP_BOUND): New.
* tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Takes another
argument - minimum threshold for number of iterations.
* tree-vectorizer.h (slpeel_tree_peel_loop_to_edge): Add another
argument to declaration.
* tree-vect-analyze.c (vect_analyze_operations): Check value of
MIN_VECT_LOOP_BOUND.
* tree-vect-transform.c (vect_do_peeling_for_loop_bound): Call
slpeel_tree_peel_loop_to_edge with additional argument.
(vect_do_peeling_for_alignment): Likewise.
* doc/invoke.texi (min-vect-loop-bound): Document new param option.
From-SVN: r120770
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 6 | ||||
-rw-r--r-- | gcc/params.def | 6 | ||||
-rw-r--r-- | gcc/params.h | 2 | ||||
-rw-r--r-- | gcc/tree-vect-analyze.c | 5 | ||||
-rw-r--r-- | gcc/tree-vect-transform.c | 9 | ||||
-rw-r--r-- | gcc/tree-vectorizer.c | 6 | ||||
-rw-r--r-- | gcc/tree-vectorizer.h | 2 |
8 files changed, 45 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7e785b6..646e292 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2007-01-14 Dorit Nuzman <dorit@il.ibm.com> + + * param.h (MIN_VECT_LOOP_BOUND): New. + * params.def (MIN_VECT_LOOP_BOUND): New. + * tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Takes another + argument - minimum threshold for number of iterations. + * tree-vectorizer.h (slpeel_tree_peel_loop_to_edge): Add another + argument to declaration. + * tree-vect-analyze.c (vect_analyze_operations): Check value of + MIN_VECT_LOOP_BOUND. + * tree-vect-transform.c (vect_do_peeling_for_loop_bound): Call + slpeel_tree_peel_loop_to_edge with additional argument. + (vect_do_peeling_for_alignment): Likewise. + * doc/invoke.texi (min-vect-loop-bound): Document new param option. + 2007-01-14 Uros Bizjak <ubizjak@gmail.com> PR target/30413 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index f44e28d..b896aa5 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -6130,6 +6130,12 @@ inlining for code having large abstraction penalty (many functions that just pass the arguments to other functions) and decrease inlining for code with low abstraction penalty. The default value is 16. +@item min-vect-loop-bound +The minimum number of iterations under which a loop will not get vectorized +when @option{-ftree-vectorize} is used. The number of iterations after +vectorization needs to be greater than the value specified by this option +to allow vectorization. The default value is 0. + @item max-unrolled-insns The maximum number of instructions that a loop should have if that loop is unrolled, and if the loop is unrolled, it determines how many times diff --git a/gcc/params.def b/gcc/params.def index 41a4e41..6528361 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -146,6 +146,12 @@ DEFPARAM (PARAM_MAX_VARIABLE_EXPANSIONS, "If -fvariable-expansion-in-unroller is used, the maximum number of times that an individual variable will be expanded during loop unrolling", 1, 0, 0) +/* Limit loop autovectorization to loops with large enough iteration count. */ +DEFPARAM (PARAM_MIN_VECT_LOOP_BOUND, + "min-vect-loop-bound", + "If -ftree-vectorize is used, the minimal loop bound of a loop to be considered for vectorization", + 0, 0, 0) + /* The maximum number of instructions to consider when looking for an instruction to fill a delay slot. If more than this arbitrary number of instructions is searched, the time savings from filling diff --git a/gcc/params.h b/gcc/params.h index 79a656c..296db61 100644 --- a/gcc/params.h +++ b/gcc/params.h @@ -118,6 +118,8 @@ typedef enum compiler_param PARAM_VALUE (PARAM_MAX_INLINE_INSNS_AUTO) #define MAX_VARIABLE_EXPANSIONS \ PARAM_VALUE (PARAM_MAX_VARIABLE_EXPANSIONS) +#define MIN_VECT_LOOP_BOUND \ + PARAM_VALUE (PARAM_MIN_VECT_LOOP_BOUND) #define MAX_DELAY_SLOT_INSN_SEARCH \ PARAM_VALUE (PARAM_MAX_DELAY_SLOT_INSN_SEARCH) #define MAX_DELAY_SLOT_LIVE_SEARCH \ diff --git a/gcc/tree-vect-analyze.c b/gcc/tree-vect-analyze.c index c8b2bf8..83293d6 100644 --- a/gcc/tree-vect-analyze.c +++ b/gcc/tree-vect-analyze.c @@ -368,7 +368,10 @@ vect_analyze_operations (loop_vec_info loop_vinfo) vectorization_factor, LOOP_VINFO_INT_NITERS (loop_vinfo)); if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) - && LOOP_VINFO_INT_NITERS (loop_vinfo) < vectorization_factor) + && ((LOOP_VINFO_INT_NITERS (loop_vinfo) < vectorization_factor) + || (LOOP_VINFO_INT_NITERS (loop_vinfo) <= + ((unsigned) (PARAM_VALUE (PARAM_MIN_VECT_LOOP_BOUND)) + * vectorization_factor)))) { if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS)) fprintf (vect_dump, "not vectorized: iteration count too small."); diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c index ec3f511..70fa217 100644 --- a/gcc/tree-vect-transform.c +++ b/gcc/tree-vect-transform.c @@ -35,6 +35,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "cfgloop.h" #include "expr.h" #include "optabs.h" +#include "params.h" #include "recog.h" #include "tree-data-ref.h" #include "tree-chrec.h" @@ -4276,6 +4277,7 @@ vect_do_peeling_for_loop_bound (loop_vec_info loop_vinfo, tree *ratio) edge update_e; basic_block preheader; int loop_num; + unsigned int th; if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "=== vect_do_peeling_for_loop_bound ==="); @@ -4291,8 +4293,11 @@ vect_do_peeling_for_loop_bound (loop_vec_info loop_vinfo, tree *ratio) &ratio_mult_vf_name, ratio); loop_num = loop->num; + /* Threshold for vectorized loop. */ + th = (PARAM_VALUE (PARAM_MIN_VECT_LOOP_BOUND)) * + LOOP_VINFO_VECT_FACTOR (loop_vinfo); new_loop = slpeel_tree_peel_loop_to_edge (loop, single_exit (loop), - ratio_mult_vf_name, ni_name, false); + ratio_mult_vf_name, ni_name, false, th); gcc_assert (new_loop); gcc_assert (loop_num == loop->num); #ifdef ENABLE_CHECKING @@ -4517,7 +4522,7 @@ vect_do_peeling_for_alignment (loop_vec_info loop_vinfo) /* Peel the prolog loop and iterate it niters_of_prolog_loop. */ new_loop = slpeel_tree_peel_loop_to_edge (loop, loop_preheader_edge (loop), - niters_of_prolog_loop, ni_name, true); + niters_of_prolog_loop, ni_name, true, 0); gcc_assert (new_loop); #ifdef ENABLE_CHECKING slpeel_verify_cfg_after_peeling (new_loop, loop); diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index c3b64e2..7fb9857 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -1064,7 +1064,8 @@ slpeel_verify_cfg_after_peeling (struct loop *first_loop, struct loop* slpeel_tree_peel_loop_to_edge (struct loop *loop, edge e, tree first_niters, - tree niters, bool update_first_loop_count) + tree niters, bool update_first_loop_count, + unsigned int th) { struct loop *new_loop = NULL, *first_loop, *second_loop; edge skip_e; @@ -1157,7 +1158,8 @@ slpeel_tree_peel_loop_to_edge (struct loop *loop, pre_condition = fold_build2 (LE_EXPR, boolean_type_node, first_niters, - build_int_cst (TREE_TYPE (first_niters), 0)); + build_int_cst (TREE_TYPE (first_niters), th)); + skip_e = slpeel_add_loop_guard (bb_before_first_loop, pre_condition, bb_before_second_loop, bb_before_first_loop); slpeel_update_phi_nodes_for_guard1 (skip_e, first_loop, diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 6950940..92b5567 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -342,7 +342,7 @@ extern bitmap vect_memsyms_to_rename; divide by the vectorization factor, and to peel the first few iterations to force the alignment of data references in the loop. */ extern struct loop *slpeel_tree_peel_loop_to_edge - (struct loop *, edge, tree, tree, bool); + (struct loop *, edge, tree, tree, bool, unsigned int); extern void slpeel_make_loop_iterate_ntimes (struct loop *, tree); extern bool slpeel_can_duplicate_loop_p (struct loop *, edge); #ifdef ENABLE_CHECKING |