Commit 6b5e165b by Richard Biener Committed by Richard Biener

re PR tree-optimization/60510 (SLP blocks loop vectorization (with reduction))

2017-07-03  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/60510
	* tree-vect-loop.c (vect_create_epilog_for_reduction): Pass in
	the scalar reduction PHI and use it.
	(vectorizable_reduction): Properly guard the single_defuse_cycle
	path for non-SLP reduction chains where we cannot use it.
	Rework reduc_def/index and vector type deduction.  Rework
	vector operand gathering during reduction op code-gen.
	* tree-vect-slp.c (vect_analyze_slp): For failed SLP reduction
	chains dissolve the chain and leave it to non-SLP reduction
	handling.

	* gfortran.dg/vect/pr60510.f: New testcase.

From-SVN: r249919
parent 9607b014
2017-07-03 Richard Biener <rguenther@suse.de>
PR tree-optimization/60510
* tree-vect-loop.c (vect_create_epilog_for_reduction): Pass in
the scalar reduction PHI and use it.
(vectorizable_reduction): Properly guard the single_defuse_cycle
path for non-SLP reduction chains where we cannot use it.
Rework reduc_def/index and vector type deduction. Rework
vector operand gathering during reduction op code-gen.
* tree-vect-slp.c (vect_analyze_slp): For failed SLP reduction
chains dissolve the chain and leave it to non-SLP reduction
handling.
2017-07-03 Richard Sandiford <richard.sandiford@linaro.org>
* tree-data-ref.h (dr_alignment): Declare.
......
2017-07-03 Richard Biener <rguenther@suse.de>
PR tree-optimization/60510
* gfortran.dg/vect/pr60510.f: New testcase.
2017-07-03 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* gcc.target/i386/mvc6.c: Require ifunc support.
......
! { dg-do run }
! { dg-additional-options "-fno-inline -ffast-math" }
subroutine foo(a,x,y,n)
implicit none
integer n,i
real*8 y(n),x(n),a
do i=1,n
a=a+x(i)*y(i)+x(i)
enddo
return
end
program test
real*8 x(1024),y(1024),a
do i=1,1024
x(i) = i
y(i) = i+1
enddo
call foo(a,x,y,1024)
if (a.ne.359488000.0) call abort()
end
! If there's no longer a reduction chain detected this doesn't test what
! it was supposed to test, vectorizing a reduction chain w/o SLP.
! { dg-final { scan-tree-dump "reduction chain" "vect" } }
! We should vectorize the reduction in foo and the induction in test.
! { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } }
......@@ -2121,7 +2121,20 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size)
FOR_EACH_VEC_ELT (loop_vinfo->reduction_chains, i, first_element)
if (! vect_analyze_slp_instance (vinfo, first_element,
max_tree_size))
return false;
{
/* Dissolve reduction chain group. */
gimple *next, *stmt = first_element;
while (stmt)
{
stmt_vec_info vinfo = vinfo_for_stmt (stmt);
next = GROUP_NEXT_ELEMENT (vinfo);
GROUP_FIRST_ELEMENT (vinfo) = NULL;
GROUP_NEXT_ELEMENT (vinfo) = NULL;
stmt = next;
}
STMT_VINFO_DEF_TYPE (vinfo_for_stmt (first_element))
= vect_internal_def;
}
}
/* Find SLP sequences starting from groups of reductions. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment