summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/vect/pr60510.f
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/vect/pr60510.f')
-rw-r--r--gcc/testsuite/gfortran.dg/vect/pr60510.f30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/vect/pr60510.f b/gcc/testsuite/gfortran.dg/vect/pr60510.f
new file mode 100644
index 00000000000..5e2c085d761
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr60510.f
@@ -0,0 +1,30 @@
+! { dg-do run }
+! { dg-require-effective-target vect_double }
+! { 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" } }