* 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
+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
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
"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
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 \
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.");
#include "cfgloop.h"
#include "expr.h"
#include "optabs.h"
+#include "params.h"
#include "recog.h"
#include "tree-data-ref.h"
#include "tree-chrec.h"
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 ===");
&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
/* 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);
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;
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,
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