scan_map (NULL),
inner_loop_cost_factor (param_vect_inner_loop_cost_factor),
vectorizable (false),
- can_use_partial_vectors_p (param_vect_partial_vector_usage != 0),
+ can_use_partial_vectors_p (true),
must_use_partial_vectors_p (false),
using_partial_vectors_p (false),
using_decrementing_iv_p (false),
LOOP_VINFO_USING_PARTIAL_VECTORS_P == false
LOOP_VINFO_PEELING_FOR_NITER == true
+ The MASKED_P argument specifies to what extent
+ param_vect_partial_vector_usage is to be honored. For MASKED_P == 0
+ no partial vectors are to be used, for MASKED_P == -1 it's
+ param_vect_partial_vector_usage that gets to decide whether we may
+ consider partial vector usage. For MASKED_P == 1 partial vectors
+ may be used if possible.
+
*/
static opt_result
-vect_determine_partial_vectors_and_peeling (loop_vec_info loop_vinfo)
+vect_determine_partial_vectors_and_peeling (loop_vec_info loop_vinfo,
+ int masked_p)
{
/* Determine whether there would be any scalar iterations left over. */
bool need_peeling_or_partial_vectors_p
/* Decide whether to vectorize the loop with partial vectors. */
LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) = false;
- if (LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo)
- && LOOP_VINFO_MUST_USE_PARTIAL_VECTORS_P (loop_vinfo))
+ if (masked_p == 0
+ || (masked_p == -1 && param_vect_partial_vector_usage == 0))
+ /* If requested explicitly do not use partial vectors. */
+ LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) = false;
+ else if (LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo)
+ && LOOP_VINFO_MUST_USE_PARTIAL_VECTORS_P (loop_vinfo))
LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) = true;
else if (LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo)
&& need_peeling_or_partial_vectors_p)
SINGLE_LANE_SLP_DONE_FOR_SUGGESTED_UF is to hold whether single-lane
slp was forced when the suggested unroll factor was worked out. */
static opt_result
-vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal,
+vect_analyze_loop_2 (loop_vec_info loop_vinfo, int masked_p, bool &fatal,
unsigned *suggested_unroll_factor,
bool& single_lane_slp_done_for_suggested_uf)
{
assuming that the loop will be used as a main loop. We will redo
this analysis later if we instead decide to use the loop as an
epilogue loop. */
- ok = vect_determine_partial_vectors_and_peeling (loop_vinfo);
+ ok = vect_determine_partial_vectors_and_peeling (loop_vinfo, masked_p);
if (!ok)
return ok;
machine_mode vector_mode = vector_modes[mode_i];
loop_vinfo->vector_mode = vector_mode;
- if (masked_p != -1)
- loop_vinfo->can_use_partial_vectors_p = masked_p;
unsigned int suggested_unroll_factor = 1;
bool single_lane_slp_done_for_suggested_uf = false;
/* Run the main analysis. */
- opt_result res = vect_analyze_loop_2 (loop_vinfo, fatal,
+ opt_result res = vect_analyze_loop_2 (loop_vinfo, masked_p, fatal,
&suggested_unroll_factor,
single_lane_slp_done_for_suggested_uf);
if (dump_enabled_p ())
unroll_vinfo->vector_mode = vector_mode;
unroll_vinfo->suggested_unroll_factor = suggested_unroll_factor;
opt_result new_res
- = vect_analyze_loop_2 (unroll_vinfo, fatal, NULL,
- single_lane_slp_done_for_suggested_uf);
+ = vect_analyze_loop_2 (unroll_vinfo, masked_p, fatal, NULL,
+ single_lane_slp_done_for_suggested_uf);
if (new_res)
{
delete loop_vinfo;
bool supports_partial_vectors = (param_vect_partial_vector_usage != 0
|| masked_p == 1);
- machine_mode mask_mode;
if (supports_partial_vectors
&& !partial_vectors_supported_p ()
- && !(VECTOR_MODE_P (first_loop_vinfo->vector_mode)
- && targetm.vectorize.get_mask_mode
- (first_loop_vinfo->vector_mode).exists (&mask_mode)
- && SCALAR_INT_MODE_P (mask_mode)))
+ && !LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (first_loop_vinfo))
supports_partial_vectors = false;
poly_uint64 first_vinfo_vf = LOOP_VINFO_VECT_FACTOR (first_loop_vinfo);