Message ID | patch-14327-tamar@arm.com |
---|---|
State | New |
Headers | show |
Series | slp: reject non-multiple of 2 laned SLP trees (PR99825) | expand |
On Tue, 30 Mar 2021, Tamar Christina wrote: > Hi Richi, > > 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. > > Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. > > Ok for master? OK. > Thanks, > Tamar > > 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. > > --- inline copy of patch -- > diff --git a/gcc/testsuite/gfortran.dg/vect/pr99825.f90 b/gcc/testsuite/gfortran.dg/vect/pr99825.f90 > new file mode 100644 > index 0000000000000000000000000000000000000000..b1423df32254e80dc2958b95083831173011afed > --- /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 cdd61e9a5cf0c5698fd94c29c6615d293ce4c41a..b25655c987698fcca684444377e3bc83ff7f3426 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}; > > >
diff --git a/gcc/testsuite/gfortran.dg/vect/pr99825.f90 b/gcc/testsuite/gfortran.dg/vect/pr99825.f90 new file mode 100644 index 0000000000000000000000000000000000000000..b1423df32254e80dc2958b95083831173011afed --- /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 cdd61e9a5cf0c5698fd94c29c6615d293ce4c41a..b25655c987698fcca684444377e3bc83ff7f3426 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};