Commit acdc40df by Dorit Nuzman Committed by Dorit Nuzman

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
parent 37fc8424
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
......
......@@ -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
......
......@@ -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
......
......@@ -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 \
......
......@@ -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.");
......
......@@ -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);
......
......@@ -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,
......
......@@ -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
......
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