From: Richard Sandiford <richard.sandiford@arm.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH 2/6] Split code out of vect_transform_slp_perm_load
Date: Thu, 25 Aug 2022 14:05:33 +0100 [thread overview]
Message-ID: <mpto7w8iici.fsf@arm.com> (raw)
In-Reply-To: <mptwnawiids.fsf@arm.com> (Richard Sandiford's message of "Thu, 25 Aug 2022 14:04:47 +0100")
Similarly to the previous vectorizable_slp_permutation patch,
this one splits out the main part of vect_transform_slp_perm_load
so that a later patch can test a permutation without constructing
a node for it.
Also fixes a lingering use of STMT_VINFO_VECTYPE.
gcc/
* tree-vect-slp.cc (vect_transform_slp_perm_load_1): Split out from...
(vect_transform_slp_perm_load): ...here. Use SLP_TREE_VECTYPE instead
of STMT_VINFO_VECTYPE.
---
gcc/tree-vect-slp.cc | 54 ++++++++++++++++++++++++++++++--------------
1 file changed, 37 insertions(+), 17 deletions(-)
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 13c242e5012..64b3379b530 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -6631,23 +6631,23 @@ vect_get_slp_defs (vec_info *,
}
}
-/* Generate vector permute statements from a list of loads in DR_CHAIN.
- If ANALYZE_ONLY is TRUE, only check that it is possible to create valid
- permute statements for the SLP node NODE. Store the number of vector
- permute instructions in *N_PERMS and the number of vector load
- instructions in *N_LOADS. If DCE_CHAIN is true, remove all definitions
- that were not needed. */
+/* A subroutine of vect_transform_slp_perm_load with two extra arguments:
+ - PERM gives the permutation that the caller wants to use for NODE,
+ which might be different from SLP_LOAD_PERMUTATION.
+ - DUMP_P controls whether the function dumps information. */
-bool
-vect_transform_slp_perm_load (vec_info *vinfo,
- slp_tree node, const vec<tree> &dr_chain,
- gimple_stmt_iterator *gsi, poly_uint64 vf,
- bool analyze_only, unsigned *n_perms,
- unsigned int *n_loads, bool dce_chain)
+static bool
+vect_transform_slp_perm_load_1 (vec_info *vinfo, slp_tree node,
+ load_permutation_t &perm,
+ const vec<tree> &dr_chain,
+ gimple_stmt_iterator *gsi, poly_uint64 vf,
+ bool analyze_only, bool dump_p,
+ unsigned *n_perms, unsigned int *n_loads,
+ bool dce_chain)
{
stmt_vec_info stmt_info = SLP_TREE_SCALAR_STMTS (node)[0];
int vec_index = 0;
- tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+ tree vectype = SLP_TREE_VECTYPE (node);
unsigned int group_size = SLP_TREE_SCALAR_STMTS (node).length ();
unsigned int mask_element;
machine_mode mode;
@@ -6732,8 +6732,7 @@ vect_transform_slp_perm_load (vec_info *vinfo,
{
unsigned int iter_num = j / group_size;
unsigned int stmt_num = j % group_size;
- unsigned int i = (iter_num * DR_GROUP_SIZE (stmt_info)
- + SLP_TREE_LOAD_PERMUTATION (node)[stmt_num]);
+ unsigned int i = (iter_num * DR_GROUP_SIZE (stmt_info) + perm[stmt_num]);
bitmap_set_bit (used_in_lanes, i);
if (repeating_p)
{
@@ -6759,7 +6758,7 @@ vect_transform_slp_perm_load (vec_info *vinfo,
}
else
{
- if (dump_enabled_p ())
+ if (dump_p)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"permutation requires at "
"least three vectors %G",
@@ -6780,7 +6779,7 @@ vect_transform_slp_perm_load (vec_info *vinfo,
indices.new_vector (mask, second_vec_index == -1 ? 1 : 2, nunits);
if (!can_vec_perm_const_p (mode, mode, indices))
{
- if (dump_enabled_p ())
+ if (dump_p)
{
dump_printf_loc (MSG_MISSED_OPTIMIZATION,
vect_location,
@@ -6896,6 +6895,27 @@ vect_transform_slp_perm_load (vec_info *vinfo,
return true;
}
+/* Generate vector permute statements from a list of loads in DR_CHAIN.
+ If ANALYZE_ONLY is TRUE, only check that it is possible to create valid
+ permute statements for the SLP node NODE. Store the number of vector
+ permute instructions in *N_PERMS and the number of vector load
+ instructions in *N_LOADS. If DCE_CHAIN is true, remove all definitions
+ that were not needed. */
+
+bool
+vect_transform_slp_perm_load (vec_info *vinfo,
+ slp_tree node, const vec<tree> &dr_chain,
+ gimple_stmt_iterator *gsi, poly_uint64 vf,
+ bool analyze_only, unsigned *n_perms,
+ unsigned int *n_loads, bool dce_chain)
+{
+ return vect_transform_slp_perm_load_1 (vinfo, node,
+ SLP_TREE_LOAD_PERMUTATION (node),
+ dr_chain, gsi, vf, analyze_only,
+ dump_enabled_p (), n_perms, n_loads,
+ dce_chain);
+}
+
/* Produce the next vector result for SLP permutation NODE by adding a vector
statement at GSI. If MASK_VEC is nonnull, add:
--
2.25.1
next prev parent reply other threads:[~2022-08-25 13:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 13:04 [PATCH 0/6] Optimise placement of SLP permutations Richard Sandiford
2022-08-25 13:05 ` [PATCH 1/6] Split code out of vectorizable_slp_permutation Richard Sandiford
2022-08-25 13:05 ` Richard Sandiford [this message]
2022-08-25 13:05 ` [PATCH 3/6] Make graphds_scc pass the node order back to callers Richard Sandiford
2022-08-25 13:06 ` [PATCH 4/6] Rearrange unbounded_hashmap_traits Richard Sandiford
2022-08-25 13:06 ` [PATCH 5/6] Add base hash traits for vectors Richard Sandiford
2022-08-25 13:07 ` [PATCH 6/6] Extend SLP permutation optimisations Richard Sandiford
2022-08-26 16:26 ` Jeff Law
2022-08-30 14:50 ` Richard Sandiford
2022-08-30 14:50 ` Richard Sandiford
2022-08-31 14:38 ` Jeff Law
2022-08-26 9:25 ` [PATCH 0/6] Optimise placement of SLP permutations Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mpto7w8iici.fsf@arm.com \
--to=richard.sandiford@arm.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).