diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-11-14 15:03:17 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-11-14 15:03:17 +0000 |
commit | e021fb865564b62a10adb1e98f75b5ea05058047 (patch) | |
tree | 887a7266e62237498f1d6bfa5d1c8c9d681210e6 /gcc/config | |
parent | 0203c4f3bfb3e3242635b0cee0b9deedb4070a62 (diff) | |
download | gcc-e021fb865564b62a10adb1e98f75b5ea05058047.zip gcc-e021fb865564b62a10adb1e98f75b5ea05058047.tar.gz gcc-e021fb865564b62a10adb1e98f75b5ea05058047.tar.bz2 |
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
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/aarch64/aarch64.c | 14 | ||||
-rw-r--r-- | gcc/config/arc/arc.c | 12 | ||||
-rw-r--r-- | gcc/config/arm/arm.c | 14 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 32 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 12 |
5 files changed, 42 insertions, 42 deletions
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 0870d2c..d177541 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -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 \ diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index c2d38dd..f48f102 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -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 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index fea3882..70a20f7 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -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); } } diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 69c8278..c406be3 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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 diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index e337b82..30017e3 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -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 |