+2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
+
+ * tree-vectorizer.h (vec_info::vector_size): Replace with...
+ (vec_info::vector_mode): ...this new field.
+ * tree-vect-loop.c (vect_update_vf_for_slp): Update accordingly.
+ (vect_analyze_loop, vect_transform_loop): Likewise.
+ * tree-vect-loop-manip.c (vect_do_peeling): Likewise.
+ * tree-vect-slp.c (can_duplicate_and_interleave_p): Likewise.
+ (vect_make_slp_decision, vect_slp_bb_region): Likewise.
+ * tree-vect-stmts.c (get_vectype_for_scalar_type): Likewise.
+ * tree-vectorizer.c (try_vectorize_loop_1): Likewise.
+
2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
* target.h (vector_sizes, auto_vector_sizes): Delete.
+2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/vect/vect-tail-nomask-1.c: Update expected epilogue
+ vectorization message.
+
2019-11-14 Richard Henderson <richard.henderson@linaro.org>
* gcc.target/aarch64/asm-flag-1.c: New test.
}
/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" { target avx2_runtime } } } */
-/* { dg-final { scan-tree-dump-times "LOOP EPILOGUE VECTORIZED \\(VS=16\\)" 2 "vect" { target avx2_runtime } } } */
+/* { dg-final { scan-tree-dump-times "LOOP EPILOGUE VECTORIZED \\(MODE=V16QI\\)" 2 "vect" { target avx2_runtime } } } */
unsigned int ratio;
unsigned int epilogue_gaps
= LOOP_VINFO_PEELING_FOR_GAPS (epilogue_vinfo);
- while (!(constant_multiple_p (loop_vinfo->vector_size,
- epilogue_vinfo->vector_size, &ratio)
+ while (!(constant_multiple_p
+ (GET_MODE_SIZE (loop_vinfo->vector_mode),
+ GET_MODE_SIZE (epilogue_vinfo->vector_mode), &ratio)
&& eiters >= lowest_vf / ratio + epilogue_gaps))
{
delete epilogue_vinfo;
dump_printf_loc (MSG_NOTE, vect_location,
"Loop contains SLP and non-SLP stmts\n");
/* Both the vectorization factor and unroll factor have the form
- loop_vinfo->vector_size * X for some rational X, so they must have
- a common multiple. */
+ GET_MODE_SIZE (loop_vinfo->vector_mode) * X for some rational X,
+ so they must have a common multiple. */
vectorization_factor
= force_common_multiple (vectorization_factor,
LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo));
" loops cannot be vectorized\n");
unsigned n_stmts = 0;
- poly_uint64 autodetected_vector_size = 0;
+ machine_mode autodetected_vector_mode = VOIDmode;
opt_loop_vec_info first_loop_vinfo = opt_loop_vec_info::success (NULL);
machine_mode next_vector_mode = VOIDmode;
poly_uint64 lowest_th = 0;
gcc_checking_assert (first_loop_vinfo == NULL);
return loop_vinfo;
}
- loop_vinfo->vector_size = GET_MODE_SIZE (next_vector_mode);
+ loop_vinfo->vector_mode = next_vector_mode;
bool fatal = false;
res = vect_analyze_loop_2 (loop_vinfo, fatal, &n_stmts);
if (mode_i == 0)
- autodetected_vector_size = loop_vinfo->vector_size;
+ autodetected_vector_mode = loop_vinfo->vector_mode;
loop->aux = NULL;
if (res)
if (mode_i < vector_modes.length ()
&& known_eq (GET_MODE_SIZE (vector_modes[mode_i]),
- autodetected_vector_size))
+ GET_MODE_SIZE (autodetected_vector_mode)))
mode_i += 1;
if (mode_i == vector_modes.length ()
- || known_eq (autodetected_vector_size, 0U))
+ || autodetected_vector_mode == VOIDmode)
break;
/* Try the next biggest vector size. */
{
loop->aux = (loop_vec_info) first_loop_vinfo;
if (dump_enabled_p ())
- {
- dump_printf_loc (MSG_NOTE, vect_location,
- "***** Choosing vector size ");
- dump_dec (MSG_NOTE, first_loop_vinfo->vector_size);
- dump_printf (MSG_NOTE, "\n");
- }
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "***** Choosing vector mode %s\n",
+ GET_MODE_NAME (first_loop_vinfo->vector_mode));
LOOP_VINFO_VERSIONING_THRESHOLD (first_loop_vinfo) = lowest_th;
return first_loop_vinfo;
}
dump_printf (MSG_NOTE, "\n");
}
else
- {
- dump_printf_loc (MSG_NOTE, vect_location,
- "LOOP EPILOGUE VECTORIZED (VS=");
- dump_dec (MSG_NOTE, loop_vinfo->vector_size);
- dump_printf (MSG_NOTE, ")\n");
- }
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "LOOP EPILOGUE VECTORIZED (MODE=%s)\n",
+ GET_MODE_NAME (loop_vinfo->vector_mode));
}
/* Loops vectorized with a variable factor won't benefit from
{
scalar_int_mode int_mode;
poly_int64 elt_bits = elt_bytes * BITS_PER_UNIT;
- if (multiple_p (vinfo->vector_size, elt_bytes, &nelts)
+ if (multiple_p (GET_MODE_SIZE (vinfo->vector_mode), elt_bytes, &nelts)
&& int_mode_for_size (elt_bits, 0).exists (&int_mode))
{
tree int_type = build_nonstandard_integer_type
}
if ((dt == vect_constant_def
|| dt == vect_external_def)
- && !vinfo->vector_size.is_constant ()
+ && !GET_MODE_SIZE (vinfo->vector_mode).is_constant ()
&& (TREE_CODE (type) == BOOLEAN_TYPE
|| !can_duplicate_and_interleave_p (vinfo, stmts.length (),
TYPE_MODE (type))))
FOR_EACH_VEC_ELT (slp_instances, i, instance)
{
/* FORNOW: SLP if you can. */
- /* All unroll factors have the form vinfo->vector_size * X for some
- rational X, so they must have a common multiple. */
+ /* All unroll factors have the form:
+
+ GET_MODE_SIZE (vinfo->vector_mode) * X
+
+ for some rational X, so they must have a common multiple. */
unrolling_factor
= force_common_multiple (unrolling_factor,
SLP_INSTANCE_UNROLLING_FACTOR (instance));
vec_info_shared shared;
- poly_uint64 autodetected_vector_size = 0;
+ machine_mode autodetected_vector_mode = VOIDmode;
while (1)
{
bool vectorized = false;
bb_vinfo->shared->save_datarefs ();
else
bb_vinfo->shared->check_datarefs ();
- bb_vinfo->vector_size = GET_MODE_SIZE (next_vector_mode);
+ bb_vinfo->vector_mode = next_vector_mode;
if (vect_slp_analyze_bb_1 (bb_vinfo, n_stmts, fatal)
&& dbg_cnt (vect_slp))
unsigned HOST_WIDE_INT bytes;
if (dump_enabled_p ())
{
- if (bb_vinfo->vector_size.is_constant (&bytes))
+ if (GET_MODE_SIZE (bb_vinfo->vector_mode).is_constant (&bytes))
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"basic block part vectorized using %wu byte "
"vectors\n", bytes);
}
if (mode_i == 0)
- autodetected_vector_size = bb_vinfo->vector_size;
+ autodetected_vector_mode = bb_vinfo->vector_mode;
delete bb_vinfo;
if (mode_i < vector_modes.length ()
&& known_eq (GET_MODE_SIZE (vector_modes[mode_i]),
- autodetected_vector_size))
+ GET_MODE_SIZE (autodetected_vector_mode)))
mode_i += 1;
if (vectorized
|| mode_i == vector_modes.length ()
- || known_eq (autodetected_vector_size, 0U)
+ || autodetected_vector_mode == VOIDmode
/* If vect_slp_analyze_bb_1 signaled that analysis for all
vector sizes will fail do not bother iterating. */
|| fatal)
get_vectype_for_scalar_type (vec_info *vinfo, tree scalar_type)
{
tree vectype;
- vectype = get_vectype_for_scalar_type_and_size (scalar_type,
- vinfo->vector_size);
- if (vectype
- && known_eq (vinfo->vector_size, 0U))
- vinfo->vector_size = GET_MODE_SIZE (TYPE_MODE (vectype));
+ poly_uint64 vector_size = GET_MODE_SIZE (vinfo->vector_mode);
+ vectype = get_vectype_for_scalar_type_and_size (scalar_type, vector_size);
+ if (vectype && vinfo->vector_mode == VOIDmode)
+ vinfo->vector_mode = TYPE_MODE (vectype);
return vectype;
}
unsigned HOST_WIDE_INT bytes;
if (dump_enabled_p ())
{
- if (loop_vinfo->vector_size.is_constant (&bytes))
+ if (GET_MODE_SIZE (loop_vinfo->vector_mode).is_constant (&bytes))
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"loop vectorized using %wu byte vectors\n", bytes);
else
/* Cost data used by the target cost model. */
void *target_cost_data;
- /* The vector size for this loop in bytes, or 0 if we haven't picked
- a size yet. */
- poly_uint64 vector_size;
+ /* If we've chosen a vector size for this vectorization region,
+ this is one mode that has such a size, otherwise it is VOIDmode. */
+ machine_mode vector_mode;
private:
stmt_vec_info new_stmt_vec_info (gimple *stmt);