public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/vrull/heads/slp-improvements)] Fix: Do not rearrange splat vectors in try_rearrange_oprnd_info
@ 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:59f31395f566db98e2d5fc3196155bf516523a7a

commit 59f31395f566db98e2d5fc3196155bf516523a7a
Author: Manolis Tsamis <manolis.tsamis@vrull.eu>
Date:   Wed Dec 6 14:34:50 2023 +0100

    Fix: Do not rearrange splat vectors in try_rearrange_oprnd_info
    
    Check that the vector elements taking part in a rearranged pattern
    (e.g. ABAB) are actually different. Otherwise a splat vector (AAAA)
    would be considered to fulfill any rearrangement pattern. We don't
    want to merge splat vectors together in a mixed node as that can both
    reduce performance and cause codegen issues.
    
    Ref #342

Diff:
---
 gcc/tree-vect-slp.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 724e53a4cfd..bb917e733df 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1842,15 +1842,18 @@ try_rearrange_oprnd_info (vec<slp_oprnd_info> &oprnds_info, unsigned group_size)
 	int cur_pattern = 0;
 	/* Check for an ABAB... pattern.  */
 	if ((oprnd_info->def_stmts[j] == oprnd_info->def_stmts[j + 2])
-	    && (oprnd_info->def_stmts[j + 1] == oprnd_info->def_stmts[j + 3]))
+	    && (oprnd_info->def_stmts[j + 1] == oprnd_info->def_stmts[j + 3])
+	    && (oprnd_info->def_stmts[j] != oprnd_info->def_stmts[j + 1]))
 	  cur_pattern = 1;
 	/* Check for an AABB... pattern.  */
 	else if ((oprnd_info->def_stmts[j] == oprnd_info->def_stmts[j + 1])
-		 && (oprnd_info->def_stmts[j + 2] == oprnd_info->def_stmts[j + 3]))
+		 && (oprnd_info->def_stmts[j + 2] == oprnd_info->def_stmts[j + 3])
+		 && (oprnd_info->def_stmts[j] != oprnd_info->def_stmts[j + 2]))
 	  cur_pattern = 2;
 	/* Check for an ABBA... pattern.  */
 	else if ((oprnd_info->def_stmts[j] == oprnd_info->def_stmts[j + 3])
-		 && (oprnd_info->def_stmts[j + 1] == oprnd_info->def_stmts[j + 2]))
+		 && (oprnd_info->def_stmts[j + 1] == oprnd_info->def_stmts[j + 2])
+		 && (oprnd_info->def_stmts[j] != oprnd_info->def_stmts[j + 1]))
 	  cur_pattern = 3;
 	/* Unrecognised pattern.  */
 	else

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

* [gcc(refs/vendors/vrull/heads/slp-improvements)] Fix: Do not rearrange splat vectors in try_rearrange_oprnd_info
@ 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:e6131c9e42d5bae8586341c60ca8cb0a26b595ca

commit e6131c9e42d5bae8586341c60ca8cb0a26b595ca
Author: Manolis Tsamis <manolis.tsamis@vrull.eu>
Date:   Wed Dec 6 14:34:50 2023 +0100

    Fix: Do not rearrange splat vectors in try_rearrange_oprnd_info
    
    Check that the vector elements taking part in a rearranged pattern
    (e.g. ABAB) are actually different. Otherwise a splat vector (AAAA)
    would be considered to fulfill any rearrangement pattern. We don't
    want to merge splat vectors together in a mixed node as that can both
    reduce performance and cause codegen issues.
    
    Ref #342

Diff:
---
 gcc/tree-vect-slp.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 8f2993b84f1..28defc56d29 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1842,15 +1842,18 @@ try_rearrange_oprnd_info (vec<slp_oprnd_info> &oprnds_info, unsigned group_size)
 	int cur_pattern = 0;
 	/* Check for an ABAB... pattern.  */
 	if ((oprnd_info->def_stmts[j] == oprnd_info->def_stmts[j + 2])
-	    && (oprnd_info->def_stmts[j + 1] == oprnd_info->def_stmts[j + 3]))
+	    && (oprnd_info->def_stmts[j + 1] == oprnd_info->def_stmts[j + 3])
+	    && (oprnd_info->def_stmts[j] != oprnd_info->def_stmts[j + 1]))
 	  cur_pattern = 1;
 	/* Check for an AABB... pattern.  */
 	else if ((oprnd_info->def_stmts[j] == oprnd_info->def_stmts[j + 1])
-		 && (oprnd_info->def_stmts[j + 2] == oprnd_info->def_stmts[j + 3]))
+		 && (oprnd_info->def_stmts[j + 2] == oprnd_info->def_stmts[j + 3])
+		 && (oprnd_info->def_stmts[j] != oprnd_info->def_stmts[j + 2]))
 	  cur_pattern = 2;
 	/* Check for an ABBA... pattern.  */
 	else if ((oprnd_info->def_stmts[j] == oprnd_info->def_stmts[j + 3])
-		 && (oprnd_info->def_stmts[j + 1] == oprnd_info->def_stmts[j + 2]))
+		 && (oprnd_info->def_stmts[j + 1] == oprnd_info->def_stmts[j + 2])
+		 && (oprnd_info->def_stmts[j] != oprnd_info->def_stmts[j + 1]))
 	  cur_pattern = 3;
 	/* Unrecognised pattern.  */
 	else

^ 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 rearrange splat vectors in try_rearrange_oprnd_info 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).