public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/vrull/heads/slp-improvements)] Implement the missing transformation for SLP rearrange_pattern 3
@ 2024-01-23 20:58 Philipp Tomsich
0 siblings, 0 replies; 2+ messages in thread
From: Philipp Tomsich @ 2024-01-23 20:58 UTC (permalink / raw)
To: gcc-cvs
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [gcc(refs/vendors/vrull/heads/slp-improvements)] Implement the missing transformation for SLP rearrange_pattern 3
@ 2024-01-17 19:15 Philipp Tomsich
0 siblings, 0 replies; 2+ messages in thread
From: Philipp Tomsich @ 2024-01-17 19:15 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:89f3268cde0fcd58f45311f4d28b3ea1ee13af8c
commit 89f3268cde0fcd58f45311f4d28b3ea1ee13af8c
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 f2ee40b25f9..4a9da25558a 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-23 20:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23 20:58 [gcc(refs/vendors/vrull/heads/slp-improvements)] Implement the missing transformation for SLP rearrange_pattern 3 Philipp Tomsich
-- strict thread matches above, loose matches on Subject: below --
2024-01-17 19:15 Philipp Tomsich
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).