diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-11-14 15:05:37 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-11-14 15:05:37 +0000 |
commit | 1c84a2d25ecd4c03dde745f36a4762dd45f97c85 (patch) | |
tree | ade2b975bc48ad715b167c702ef02abc267644df /gcc | |
parent | e021fb865564b62a10adb1e98f75b5ea05058047 (diff) | |
download | gcc-1c84a2d25ecd4c03dde745f36a4762dd45f97c85.zip gcc-1c84a2d25ecd4c03dde745f36a4762dd45f97c85.tar.gz gcc-1c84a2d25ecd4c03dde745f36a4762dd45f97c85.tar.bz2 |
Replace vec_info::vector_size with vec_info::vector_mode
This patch replaces vec_info::vector_size with vec_info::vector_mode,
but for now continues to use it as a way of specifying a single
vector size. This makes it easier for later patches to use
related_vector_mode instead.
2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* 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.
gcc/testsuite/
* gcc.dg/vect/vect-tail-nomask-1.c: Update expected epilogue
vectorization message.
From-SVN: r278237
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-tail-nomask-1.c | 2 | ||||
-rw-r--r-- | gcc/tree-vect-loop-manip.c | 5 | ||||
-rw-r--r-- | gcc/tree-vect-loop.c | 32 | ||||
-rw-r--r-- | gcc/tree-vect-slp.c | 23 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.c | 9 | ||||
-rw-r--r-- | gcc/tree-vectorizer.c | 2 | ||||
-rw-r--r-- | gcc/tree-vectorizer.h | 6 |
9 files changed, 55 insertions, 41 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 218ce4c..bd9eeec 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,17 @@ 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. (vector_modes, auto_vector_modes): New typedefs. * target.def (autovectorize_vector_sizes): Replace with... diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1b937c8..4445c17 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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. diff --git a/gcc/testsuite/gcc.dg/vect/vect-tail-nomask-1.c b/gcc/testsuite/gcc.dg/vect/vect-tail-nomask-1.c index b912a34..e5bbeae 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-tail-nomask-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-tail-nomask-1.c @@ -106,4 +106,4 @@ main (int argc, const char **argv) } /* { 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 } } } */ diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index f49d980..b4dda97 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -2538,8 +2538,9 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1, 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; diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 77ae9f51..213d620 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1422,8 +1422,8 @@ vect_update_vf_for_slp (loop_vec_info loop_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)); @@ -2404,7 +2404,7 @@ vect_analyze_loop (class loop *loop, vec_info_shared *shared) " 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; @@ -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 = GET_MODE_SIZE (next_vector_mode); + loop_vinfo->vector_mode = next_vector_mode; bool fatal = false; @@ -2434,7 +2434,7 @@ vect_analyze_loop (class loop *loop, vec_info_shared *shared) 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) @@ -2502,11 +2502,11 @@ vect_analyze_loop (class loop *loop, vec_info_shared *shared) 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. */ @@ -2521,12 +2521,9 @@ vect_analyze_loop (class loop *loop, vec_info_shared *shared) { 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; } @@ -8580,12 +8577,9 @@ vect_transform_loop (loop_vec_info 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 diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index b6d75f8..3885d9c 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -271,7 +271,7 @@ can_duplicate_and_interleave_p (vec_info *vinfo, unsigned int count, { 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 @@ -475,7 +475,7 @@ again: } 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)))) @@ -2381,8 +2381,11 @@ vect_make_slp_decision (loop_vec_info loop_vinfo) 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)); @@ -3181,7 +3184,7 @@ vect_slp_bb_region (gimple_stmt_iterator region_begin, vec_info_shared shared; - poly_uint64 autodetected_vector_size = 0; + machine_mode autodetected_vector_mode = VOIDmode; while (1) { bool vectorized = false; @@ -3194,7 +3197,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 = 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)) @@ -3208,7 +3211,7 @@ vect_slp_bb_region (gimple_stmt_iterator region_begin, 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); @@ -3222,18 +3225,18 @@ vect_slp_bb_region (gimple_stmt_iterator region_begin, } 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) diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 15c798d..43b2b0f 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -11226,11 +11226,10 @@ tree 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; } diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index 0f00383..d6de783 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -978,7 +978,7 @@ try_vectorize_loop_1 (hash_table<simduid_to_vf> *&simduid_to_vf_htab, 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 diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index a6ddaaf..f6efed1 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -335,9 +335,9 @@ public: /* 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); |