@@ -16870,7 +16870,8 @@ The maximum number of insns in loop header duplicated
by the copy loop headers pass.
@item vect-epilogues-nomask
-Enable loop epilogue vectorization using smaller vector size.
+Enable loop epilogue vectorization using smaller vector size with up to N
+vector epilogue loops.
@item vect-partial-vector-usage
Controls when the loop vectorizer considers using partial vector loads
@@ -1175,7 +1175,7 @@ Common Joined UInteger Var(param_use_canonical_types) Init(1) IntegerRange(0, 1)
Whether to use canonical types.
-param=vect-epilogues-nomask=
-Common Joined UInteger Var(param_vect_epilogues_nomask) Init(1) IntegerRange(0, 1) Param Optimization
+Common Joined UInteger Var(param_vect_epilogues_nomask) Init(1) IntegerRange(0, 8) Param Optimization
Enable loop epilogue vectorization using smaller vector size.
-param=vect-max-layout-candidates=
@@ -3721,6 +3721,10 @@ vect_analyze_loop (class loop *loop, gimple *loop_vectorized_call,
partial_vectors_supported_p () && param_vect_partial_vector_usage != 0;
poly_uint64 first_vinfo_vf = LOOP_VINFO_VECT_FACTOR (first_loop_vinfo);
+ loop_vec_info orig_loop_vinfo = first_loop_vinfo;
+ unsigned n = param_vect_epilogues_nomask;
+ do
+ {
while (1)
{
/* If the target does not support partial vectors we can shorten the
@@ -3744,7 +3748,7 @@ vect_analyze_loop (class loop *loop, gimple *loop_vectorized_call,
bool fatal;
opt_loop_vec_info loop_vinfo
= vect_analyze_loop_1 (loop, shared, &loop_form_info,
- first_loop_vinfo,
+ orig_loop_vinfo,
vector_modes, mode_i,
autodetected_vector_mode, fatal);
if (fatal)
@@ -3769,17 +3773,24 @@ vect_analyze_loop (class loop *loop, gimple *loop_vectorized_call,
loop_vinfo = opt_loop_vec_info::success (NULL);
}
- /* For now only allow one epilogue loop, but allow
- pick_lowest_cost_p to replace it, so commit to the
- first epilogue if we have no reason to try alternatives. */
+ /* If we do not pick an alternative based on cost we're done. */
if (!pick_lowest_cost_p)
break;
}
if (mode_i == vector_modes.length ())
- break;
-
+ {
+ mode_i = 0;
+ break;
+ }
+ }
+ if (mode_i == vector_modes.length ())
+ break;
+ orig_loop_vinfo = orig_loop_vinfo->epilogue_vinfo;
}
+ while (orig_loop_vinfo
+ && !LOOP_VINFO_USING_PARTIAL_VECTORS_P (orig_loop_vinfo)
+ && --n != 0);
if (first_loop_vinfo->epilogue_vinfo)
{