diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-09-14 16:30:36 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-09-14 16:30:36 +0000 |
commit | e8f142e28262a5048c6f40f4bfb6a612d3da55f0 (patch) | |
tree | be4373fc3725870e0d59bf2eddb56c9874962e4d /gcc/tree-vect-data-refs.c | |
parent | dccf43aed37281a7bb91a7984a75470ad62eb0f1 (diff) | |
download | gcc-e8f142e28262a5048c6f40f4bfb6a612d3da55f0.zip gcc-e8f142e28262a5048c6f40f4bfb6a612d3da55f0.tar.gz gcc-e8f142e28262a5048c6f40f4bfb6a612d3da55f0.tar.bz2 |
Add a vect_get_num_copies helper routine
This patch adds a vectoriser helper routine to calculate how
many copies of a vector statement we need. At present this
is always:
LOOP_VINFO_VECT_FACTOR (loop_vinfo) / TYPE_VECTOR_SUBPARTS (vectype)
but later patches add other cases. Another benefit of using
a helper routine is that it can assert that the division is
exact (which it must be).
2017-09-14 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* tree-vectorizer.h (vect_get_num_copies): New function.
* tree-vect-data-refs.c (vect_get_data_access_cost): Use it.
* tree-vect-loop.c (vectorizable_reduction): Likewise.
(vectorizable_induction): Likewise.
(vectorizable_live_operation): Likewise.
* tree-vect-stmts.c (vectorizable_mask_load_store): Likewise.
(vectorizable_bswap): Likewise.
(vectorizable_call): Likewise.
(vectorizable_conversion): Likewise.
(vectorizable_assignment): Likewise.
(vectorizable_shift): Likewise.
(vectorizable_operation): Likewise.
(vectorizable_store): Likewise.
(vectorizable_load): Likewise.
(vectorizable_condition): Likewise.
(vectorizable_comparison): Likewise.
(vect_analyze_stmt): Pass the slp node to vectorizable_live_operation.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r252764
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r-- | gcc/tree-vect-data-refs.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 0b3b968..a696979 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -1181,10 +1181,13 @@ vect_get_data_access_cost (struct data_reference *dr, { gimple *stmt = DR_STMT (dr); stmt_vec_info stmt_info = vinfo_for_stmt (stmt); - int nunits = TYPE_VECTOR_SUBPARTS (STMT_VINFO_VECTYPE (stmt_info)); loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); - int vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo); - int ncopies = MAX (1, vf / nunits); /* TODO: Handle SLP properly */ + int ncopies; + + if (PURE_SLP_STMT (stmt_info)) + ncopies = 1; + else + ncopies = vect_get_num_copies (loop_vinfo, STMT_VINFO_VECTYPE (stmt_info)); if (DR_IS_READ (dr)) vect_get_load_cost (dr, ncopies, true, inside_cost, outside_cost, |