public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Philipp Tomsich <ptomsich@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/vrull/heads/slp-improvements)] Implement the missing transformation for SLP rearrange_pattern 3 Date: Tue, 23 Jan 2024 20:58:38 +0000 (GMT) [thread overview] Message-ID: <20240123205838.D3AA538582B8@sourceware.org> (raw) https://gcc.gnu.org/g:b27d9d5390f70e725d4394ed8d78b65b6ee4e144 commit b27d9d5390f70e725d4394ed8d78b65b6ee4e144 Author: Manolis Tsamis <manolis.tsamis@vrull.eu> Date: Wed Dec 13 11:31:45 2023 +0100 Implement the missing transformation for SLP rearrange_pattern 3 Ref #342 Diff: --- gcc/tree-vect-slp.cc | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index c1b7fb436e4..d0df50193dc 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -1880,7 +1880,7 @@ try_rearrange_oprnd_info (vec<slp_oprnd_info> &oprnds_info, unsigned group_size) dump_printf (MSG_NOTE, " pattern detected.\n"); } - if (pattern == 1) + if (pattern == 1 || pattern == 3) for (unsigned int j = 0; j < group_size; j += 4) { oprnds_info[0]->def_stmts[j+2] = oprnds_info[1]->def_stmts[j]; @@ -1900,9 +1900,6 @@ try_rearrange_oprnd_info (vec<slp_oprnd_info> &oprnds_info, unsigned group_size) oprnds_info[0]->def_stmts[j+3] = oprnds_info[1]->def_stmts[j+2]; oprnds_info[0]->ops[j+3] = oprnds_info[1]->ops[j+2]; } - else if (pattern == 3) - /* No need to handle that for now. */ - return 0; if (dump_enabled_p ()) { @@ -2763,14 +2760,14 @@ fail: SLP_TREE_CHILDREN (one).safe_splice (children); SLP_TREE_CHILDREN (two).safe_splice (children); + SLP_TREE_CODE (one) = VEC_PERM_EXPR; + SLP_TREE_CODE (two) = VEC_PERM_EXPR; + unsigned int h = group_size / 2; + SLP_TREE_REPRESENTATIVE (one) = stmts[0]; + SLP_TREE_REPRESENTATIVE (two) = stmts[h]; + if (rearrange_pattern == 1) { - SLP_TREE_CODE (one) = VEC_PERM_EXPR; - SLP_TREE_CODE (two) = VEC_PERM_EXPR; - unsigned int h = group_size / 2; - SLP_TREE_REPRESENTATIVE (one) = stmts[0]; - SLP_TREE_REPRESENTATIVE (two) = stmts[h]; - for (unsigned int j = 0; j < h; j += 2) { SLP_TREE_LANE_PERMUTATION(one).safe_push (std::make_pair (0, j)); @@ -2788,12 +2785,6 @@ fail: } else if (rearrange_pattern == 2) { - SLP_TREE_CODE (one) = VEC_PERM_EXPR; - SLP_TREE_CODE (two) = VEC_PERM_EXPR; - unsigned int h = group_size / 2; - SLP_TREE_REPRESENTATIVE (one) = stmts[0]; - SLP_TREE_REPRESENTATIVE (two) = stmts[h]; - for (unsigned int j = 0; j < h; j += 2) { SLP_TREE_LANE_PERMUTATION(one).safe_push (std::make_pair (0, j)); @@ -2809,6 +2800,23 @@ fail: SLP_TREE_LANE_PERMUTATION(two).safe_push (std::make_pair (0, h + j + 1)); } } + else if (rearrange_pattern == 3) + { + for (unsigned int j = 0; j < h; j += 2) + { + SLP_TREE_LANE_PERMUTATION(one).safe_push (std::make_pair (0, j)); + SLP_TREE_LANE_PERMUTATION(one).safe_push (std::make_pair (0, j + 1)); + SLP_TREE_LANE_PERMUTATION(one).safe_push (std::make_pair (0, j + 1)); + SLP_TREE_LANE_PERMUTATION(one).safe_push (std::make_pair (0, j)); + } + for (unsigned int j = 0; j < h; j += 2) + { + SLP_TREE_LANE_PERMUTATION(two).safe_push (std::make_pair (0, h + j)); + SLP_TREE_LANE_PERMUTATION(two).safe_push (std::make_pair (0, h + j + 1)); + SLP_TREE_LANE_PERMUTATION(two).safe_push (std::make_pair (0, h + j + 1)); + SLP_TREE_LANE_PERMUTATION(two).safe_push (std::make_pair (0, h + j)); + } + } slp_tree child; FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (two), i, child) @@ -2826,7 +2834,6 @@ fail: children.safe_splice(SLP_TREE_CHILDREN (node)); } - if (two_operators) { /* ??? We'd likely want to either cache in bst_map sth like
next reply other threads:[~2024-01-23 20:58 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-23 20:58 Philipp Tomsich [this message] -- strict thread matches above, loose matches on Subject: below -- 2024-01-17 19:15 Philipp Tomsich
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=20240123205838.D3AA538582B8@sourceware.org \ --to=ptomsich@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).