mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-19 15:11:08 +08:00
Replace autovectorize_vector_sizes with autovectorize_vector_modes
This is another patch in the series to remove the assumption that all modes involved in vectorisation have to be the same size. Rather than have the target provide a list of vector sizes, it makes the target provide a list of vector "approaches", with each approach represented by a mode. A later patch will pass this mode to targetm.vectorize.related_mode to get the vector mode for a given element mode. Until then, the modes simply act as an alternative way of specifying the vector size. 2019-11-14 Richard Sandiford <richard.sandiford@arm.com> gcc/ * target.h (vector_sizes, auto_vector_sizes): Delete. (vector_modes, auto_vector_modes): New typedefs. * target.def (autovectorize_vector_sizes): Replace with... (autovectorize_vector_modes): ...this new hook. * doc/tm.texi.in (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES): Replace with... (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES): ...this new hook. * doc/tm.texi: Regenerate. * targhooks.h (default_autovectorize_vector_sizes): Delete. (default_autovectorize_vector_modes): New function. * targhooks.c (default_autovectorize_vector_sizes): Delete. (default_autovectorize_vector_modes): New function. * omp-general.c (omp_max_vf): Use autovectorize_vector_modes instead of autovectorize_vector_sizes. Use the number of units in the mode to calculate the maximum VF. * omp-low.c (omp_clause_aligned_alignment): Use autovectorize_vector_modes instead of autovectorize_vector_sizes. Use a loop based on related_mode to iterate through all supported vector modes for a given scalar mode. * optabs-query.c (can_vec_mask_load_store_p): Use autovectorize_vector_modes instead of autovectorize_vector_sizes. * tree-vect-loop.c (vect_analyze_loop, vect_transform_loop): Likewise. * tree-vect-slp.c (vect_slp_bb_region): Likewise. * config/aarch64/aarch64.c (aarch64_autovectorize_vector_sizes): Replace with... (aarch64_autovectorize_vector_modes): ...this new function. (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES): Delete. (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES): Define. * config/arc/arc.c (arc_autovectorize_vector_sizes): Replace with... (arc_autovectorize_vector_modes): ...this new function. (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES): Delete. (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES): Define. * config/arm/arm.c (arm_autovectorize_vector_sizes): Replace with... (arm_autovectorize_vector_modes): ...this new function. (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES): Delete. (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES): Define. * config/i386/i386.c (ix86_autovectorize_vector_sizes): Replace with... (ix86_autovectorize_vector_modes): ...this new function. (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES): Delete. (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES): Define. * config/mips/mips.c (mips_autovectorize_vector_sizes): Replace with... (mips_autovectorize_vector_modes): ...this new function. (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES): Delete. (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES): Define. From-SVN: r278236
This commit is contained in:
parent
0203c4f3bf
commit
e021fb8655
@ -1,3 +1,50 @@
|
||||
2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
|
||||
|
||||
* target.h (vector_sizes, auto_vector_sizes): Delete.
|
||||
(vector_modes, auto_vector_modes): New typedefs.
|
||||
* target.def (autovectorize_vector_sizes): Replace with...
|
||||
(autovectorize_vector_modes): ...this new hook.
|
||||
* doc/tm.texi.in (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES):
|
||||
Replace with...
|
||||
(TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES): ...this new hook.
|
||||
* doc/tm.texi: Regenerate.
|
||||
* targhooks.h (default_autovectorize_vector_sizes): Delete.
|
||||
(default_autovectorize_vector_modes): New function.
|
||||
* targhooks.c (default_autovectorize_vector_sizes): Delete.
|
||||
(default_autovectorize_vector_modes): New function.
|
||||
* omp-general.c (omp_max_vf): Use autovectorize_vector_modes instead
|
||||
of autovectorize_vector_sizes. Use the number of units in the mode
|
||||
to calculate the maximum VF.
|
||||
* omp-low.c (omp_clause_aligned_alignment): Use
|
||||
autovectorize_vector_modes instead of autovectorize_vector_sizes.
|
||||
Use a loop based on related_mode to iterate through all supported
|
||||
vector modes for a given scalar mode.
|
||||
* optabs-query.c (can_vec_mask_load_store_p): Use
|
||||
autovectorize_vector_modes instead of autovectorize_vector_sizes.
|
||||
* tree-vect-loop.c (vect_analyze_loop, vect_transform_loop): Likewise.
|
||||
* tree-vect-slp.c (vect_slp_bb_region): Likewise.
|
||||
* config/aarch64/aarch64.c (aarch64_autovectorize_vector_sizes):
|
||||
Replace with...
|
||||
(aarch64_autovectorize_vector_modes): ...this new function.
|
||||
(TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES): Delete.
|
||||
(TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES): Define.
|
||||
* config/arc/arc.c (arc_autovectorize_vector_sizes): Replace with...
|
||||
(arc_autovectorize_vector_modes): ...this new function.
|
||||
(TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES): Delete.
|
||||
(TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES): Define.
|
||||
* config/arm/arm.c (arm_autovectorize_vector_sizes): Replace with...
|
||||
(arm_autovectorize_vector_modes): ...this new function.
|
||||
(TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES): Delete.
|
||||
(TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES): Define.
|
||||
* config/i386/i386.c (ix86_autovectorize_vector_sizes): Replace with...
|
||||
(ix86_autovectorize_vector_modes): ...this new function.
|
||||
(TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES): Delete.
|
||||
(TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES): Define.
|
||||
* config/mips/mips.c (mips_autovectorize_vector_sizes): Replace with...
|
||||
(mips_autovectorize_vector_modes): ...this new function.
|
||||
(TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES): Delete.
|
||||
(TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES): Define.
|
||||
|
||||
2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
|
||||
|
||||
* tree-vect-stmts.c (vectorizable_shift): Check the number
|
||||
|
@ -15912,12 +15912,12 @@ aarch64_preferred_simd_mode (scalar_mode mode)
|
||||
/* Return a list of possible vector sizes for the vectorizer
|
||||
to iterate over. */
|
||||
static void
|
||||
aarch64_autovectorize_vector_sizes (vector_sizes *sizes, bool)
|
||||
aarch64_autovectorize_vector_modes (vector_modes *modes, bool)
|
||||
{
|
||||
if (TARGET_SVE)
|
||||
sizes->safe_push (BYTES_PER_SVE_VECTOR);
|
||||
sizes->safe_push (16);
|
||||
sizes->safe_push (8);
|
||||
modes->safe_push (VNx16QImode);
|
||||
modes->safe_push (V16QImode);
|
||||
modes->safe_push (V8QImode);
|
||||
}
|
||||
|
||||
/* Implement TARGET_MANGLE_TYPE. */
|
||||
@ -21751,9 +21751,9 @@ aarch64_libgcc_floating_mode_supported_p
|
||||
#define TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION \
|
||||
aarch64_builtin_vectorized_function
|
||||
|
||||
#undef TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES
|
||||
#define TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES \
|
||||
aarch64_autovectorize_vector_sizes
|
||||
#undef TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES
|
||||
#define TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES \
|
||||
aarch64_autovectorize_vector_modes
|
||||
|
||||
#undef TARGET_ATOMIC_ASSIGN_EXPAND_FENV
|
||||
#define TARGET_ATOMIC_ASSIGN_EXPAND_FENV \
|
||||
|
@ -607,15 +607,15 @@ arc_preferred_simd_mode (scalar_mode mode)
|
||||
}
|
||||
|
||||
/* Implements target hook
|
||||
TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES. */
|
||||
TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES. */
|
||||
|
||||
static void
|
||||
arc_autovectorize_vector_sizes (vector_sizes *sizes, bool)
|
||||
arc_autovectorize_vector_modes (vector_modes *modes, bool)
|
||||
{
|
||||
if (TARGET_PLUS_QMACW)
|
||||
{
|
||||
sizes->quick_push (8);
|
||||
sizes->quick_push (4);
|
||||
modes->quick_push (V4HImode);
|
||||
modes->quick_push (V2HImode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -726,8 +726,8 @@ static rtx arc_legitimize_address_0 (rtx, rtx, machine_mode mode);
|
||||
#undef TARGET_VECTORIZE_PREFERRED_SIMD_MODE
|
||||
#define TARGET_VECTORIZE_PREFERRED_SIMD_MODE arc_preferred_simd_mode
|
||||
|
||||
#undef TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES
|
||||
#define TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES arc_autovectorize_vector_sizes
|
||||
#undef TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES
|
||||
#define TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES arc_autovectorize_vector_modes
|
||||
|
||||
#undef TARGET_CAN_USE_DOLOOP_P
|
||||
#define TARGET_CAN_USE_DOLOOP_P arc_can_use_doloop_p
|
||||
|
@ -288,7 +288,7 @@ static bool arm_builtin_support_vector_misalignment (machine_mode mode,
|
||||
static void arm_conditional_register_usage (void);
|
||||
static enum flt_eval_method arm_excess_precision (enum excess_precision_type);
|
||||
static reg_class_t arm_preferred_rename_class (reg_class_t rclass);
|
||||
static void arm_autovectorize_vector_sizes (vector_sizes *, bool);
|
||||
static void arm_autovectorize_vector_modes (vector_modes *, bool);
|
||||
static int arm_default_branch_cost (bool, bool);
|
||||
static int arm_cortex_a5_branch_cost (bool, bool);
|
||||
static int arm_cortex_m_branch_cost (bool, bool);
|
||||
@ -524,9 +524,9 @@ static const struct attribute_spec arm_attribute_table[] =
|
||||
#define TARGET_ARRAY_MODE_SUPPORTED_P arm_array_mode_supported_p
|
||||
#undef TARGET_VECTORIZE_PREFERRED_SIMD_MODE
|
||||
#define TARGET_VECTORIZE_PREFERRED_SIMD_MODE arm_preferred_simd_mode
|
||||
#undef TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES
|
||||
#define TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES \
|
||||
arm_autovectorize_vector_sizes
|
||||
#undef TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES
|
||||
#define TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES \
|
||||
arm_autovectorize_vector_modes
|
||||
|
||||
#undef TARGET_MACHINE_DEPENDENT_REORG
|
||||
#define TARGET_MACHINE_DEPENDENT_REORG arm_reorg
|
||||
@ -29016,12 +29016,12 @@ arm_vector_alignment (const_tree type)
|
||||
}
|
||||
|
||||
static void
|
||||
arm_autovectorize_vector_sizes (vector_sizes *sizes, bool)
|
||||
arm_autovectorize_vector_modes (vector_modes *modes, bool)
|
||||
{
|
||||
if (!TARGET_NEON_VECTORIZE_DOUBLE)
|
||||
{
|
||||
sizes->safe_push (16);
|
||||
sizes->safe_push (8);
|
||||
modes->safe_push (V16QImode);
|
||||
modes->safe_push (V8QImode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21385,35 +21385,35 @@ ix86_preferred_simd_mode (scalar_mode mode)
|
||||
256bit and 128bit vectors. */
|
||||
|
||||
static void
|
||||
ix86_autovectorize_vector_sizes (vector_sizes *sizes, bool all)
|
||||
ix86_autovectorize_vector_modes (vector_modes *modes, bool all)
|
||||
{
|
||||
if (TARGET_AVX512F && !TARGET_PREFER_AVX256)
|
||||
{
|
||||
sizes->safe_push (64);
|
||||
sizes->safe_push (32);
|
||||
sizes->safe_push (16);
|
||||
modes->safe_push (V64QImode);
|
||||
modes->safe_push (V32QImode);
|
||||
modes->safe_push (V16QImode);
|
||||
}
|
||||
else if (TARGET_AVX512F && all)
|
||||
{
|
||||
sizes->safe_push (32);
|
||||
sizes->safe_push (16);
|
||||
sizes->safe_push (64);
|
||||
modes->safe_push (V32QImode);
|
||||
modes->safe_push (V16QImode);
|
||||
modes->safe_push (V64QImode);
|
||||
}
|
||||
else if (TARGET_AVX && !TARGET_PREFER_AVX128)
|
||||
{
|
||||
sizes->safe_push (32);
|
||||
sizes->safe_push (16);
|
||||
modes->safe_push (V32QImode);
|
||||
modes->safe_push (V16QImode);
|
||||
}
|
||||
else if (TARGET_AVX && all)
|
||||
{
|
||||
sizes->safe_push (16);
|
||||
sizes->safe_push (32);
|
||||
modes->safe_push (V16QImode);
|
||||
modes->safe_push (V32QImode);
|
||||
}
|
||||
else if (TARGET_MMX_WITH_SSE)
|
||||
sizes->safe_push (16);
|
||||
modes->safe_push (V16QImode);
|
||||
|
||||
if (TARGET_MMX_WITH_SSE)
|
||||
sizes->safe_push (8);
|
||||
modes->safe_push (V8QImode);
|
||||
}
|
||||
|
||||
/* Implemenation of targetm.vectorize.get_mask_mode. */
|
||||
@ -22952,9 +22952,9 @@ ix86_run_selftests (void)
|
||||
#undef TARGET_VECTORIZE_SPLIT_REDUCTION
|
||||
#define TARGET_VECTORIZE_SPLIT_REDUCTION \
|
||||
ix86_split_reduction
|
||||
#undef TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES
|
||||
#define TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES \
|
||||
ix86_autovectorize_vector_sizes
|
||||
#undef TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES
|
||||
#define TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES \
|
||||
ix86_autovectorize_vector_modes
|
||||
#undef TARGET_VECTORIZE_GET_MASK_MODE
|
||||
#define TARGET_VECTORIZE_GET_MASK_MODE ix86_get_mask_mode
|
||||
#undef TARGET_VECTORIZE_INIT_COST
|
||||
|
@ -13453,13 +13453,13 @@ mips_preferred_simd_mode (scalar_mode mode)
|
||||
return word_mode;
|
||||
}
|
||||
|
||||
/* Implement TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES. */
|
||||
/* Implement TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES. */
|
||||
|
||||
static void
|
||||
mips_autovectorize_vector_sizes (vector_sizes *sizes, bool)
|
||||
mips_autovectorize_vector_modes (vector_modes *modes, bool)
|
||||
{
|
||||
if (ISA_HAS_MSA)
|
||||
sizes->safe_push (16);
|
||||
modes->safe_push (V16QImode);
|
||||
}
|
||||
|
||||
/* Implement TARGET_INIT_LIBFUNCS. */
|
||||
@ -22716,9 +22716,9 @@ mips_starting_frame_offset (void)
|
||||
|
||||
#undef TARGET_VECTORIZE_PREFERRED_SIMD_MODE
|
||||
#define TARGET_VECTORIZE_PREFERRED_SIMD_MODE mips_preferred_simd_mode
|
||||
#undef TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES
|
||||
#define TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES \
|
||||
mips_autovectorize_vector_sizes
|
||||
#undef TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES
|
||||
#define TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES \
|
||||
mips_autovectorize_vector_modes
|
||||
|
||||
#undef TARGET_INIT_BUILTINS
|
||||
#define TARGET_INIT_BUILTINS mips_init_builtins
|
||||
|
@ -6008,12 +6008,20 @@ against lower halves of vectors recursively until the specified mode is
|
||||
reached. The default is @var{mode} which means no splitting.
|
||||
@end deftypefn
|
||||
|
||||
@deftypefn {Target Hook} void TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES (vector_sizes *@var{sizes}, bool @var{all})
|
||||
If the mode returned by @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE} is not
|
||||
the only one that is worth considering, this hook should add all suitable
|
||||
vector sizes to @var{sizes}, in order of decreasing preference. The first
|
||||
one should be the size of @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE}.
|
||||
If @var{all} is true, add suitable vector sizes even when they are generally
|
||||
@deftypefn {Target Hook} void TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES (vector_modes *@var{modes}, bool @var{all})
|
||||
If using the mode returned by @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE}
|
||||
is not the only approach worth considering, this hook should add one mode to
|
||||
@var{modes} for each useful alternative approach. These modes are then
|
||||
passed to @code{TARGET_VECTORIZE_RELATED_MODE} to obtain the vector mode
|
||||
for a given element mode.
|
||||
|
||||
The modes returned in @var{modes} should use the smallest element mode
|
||||
possible for the vectorization approach that they represent, preferring
|
||||
integer modes over floating-poing modes in the event of a tie. The first
|
||||
mode should be the @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE} for its
|
||||
element mode.
|
||||
|
||||
If @var{all} is true, add suitable vector modes even when they are generally
|
||||
not expected to be worthwhile.
|
||||
|
||||
The hook does not need to do anything if the vector returned by
|
||||
|
@ -4175,7 +4175,7 @@ address; but often a machine-dependent strategy can generate better code.
|
||||
|
||||
@hook TARGET_VECTORIZE_SPLIT_REDUCTION
|
||||
|
||||
@hook TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES
|
||||
@hook TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES
|
||||
|
||||
@hook TARGET_VECTORIZE_RELATED_MODE
|
||||
|
||||
|
@ -516,13 +516,16 @@ omp_max_vf (void)
|
||||
&& global_options_set.x_flag_tree_loop_vectorize))
|
||||
return 1;
|
||||
|
||||
auto_vector_sizes sizes;
|
||||
targetm.vectorize.autovectorize_vector_sizes (&sizes, true);
|
||||
if (!sizes.is_empty ())
|
||||
auto_vector_modes modes;
|
||||
targetm.vectorize.autovectorize_vector_modes (&modes, true);
|
||||
if (!modes.is_empty ())
|
||||
{
|
||||
poly_uint64 vf = 0;
|
||||
for (unsigned int i = 0; i < sizes.length (); ++i)
|
||||
vf = ordered_max (vf, sizes[i]);
|
||||
for (unsigned int i = 0; i < modes.length (); ++i)
|
||||
/* The returned modes use the smallest element size (and thus
|
||||
the largest nunits) for the vectorization approach that they
|
||||
represent. */
|
||||
vf = ordered_max (vf, GET_MODE_NUNITS (modes[i]));
|
||||
return vf;
|
||||
}
|
||||
|
||||
|
@ -4064,11 +4064,8 @@ omp_clause_aligned_alignment (tree clause)
|
||||
/* Otherwise return implementation defined alignment. */
|
||||
unsigned int al = 1;
|
||||
opt_scalar_mode mode_iter;
|
||||
auto_vector_sizes sizes;
|
||||
targetm.vectorize.autovectorize_vector_sizes (&sizes, true);
|
||||
poly_uint64 vs = 0;
|
||||
for (unsigned int i = 0; i < sizes.length (); ++i)
|
||||
vs = ordered_max (vs, sizes[i]);
|
||||
auto_vector_modes modes;
|
||||
targetm.vectorize.autovectorize_vector_modes (&modes, true);
|
||||
static enum mode_class classes[]
|
||||
= { MODE_INT, MODE_VECTOR_INT, MODE_FLOAT, MODE_VECTOR_FLOAT };
|
||||
for (int i = 0; i < 4; i += 2)
|
||||
@ -4079,19 +4076,18 @@ omp_clause_aligned_alignment (tree clause)
|
||||
machine_mode vmode = targetm.vectorize.preferred_simd_mode (mode);
|
||||
if (GET_MODE_CLASS (vmode) != classes[i + 1])
|
||||
continue;
|
||||
while (maybe_ne (vs, 0U)
|
||||
&& known_lt (GET_MODE_SIZE (vmode), vs)
|
||||
&& GET_MODE_2XWIDER_MODE (vmode).exists ())
|
||||
vmode = GET_MODE_2XWIDER_MODE (vmode).require ();
|
||||
machine_mode alt_vmode;
|
||||
for (unsigned int j = 0; j < modes.length (); ++j)
|
||||
if (related_vector_mode (modes[j], mode).exists (&alt_vmode)
|
||||
&& known_ge (GET_MODE_SIZE (alt_vmode), GET_MODE_SIZE (vmode)))
|
||||
vmode = alt_vmode;
|
||||
|
||||
tree type = lang_hooks.types.type_for_mode (mode, 1);
|
||||
if (type == NULL_TREE || TYPE_MODE (type) != mode)
|
||||
continue;
|
||||
poly_uint64 nelts = exact_div (GET_MODE_SIZE (vmode),
|
||||
GET_MODE_SIZE (mode));
|
||||
type = build_vector_type (type, nelts);
|
||||
if (TYPE_MODE (type) != vmode)
|
||||
continue;
|
||||
type = build_vector_type_for_mode (type, vmode);
|
||||
/* The functions above are not allowed to return invalid modes. */
|
||||
gcc_assert (TYPE_MODE (type) == vmode);
|
||||
if (TYPE_ALIGN_UNIT (type) > al)
|
||||
al = TYPE_ALIGN_UNIT (type);
|
||||
}
|
||||
|
@ -589,11 +589,11 @@ can_vec_mask_load_store_p (machine_mode mode,
|
||||
&& convert_optab_handler (op, vmode, mask_mode) != CODE_FOR_nothing)
|
||||
return true;
|
||||
|
||||
auto_vector_sizes vector_sizes;
|
||||
targetm.vectorize.autovectorize_vector_sizes (&vector_sizes, true);
|
||||
for (unsigned int i = 0; i < vector_sizes.length (); ++i)
|
||||
auto_vector_modes vector_modes;
|
||||
targetm.vectorize.autovectorize_vector_modes (&vector_modes, true);
|
||||
for (unsigned int i = 0; i < vector_modes.length (); ++i)
|
||||
{
|
||||
poly_uint64 cur = vector_sizes[i];
|
||||
poly_uint64 cur = GET_MODE_SIZE (vector_modes[i]);
|
||||
poly_uint64 nunits;
|
||||
if (!multiple_p (cur, GET_MODE_SIZE (smode), &nunits))
|
||||
continue;
|
||||
|
@ -1909,20 +1909,28 @@ reached. The default is @var{mode} which means no splitting.",
|
||||
/* Returns a mask of vector sizes to iterate over when auto-vectorizing
|
||||
after processing the preferred one derived from preferred_simd_mode. */
|
||||
DEFHOOK
|
||||
(autovectorize_vector_sizes,
|
||||
"If the mode returned by @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE} is not\n\
|
||||
the only one that is worth considering, this hook should add all suitable\n\
|
||||
vector sizes to @var{sizes}, in order of decreasing preference. The first\n\
|
||||
one should be the size of @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE}.\n\
|
||||
If @var{all} is true, add suitable vector sizes even when they are generally\n\
|
||||
(autovectorize_vector_modes,
|
||||
"If using the mode returned by @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE}\n\
|
||||
is not the only approach worth considering, this hook should add one mode to\n\
|
||||
@var{modes} for each useful alternative approach. These modes are then\n\
|
||||
passed to @code{TARGET_VECTORIZE_RELATED_MODE} to obtain the vector mode\n\
|
||||
for a given element mode.\n\
|
||||
\n\
|
||||
The modes returned in @var{modes} should use the smallest element mode\n\
|
||||
possible for the vectorization approach that they represent, preferring\n\
|
||||
integer modes over floating-poing modes in the event of a tie. The first\n\
|
||||
mode should be the @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE} for its\n\
|
||||
element mode.\n\
|
||||
\n\
|
||||
If @var{all} is true, add suitable vector modes even when they are generally\n\
|
||||
not expected to be worthwhile.\n\
|
||||
\n\
|
||||
The hook does not need to do anything if the vector returned by\n\
|
||||
@code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE} is the only one relevant\n\
|
||||
for autovectorization. The default implementation does nothing.",
|
||||
void,
|
||||
(vector_sizes *sizes, bool all),
|
||||
default_autovectorize_vector_sizes)
|
||||
(vector_modes *modes, bool all),
|
||||
default_autovectorize_vector_modes)
|
||||
|
||||
DEFHOOK
|
||||
(related_mode,
|
||||
|
@ -205,11 +205,11 @@ enum vect_cost_model_location {
|
||||
class vec_perm_indices;
|
||||
|
||||
/* The type to use for lists of vector sizes. */
|
||||
typedef vec<poly_uint64> vector_sizes;
|
||||
typedef vec<machine_mode> vector_modes;
|
||||
|
||||
/* Same, but can be used to construct local lists that are
|
||||
automatically freed. */
|
||||
typedef auto_vec<poly_uint64, 8> auto_vector_sizes;
|
||||
typedef auto_vec<machine_mode, 8> auto_vector_modes;
|
||||
|
||||
/* First argument of targetm.omp.device_kind_arch_isa. */
|
||||
enum omp_device_kind_arch_isa {
|
||||
|
@ -1298,11 +1298,10 @@ default_split_reduction (machine_mode mode)
|
||||
return mode;
|
||||
}
|
||||
|
||||
/* By default only the size derived from the preferred vector mode
|
||||
is tried. */
|
||||
/* By default only the preferred vector mode is tried. */
|
||||
|
||||
void
|
||||
default_autovectorize_vector_sizes (vector_sizes *, bool)
|
||||
default_autovectorize_vector_modes (vector_modes *, bool)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ default_builtin_support_vector_misalignment (machine_mode mode,
|
||||
int, bool);
|
||||
extern machine_mode default_preferred_simd_mode (scalar_mode mode);
|
||||
extern machine_mode default_split_reduction (machine_mode);
|
||||
extern void default_autovectorize_vector_sizes (vector_sizes *, bool);
|
||||
extern void default_autovectorize_vector_modes (vector_modes *, bool);
|
||||
extern opt_machine_mode default_vectorize_related_mode (machine_mode,
|
||||
scalar_mode,
|
||||
poly_uint64);
|
||||
|
@ -2382,12 +2382,12 @@ again:
|
||||
opt_loop_vec_info
|
||||
vect_analyze_loop (class loop *loop, vec_info_shared *shared)
|
||||
{
|
||||
auto_vector_sizes vector_sizes;
|
||||
auto_vector_modes vector_modes;
|
||||
|
||||
/* Autodetect first vector size we try. */
|
||||
targetm.vectorize.autovectorize_vector_sizes (&vector_sizes,
|
||||
targetm.vectorize.autovectorize_vector_modes (&vector_modes,
|
||||
loop->simdlen != 0);
|
||||
unsigned int next_size = 0;
|
||||
unsigned int mode_i = 0;
|
||||
|
||||
DUMP_VECT_SCOPE ("analyze_loop_nest");
|
||||
|
||||
@ -2406,7 +2406,7 @@ vect_analyze_loop (class loop *loop, vec_info_shared *shared)
|
||||
unsigned n_stmts = 0;
|
||||
poly_uint64 autodetected_vector_size = 0;
|
||||
opt_loop_vec_info first_loop_vinfo = opt_loop_vec_info::success (NULL);
|
||||
poly_uint64 next_vector_size = 0;
|
||||
machine_mode next_vector_mode = VOIDmode;
|
||||
poly_uint64 lowest_th = 0;
|
||||
unsigned vectorized_loops = 0;
|
||||
|
||||
@ -2425,7 +2425,7 @@ vect_analyze_loop (class loop *loop, vec_info_shared *shared)
|
||||
gcc_checking_assert (first_loop_vinfo == NULL);
|
||||
return loop_vinfo;
|
||||
}
|
||||
loop_vinfo->vector_size = next_vector_size;
|
||||
loop_vinfo->vector_size = GET_MODE_SIZE (next_vector_mode);
|
||||
|
||||
bool fatal = false;
|
||||
|
||||
@ -2433,7 +2433,7 @@ vect_analyze_loop (class loop *loop, vec_info_shared *shared)
|
||||
LOOP_VINFO_ORIG_LOOP_INFO (loop_vinfo) = first_loop_vinfo;
|
||||
|
||||
res = vect_analyze_loop_2 (loop_vinfo, fatal, &n_stmts);
|
||||
if (next_size == 0)
|
||||
if (mode_i == 0)
|
||||
autodetected_vector_size = loop_vinfo->vector_size;
|
||||
|
||||
loop->aux = NULL;
|
||||
@ -2500,24 +2500,21 @@ vect_analyze_loop (class loop *loop, vec_info_shared *shared)
|
||||
}
|
||||
}
|
||||
|
||||
if (next_size < vector_sizes.length ()
|
||||
&& known_eq (vector_sizes[next_size], autodetected_vector_size))
|
||||
next_size += 1;
|
||||
if (mode_i < vector_modes.length ()
|
||||
&& known_eq (GET_MODE_SIZE (vector_modes[mode_i]),
|
||||
autodetected_vector_size))
|
||||
mode_i += 1;
|
||||
|
||||
if (next_size == vector_sizes.length ()
|
||||
if (mode_i == vector_modes.length ()
|
||||
|| known_eq (autodetected_vector_size, 0U))
|
||||
break;
|
||||
|
||||
/* Try the next biggest vector size. */
|
||||
next_vector_size = vector_sizes[next_size++];
|
||||
next_vector_mode = vector_modes[mode_i++];
|
||||
if (dump_enabled_p ())
|
||||
{
|
||||
dump_printf_loc (MSG_NOTE, vect_location,
|
||||
"***** Re-trying analysis with "
|
||||
"vector size ");
|
||||
dump_dec (MSG_NOTE, next_vector_size);
|
||||
dump_printf (MSG_NOTE, "\n");
|
||||
}
|
||||
dump_printf_loc (MSG_NOTE, vect_location,
|
||||
"***** Re-trying analysis with vector mode %s\n",
|
||||
GET_MODE_NAME (next_vector_mode));
|
||||
}
|
||||
|
||||
if (first_loop_vinfo)
|
||||
|
@ -3172,12 +3172,12 @@ vect_slp_bb_region (gimple_stmt_iterator region_begin,
|
||||
unsigned int n_stmts)
|
||||
{
|
||||
bb_vec_info bb_vinfo;
|
||||
auto_vector_sizes vector_sizes;
|
||||
auto_vector_modes vector_modes;
|
||||
|
||||
/* Autodetect first vector size we try. */
|
||||
poly_uint64 next_vector_size = 0;
|
||||
targetm.vectorize.autovectorize_vector_sizes (&vector_sizes, false);
|
||||
unsigned int next_size = 0;
|
||||
machine_mode next_vector_mode = VOIDmode;
|
||||
targetm.vectorize.autovectorize_vector_modes (&vector_modes, false);
|
||||
unsigned int mode_i = 0;
|
||||
|
||||
vec_info_shared shared;
|
||||
|
||||
@ -3194,7 +3194,7 @@ vect_slp_bb_region (gimple_stmt_iterator region_begin,
|
||||
bb_vinfo->shared->save_datarefs ();
|
||||
else
|
||||
bb_vinfo->shared->check_datarefs ();
|
||||
bb_vinfo->vector_size = next_vector_size;
|
||||
bb_vinfo->vector_size = GET_MODE_SIZE (next_vector_mode);
|
||||
|
||||
if (vect_slp_analyze_bb_1 (bb_vinfo, n_stmts, fatal)
|
||||
&& dbg_cnt (vect_slp))
|
||||
@ -3221,17 +3221,18 @@ vect_slp_bb_region (gimple_stmt_iterator region_begin,
|
||||
vectorized = true;
|
||||
}
|
||||
|
||||
if (next_size == 0)
|
||||
if (mode_i == 0)
|
||||
autodetected_vector_size = bb_vinfo->vector_size;
|
||||
|
||||
delete bb_vinfo;
|
||||
|
||||
if (next_size < vector_sizes.length ()
|
||||
&& known_eq (vector_sizes[next_size], autodetected_vector_size))
|
||||
next_size += 1;
|
||||
if (mode_i < vector_modes.length ()
|
||||
&& known_eq (GET_MODE_SIZE (vector_modes[mode_i]),
|
||||
autodetected_vector_size))
|
||||
mode_i += 1;
|
||||
|
||||
if (vectorized
|
||||
|| next_size == vector_sizes.length ()
|
||||
|| mode_i == vector_modes.length ()
|
||||
|| known_eq (autodetected_vector_size, 0U)
|
||||
/* If vect_slp_analyze_bb_1 signaled that analysis for all
|
||||
vector sizes will fail do not bother iterating. */
|
||||
@ -3239,15 +3240,11 @@ vect_slp_bb_region (gimple_stmt_iterator region_begin,
|
||||
return vectorized;
|
||||
|
||||
/* Try the next biggest vector size. */
|
||||
next_vector_size = vector_sizes[next_size++];
|
||||
next_vector_mode = vector_modes[mode_i++];
|
||||
if (dump_enabled_p ())
|
||||
{
|
||||
dump_printf_loc (MSG_NOTE, vect_location,
|
||||
"***** Re-trying analysis with "
|
||||
"vector size ");
|
||||
dump_dec (MSG_NOTE, next_vector_size);
|
||||
dump_printf (MSG_NOTE, "\n");
|
||||
}
|
||||
dump_printf_loc (MSG_NOTE, vect_location,
|
||||
"***** Re-trying analysis with vector mode %s\n",
|
||||
GET_MODE_NAME (next_vector_mode));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user