public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-7909] slp: reject non-multiple of 2 laned SLP trees (PR99825)
@ 2021-03-30 13:17 Tamar Christina
  0 siblings, 0 replies; only message in thread
From: Tamar Christina @ 2021-03-30 13:17 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:9c68e2abe294a48385224cd7617eca0720144b5c

commit r11-7909-g9c68e2abe294a48385224cd7617eca0720144b5c
Author: Tamar Christina <tamar.christina@arm.com>
Date:   Tue Mar 30 14:16:03 2021 +0100

    slp: reject non-multiple of 2 laned SLP trees (PR99825)
    
    TWO_OPERANDS allows any order or number of combinations of + and - operations
    but the pattern matcher only supports pairs of operations.
    
    This patch has the pattern matcher for complex numbers reject SLP trees where
    the lanes are not a multiple of 2.
    
    gcc/ChangeLog:
    
            PR tree-optimization/99825
            * tree-vect-slp-patterns.c (vect_check_evenodd_blend):
            Reject non-mult 2 lanes.
    
    gcc/testsuite/ChangeLog:
    
            PR tree-optimization/99825
            * gfortran.dg/vect/pr99825.f90: New test.

Diff:
---
 gcc/testsuite/gfortran.dg/vect/pr99825.f90 | 15 +++++++++++++++
 gcc/tree-vect-slp-patterns.c               |  3 ++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gfortran.dg/vect/pr99825.f90 b/gcc/testsuite/gfortran.dg/vect/pr99825.f90
new file mode 100644
index 00000000000..b1423df3225
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr99825.f90
@@ -0,0 +1,15 @@
+! { dg-do compile }
+! { dg-additional-options "-march=armv8.3-a -O3" { target { aarch64*-*-* } } }
+
+program main
+  complex, dimension(3, 2) :: a
+  complex, dimension(2, 4) :: b
+  complex, dimension(3, 4) :: c, res1
+
+  data a /0, (-5., -7.), (11., -13.), 0, 0, 0/
+  data b /0, 0, 0, 0, 0, 0, 0, 0/
+  data res1 /0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0/
+
+  c = matmul(a, conjg(b))
+  if (any(res1 /= c)) stop 2
+end program main
diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c
index cdd61e9a5cf..b25655c9876 100644
--- a/gcc/tree-vect-slp-patterns.c
+++ b/gcc/tree-vect-slp-patterns.c
@@ -332,7 +332,8 @@ static inline bool
 vect_check_evenodd_blend (lane_permutation_t &permutes,
 			 unsigned even, unsigned odd)
 {
-  if (permutes.length () == 0)
+  if (permutes.length () == 0
+      || permutes.length () % 2 != 0)
     return false;
 
   unsigned val[2] = {even, odd};


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-30 13:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 13:17 [gcc r11-7909] slp: reject non-multiple of 2 laned SLP trees (PR99825) Tamar Christina

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).