tree-optimization/99746 - avoid confusing hybrid code

This avoids confusing the hybrid vectorization code with SLP
patterns by not marking SLP pattern covered stmts as patterns
(they are marked as SLP patterns already).  This means that loop
vectorization will vectorize the scalar stmt rather than the SLP
pattern stmt (which it can't anyway).

2021-03-24  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/99746
	* tree-vect-slp-patterns.c (complex_pattern::build): Do not mark
	the scalar stmt as patterned.  Instead set up required things
	manually.

	* gfortran.dg/vect/pr99746.f90: New testcase.
This commit is contained in:
Richard Biener 2021-03-24 12:55:16 +01:00
parent 08103e4d6a
commit a29124d282
2 changed files with 47 additions and 8 deletions

View file

@ -0,0 +1,45 @@
! { dg-do compile }
! { dg-additional-options "-march=armv8.3-a" { target aarch64-*-* } }
SUBROUTINE CLAREF(A, WANTZ, Z, ICOL1, ITMP1, ITMP2, T1, T2, V2)
LOGICAL BLOCK, WANTZ
COMPLEX T1, T2, V2
COMPLEX A(LDA, *), VECS, Z(LDA, *)
COMPLEX SUM
LOGICAL LSAME
IF (LSAME) THEN
DO 30 K = ITMP1, ITMP2, 3
T1 = VECS0
30 CONTINUE
ELSE
IF (BLOCK) THEN
DO 90 K = ITMP1, ITMP2 - 1, 3
A(J, ICOL1) = ITMP1
IF (WANTZ) THEN
DO 80 J = ITMP1, ITMP2
SUM = ICOL1
Z(J, 3) = V23
80 CONTINUE
END IF
90 CONTINUE
DO 120 K = ITMP1, ITMP2
V2 = VECS()
DO 100 J = ITMP1, ITMP2
A(J, ICOL1) = A(J, ICOL1) - SUM
100 CONTINUE
IF (WANTZ) THEN
DO 110 J = 1, 3
SUM = Z(J, ICOL1)
Z(J, ICOL1) = 0
110 CONTINUE
END IF
ICOL1 = ICOL1 + 1
120 CONTINUE
ELSE
DO 130 J = ITMP1, ITMP2
SUM = T1 * A(J, ICOL1) + T2 * A(J, 1) + V2 * A(J, 2)
A(J, ICOL1) = SUM
A(J, ICOL1 + 2) = SUM * V1
130 CONTINUE
END IF
END IF
END

View file

@ -571,14 +571,8 @@ complex_pattern::build (vec_info *vinfo)
STMT_VINFO_RELEVANT (call_stmt_info) = vect_used_in_scope;
STMT_SLP_TYPE (call_stmt_info) = pure_slp;
/* add_pattern_stmt can't be done in vect_mark_pattern_stmts because
the non-SLP pattern matchers already have added the statement to VINFO
by the time it is called. Some of them need to modify the returned
stmt_info. vect_mark_pattern_stmts is called by recog_pattern and it
would increase the size of each pattern with boilerplate code to make
the call there. */
vect_mark_pattern_stmts (vinfo, stmt_info, call_stmt,
SLP_TREE_VECTYPE (node));
gimple_set_bb (call_stmt, gimple_bb (stmt_info->stmt));
STMT_VINFO_VECTYPE (call_stmt_info) = SLP_TREE_VECTYPE (node);
STMT_VINFO_SLP_VECT_ONLY_PATTERN (call_stmt_info) = true;
/* Since we are replacing all the statements in the group with the same