| 1 |
! { dg-require-effective-target vect_double } |
| 2 |
! { dg-require-effective-target vect_intdouble_cvt } |
| 3 |
! { dg-additional-options "-fno-inline -ffast-math" } |
| 4 |
subroutine foo(a,x,y,n) |
| 5 |
implicit none |
| 6 |
integer n,i |
| 7 |
|
| 8 |
real*8 y(n),x(n),a |
| 9 |
|
| 10 |
do i=1,n |
| 11 |
a=a+x(i)*y(i)+x(i) |
| 12 |
enddo |
| 13 |
|
| 14 |
return |
| 15 |
end |
| 16 |
|
| 17 |
program test |
| 18 |
real*8 x(1024),y(1024),a |
| 19 |
a = 0.0 |
| 20 |
do i=1,1024 |
| 21 |
x(i) = i |
| 22 |
y(i) = i+1 |
| 23 |
enddo |
| 24 |
call foo(a,x,y,1024) |
| 25 |
if (a.ne.359488000.0) STOP 1 |
| 26 |
end |
| 27 |
! If there's no longer a reduction chain detected this doesn't test what |
| 28 |
! it was supposed to test, vectorizing a reduction chain w/o SLP. |
| 29 |
! { dg-final { scan-tree-dump "reduction chain" "vect" } } |
| 30 |
! We should vectorize the reduction in foo and the induction in test. |
| 31 |
! { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } |