summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/vect
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/vect')
-rw-r--r--gcc/testsuite/gfortran.dg/vect/pr60510.f30
-rw-r--r--gcc/testsuite/gfortran.dg/vect/pr61171.f15
2 files changed, 45 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" } }
diff --git a/gcc/testsuite/gfortran.dg/vect/pr61171.f b/gcc/testsuite/gfortran.dg/vect/pr61171.f
new file mode 100644
index 00000000000..f94b8f31283
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr61171.f
@@ -0,0 +1,15 @@
+! { dg-do compile }
+! { dg-additional-options "-Ofast" }
+ SUBROUTINE GAUBON(NV,PTS,PP)
+ IMPLICIT DOUBLE PRECISION(A-H,O-Z)
+ PARAMETER (MXSP=250)
+ DIMENSION PTS(3,10),PP(3)
+ COMMON /PCMPLY/ XE(MXSP),YE(MXSP),ZE(MXSP)
+ DATA PI/3.141592653589793D+00/
+ DATA ZERO/0.0D+00/
+ DO I = 1, NV
+ PP(1) = PP(1) + (PTS(1,I)-XE(NS))
+ PP(2) = PP(2) + (PTS(2,I)-YE(NS))
+ PP(3) = PP(3) + (PTS(3,I)-ZE(NS))
+ ENDDO
+ END