public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/vrull/heads/slp-improvements)] Fix: Do not create mixed operation SLP nodes when rearranging
@ 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:441e8bc477724c8be1b18132c9f39fe355daea79

commit 441e8bc477724c8be1b18132c9f39fe355daea79
Author: Manolis Tsamis <manolis.tsamis@vrull.eu>
Date:   Wed Dec 20 09:56:31 2023 +0100

    Fix: Do not create mixed operation SLP nodes when rearranging
    
    Ref #342

Diff:
---
 gcc/tree-vect-slp.cc | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 732affece3b..04184cab1cf 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1820,7 +1820,8 @@ vect_slp_build_two_operator_nodes (slp_tree perm, tree vectype,
   SLP_TREE_CHILDREN (perm).quick_push (child2);
 }
 
-enum slp_oprnd_pattern {
+enum slp_oprnd_pattern
+{
   SLP_OPRND_PATTERN_NONE,
   SLP_OPRND_PATTERN_ABAB,
   SLP_OPRND_PATTERN_AABB,
@@ -1837,11 +1838,24 @@ try_rearrange_oprnd_info (vec<slp_oprnd_info> &oprnds_info, unsigned group_size)
   if (oprnds_info.length() != 2 || group_size % 4 != 0)
     return SLP_OPRND_PATTERN_NONE;
 
+  enum tree_code code = oprnds_info[0]->def_stmts[0] ?
+    gimple_assign_rhs_code (oprnds_info[0]->def_stmts[0]->stmt)
+    : ERROR_MARK;
+
   FOR_EACH_VEC_ELT (oprnds_info, i, oprnd_info)
     for (unsigned int j = 0; j < group_size; j += 1)
-      if (!oprnd_info->def_stmts[j]
-	  || STMT_VINFO_DATA_REF (oprnd_info->def_stmts[j]))
-	return SLP_OPRND_PATTERN_NONE;
+      {
+	if (!oprnd_info->def_stmts[j]
+	    || STMT_VINFO_DATA_REF (oprnd_info->def_stmts[j]))
+	  return SLP_OPRND_PATTERN_NONE;
+	/* Don't mix different operations.  */
+	if (gimple_assign_rhs_code (oprnd_info->def_stmts[j]->stmt) != code)
+	  return SLP_OPRND_PATTERN_NONE;
+      }
+
+  if (gimple_assign_rhs_code (oprnds_info[0]->def_stmts[0]->stmt)
+      != gimple_assign_rhs_code (oprnds_info[1]->def_stmts[0]->stmt))
+    return SLP_OPRND_PATTERN_NONE;
 
   int pattern = SLP_OPRND_PATTERN_NONE;
   FOR_EACH_VEC_ELT (oprnds_info, i, oprnd_info)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gcc(refs/vendors/vrull/heads/slp-improvements)] Fix: Do not create mixed operation SLP nodes when rearranging
@ 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:5a4c75b62cdb21fa5c31efee626e35c6ff327d02

commit 5a4c75b62cdb21fa5c31efee626e35c6ff327d02
Author: Manolis Tsamis <manolis.tsamis@vrull.eu>
Date:   Wed Dec 20 09:56:31 2023 +0100

    Fix: Do not create mixed operation SLP nodes when rearranging
    
    Ref #342

Diff:
---
 gcc/tree-vect-slp.cc | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 81ccbaeab1c..704996afe7a 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1820,7 +1820,8 @@ vect_slp_build_two_operator_nodes (slp_tree perm, tree vectype,
   SLP_TREE_CHILDREN (perm).quick_push (child2);
 }
 
-enum slp_oprnd_pattern {
+enum slp_oprnd_pattern
+{
   SLP_OPRND_PATTERN_NONE,
   SLP_OPRND_PATTERN_ABAB,
   SLP_OPRND_PATTERN_AABB,
@@ -1837,11 +1838,24 @@ try_rearrange_oprnd_info (vec<slp_oprnd_info> &oprnds_info, unsigned group_size)
   if (oprnds_info.length() != 2 || group_size % 4 != 0)
     return SLP_OPRND_PATTERN_NONE;
 
+  enum tree_code code = oprnds_info[0]->def_stmts[0] ?
+    gimple_assign_rhs_code (oprnds_info[0]->def_stmts[0]->stmt)
+    : ERROR_MARK;
+
   FOR_EACH_VEC_ELT (oprnds_info, i, oprnd_info)
     for (unsigned int j = 0; j < group_size; j += 1)
-      if (!oprnd_info->def_stmts[j]
-	  || STMT_VINFO_DATA_REF (oprnd_info->def_stmts[j]))
-	return SLP_OPRND_PATTERN_NONE;
+      {
+	if (!oprnd_info->def_stmts[j]
+	    || STMT_VINFO_DATA_REF (oprnd_info->def_stmts[j]))
+	  return SLP_OPRND_PATTERN_NONE;
+	/* Don't mix different operations.  */
+	if (gimple_assign_rhs_code (oprnd_info->def_stmts[j]->stmt) != code)
+	  return SLP_OPRND_PATTERN_NONE;
+      }
+
+  if (gimple_assign_rhs_code (oprnds_info[0]->def_stmts[0]->stmt)
+      != gimple_assign_rhs_code (oprnds_info[1]->def_stmts[0]->stmt))
+    return SLP_OPRND_PATTERN_NONE;
 
   int pattern = SLP_OPRND_PATTERN_NONE;
   FOR_EACH_VEC_ELT (oprnds_info, i, oprnd_info)

^ 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)] Fix: Do not create mixed operation SLP nodes when rearranging 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).