arbitrary and could potentially be improved with analysis. */
if (where == vect_body && stmt_info
&& stmt_in_inner_loop_p (vinfo, stmt_info))
- count *= 50; /* FIXME */
+ {
+ gcc_assert (loop_vinfo);
+ count *= LOOP_VINFO_INNER_LOOP_COST_FACTOR (loop_vinfo); /* FIXME */
+ }
retval = (unsigned) (count * stmt_cost);
costs->region[where] += retval;
arbitrary and could potentially be improved with analysis. */
if (where == vect_body && stmt_info
&& stmt_in_inner_loop_p (vinfo, stmt_info))
- count *= 50; /* FIXME. */
+ {
+ loop_vec_info loop_vinfo = dyn_cast<loop_vec_info> (vinfo);
+ gcc_assert (loop_vinfo);
+ count *= LOOP_VINFO_INNER_LOOP_COST_FACTOR (loop_vinfo); /* FIXME. */
+ }
retval = (unsigned) (count * stmt_cost);
cost[where] += retval;
arbitrary and could potentially be improved with analysis. */
if (where == vect_body && stmt_info
&& stmt_in_inner_loop_p (vinfo, stmt_info))
- count *= 50; /* FIXME. */
+ {
+ loop_vec_info loop_vinfo = dyn_cast<loop_vec_info> (vinfo);
+ gcc_assert (loop_vinfo);
+ count *= LOOP_VINFO_INNER_LOOP_COST_FACTOR (loop_vinfo); /* FIXME. */
+ }
retval = (unsigned) (count * stmt_cost);
arbitrary and could potentially be improved with analysis. */
if (where == vect_body && stmt_info
&& stmt_in_inner_loop_p (vinfo, stmt_info))
- count *= 50; /* FIXME. */
+ {
+ loop_vec_info loop_vinfo = dyn_cast<loop_vec_info> (vinfo);
+ gcc_assert (loop_vinfo);
+ count *= LOOP_VINFO_INNER_LOOP_COST_FACTOR (loop_vinfo); /* FIXME. */
+ }
retval = (unsigned) (count * stmt_cost);
cost_data->cost[where] += retval;
The parameter only has an effect on targets that support partial
vector loads and stores.
+@item vect-inner-loop-cost-factor
+The factor which the loop vectorizer applies to the cost of statements
+in an inner loop relative to the loop being vectorized. The default
+value is 50.
+
@item avoid-fma-max-bits
Maximum number of bits for which we avoid creating FMAs.
Common Joined UInteger Var(param_vect_partial_vector_usage) Init(2) IntegerRange(0, 2) Param Optimization
Controls how loop vectorizer uses partial vectors. 0 means never, 1 means only for loops whose need to iterate can be removed, 2 means for all loops. The default value is 2.
+-param=vect-inner-loop-cost-factor=
+Common Joined UInteger Var(param_vect_inner_loop_cost_factor) Init(50) IntegerRange(1, 999999) Param Optimization
+The factor which the loop vectorizer applies to the cost of statements in an inner loop relative to the loop being vectorized.
+
; This comment is to ensure we retain the blank line above.
#include "attribs.h"
#include "asan.h"
#include "emit-rtl.h"
+#include "gimple.h"
+#include "cfgloop.h"
+#include "tree-vectorizer.h"
bool
default_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED,
arbitrary and could potentially be improved with analysis. */
if (where == vect_body && stmt_info
&& stmt_in_inner_loop_p (vinfo, stmt_info))
- count *= 50; /* FIXME. */
+ {
+ loop_vec_info loop_vinfo = dyn_cast<loop_vec_info> (vinfo);
+ gcc_assert (loop_vinfo);
+ count *= LOOP_VINFO_INNER_LOOP_COST_FACTOR (loop_vinfo);
+ }
retval = (unsigned) (count * stmt_cost);
cost[where] += retval;
single_scalar_iteration_cost (0),
vec_outside_cost (0),
vec_inside_cost (0),
+ inner_loop_cost_factor (param_vect_inner_loop_cost_factor),
vectorizable (false),
can_use_partial_vectors_p (param_vect_partial_vector_usage != 0),
using_partial_vectors_p (false),
/* FORNOW. */
innerloop_iters = 1;
if (loop->inner)
- innerloop_iters = 50; /* FIXME */
+ innerloop_iters = LOOP_VINFO_INNER_LOOP_COST_FACTOR (loop_vinfo);
for (i = 0; i < nbbs; i++)
{
/* The cost of the vector loop body. */
int vec_inside_cost;
+ /* The factor used to over weight those statements in an inner loop
+ relative to the loop being vectorized. */
+ unsigned int inner_loop_cost_factor;
+
/* Is the loop vectorizable? */
bool vectorizable;
#define LOOP_VINFO_SINGLE_SCALAR_ITERATION_COST(L) (L)->single_scalar_iteration_cost
#define LOOP_VINFO_ORIG_LOOP_INFO(L) (L)->orig_loop_info
#define LOOP_VINFO_SIMD_IF_COND(L) (L)->simd_if_cond
+#define LOOP_VINFO_INNER_LOOP_COST_FACTOR(L) (L)->inner_loop_cost_factor
#define LOOP_VINFO_FULLY_MASKED_P(L) \
(LOOP_VINFO_USING_PARTIAL_VECTORS_P (L) \