aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorCesar Philippidis <cesar@codesourcery.com>2015-11-30 19:09:33 +0000
committerCesar Philippidis <cesar@codesourcery.com>2015-11-30 19:09:33 +0000
commit812d92912cc65e4c98ea2e9ff2b99c2f13fee259 (patch)
tree68145daf074ea8294cdb3c958aa8fd3af1344384 /libgomp
parent81499160435727e2d13275bce6640843fc421d5c (diff)
gcc/
* tree-nested.c (convert_nonlocal_omp_clauses): Add support for OMP_CLAUSE_{NUM_GANGS,NUM_VECTORS,VECTOR_LENGTH,SEQ}. (convert_local_omp_clauses): Likewise. gcc/fortran/ * f95-lang.c (gfc_attribute_table): Add an "oacc function" attribute. * gfortran.h (symbol_attribute): Add an oacc_function bit-field. (gfc_oacc_routine_name): New struct; (gfc_get_oacc_routine_name): New macro. (gfc_namespace): Add oacc_routine_clauses, oacc_routine_names and oacc_routine fields. (gfc_exec_op): Add EXEC_OACC_ROUTINE. * openmp.c (OACC_ROUTINE_CLAUSES): New mask. (gfc_oacc_routine_dims): New function. (gfc_match_oacc_routine): Add support for named routines and the gang, worker vector and seq clauses. * parse.c (is_oacc): Add EXEC_OACC_ROUTINE. * resolve.c (gfc_resolve_blocks): Likewise. * st.c (gfc_free_statement): Likewise. * trans-decl.c (add_attributes_to_decl): Attach an 'oacc function' attribute and shape geometry for acc routine. gcc/testsuite/ * gfortran.dg/goacc/routine-3.f90: New test. * gfortran.dg/goacc/routine-4.f90: New test. * gfortran.dg/goacc/routine-5.f90: New test. * gfortran.dg/goacc/routine-6.f90: New test. * gfortran.dg/goacc/subroutines: New test. libgomp/ * libgomp.oacc-fortran/routine-5.f90: New test. * libgomp.oacc-fortran/routine-7.f90: New test. * libgomp.oacc-fortran/routine-9.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@231081 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog8
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/routine-5.f9027
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/routine-7.f90121
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/routine-9.f9031
4 files changed, 187 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index ce2828a8301..cb8b10c9c32 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,11 @@
+2015-11-30 James Norris <jnorris@codesourcery.com>
+ Cesar Philippidis <cesar@codesourcery.com>
+
+ libgomp/
+ * libgomp.oacc-fortran/routine-5.f90: New test.
+ * libgomp.oacc-fortran/routine-7.f90: New test.
+ * libgomp.oacc-fortran/routine-9.f90: New test.
+
2015-11-30 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/46032
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/routine-5.f90 b/libgomp/testsuite/libgomp.oacc-fortran/routine-5.f90
new file mode 100644
index 00000000000..956da8ed043
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/routine-5.f90
@@ -0,0 +1,27 @@
+! { dg-do run }
+! { dg-options "-fno-inline" }
+
+program main
+ integer :: n
+
+ n = 5
+
+ !$acc parallel copy (n)
+ n = func (n)
+ !$acc end parallel
+
+ if (n .ne. 6) call abort
+
+contains
+
+ function func (n) result (rc)
+ !$acc routine
+ integer, intent (in) :: n
+ integer :: rc
+
+ rc = n
+ rc = rc + 1
+
+ end function
+
+end program
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/routine-7.f90 b/libgomp/testsuite/libgomp.oacc-fortran/routine-7.f90
new file mode 100644
index 00000000000..7fc81691bfb
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/routine-7.f90
@@ -0,0 +1,121 @@
+
+! { dg-do run }
+! { dg-additional-options "-cpp" }
+
+#define M 8
+#define N 32
+
+program main
+ integer :: i
+ integer :: a(N)
+ integer :: b(M * N)
+
+ do i = 1, N
+ a(i) = 0
+ end do
+
+ !$acc parallel copy (a)
+ !$acc loop seq
+ do i = 1, N
+ call seq (a)
+ end do
+ !$acc end parallel
+
+ do i = 1, N
+ if (a(i) .ne.N) call abort
+ end do
+
+ !$acc parallel copy (a)
+ !$acc loop seq
+ do i = 1, N
+ call gang (a)
+ end do
+ !$acc end parallel
+
+ do i = 1, N
+ if (a(i) .ne. (N + (N * (-1 * i)))) call abort
+ end do
+
+ do i = 1, N
+ b(i) = i
+ end do
+
+ !$acc parallel copy (b)
+ !$acc loop
+ do i = 1, N
+ call worker (b)
+ end do
+ !$acc end parallel
+
+ do i = 1, N
+ if (b(i) .ne. N + i) call abort
+ end do
+
+ do i = 1, N
+ a(i) = i
+ end do
+
+ !$acc parallel copy (a)
+ !$acc loop
+ do i = 1, N
+ call vector (a)
+ end do
+ !$acc end parallel
+
+ do i = 1, N
+ if (a(i) .ne. 0) call abort
+ end do
+
+contains
+
+subroutine vector (a)
+ !$acc routine vector
+ integer, intent (inout) :: a(N)
+ integer :: i
+
+ !$acc loop vector
+ do i = 1, N
+ a(i) = a(i) - a(i)
+ end do
+
+end subroutine vector
+
+subroutine worker (b)
+ !$acc routine worker
+ integer, intent (inout) :: b(M*N)
+ integer :: i, j
+
+ !$acc loop worker
+ do i = 1, N
+ !$acc loop vector
+ do j = 1, M
+ b(j + ((i - 1) * M)) = b(j + ((i - 1) * M)) + 1
+ end do
+ end do
+
+end subroutine worker
+
+subroutine gang (a)
+ !$acc routine gang
+ integer, intent (inout) :: a(N)
+ integer :: i
+
+ !$acc loop gang
+ do i = 1, N
+ a(i) = a(i) - i
+ end do
+
+end subroutine gang
+
+subroutine seq (a)
+ !$acc routine seq
+ integer, intent (inout) :: a(M)
+ integer :: i
+
+ do i = 1, N
+ a(i) = a(i) + 1
+ end do
+
+end subroutine seq
+
+end program main
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/routine-9.f90 b/libgomp/testsuite/libgomp.oacc-fortran/routine-9.f90
new file mode 100644
index 00000000000..95d1a1392d8
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/routine-9.f90
@@ -0,0 +1,31 @@
+! { dg-do run }
+! { dg-options "-fno-inline" }
+
+program main
+ implicit none
+ integer, parameter :: n = 10
+ integer :: a(n), i
+ integer, external :: fact
+ !$acc routine (fact)
+ !$acc parallel
+ !$acc loop
+ do i = 1, n
+ a(i) = fact (i)
+ end do
+ !$acc end parallel
+ do i = 1, n
+ if (a(i) .ne. fact(i)) call abort
+ end do
+end program main
+
+recursive function fact (x) result (res)
+ implicit none
+ !$acc routine (fact)
+ integer, intent(in) :: x
+ integer :: res
+ if (x < 1) then
+ res = 1
+ else
+ res = x * fact(x - 1)
+ end if
+end function fact