[gcc(refs/vendors/vrull/heads/slp-improvements)] Implement the missing transformation for SLP rearrange_pattern 3
Philipp Tomsich
ptomsich@gcc.gnu.org
Wed Jan 17 19:15:22 GMT 2024
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
More information about the Gcc-cvs
mailing list