This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gomp4] New test loop independent clause
- From: James Norris <jnorris at codesourcery dot com>
- To: <gcc-patches at gcc dot gnu dot org>
- Cc: Thomas Schwinge <thomas at codesourcery dot com>
- Date: Tue, 14 Jul 2015 14:10:01 -0500
- Subject: [gomp4] New test loop independent clause
- Authentication-results: sourceware.org; auth=none
Hi,
The attached adds testing for the independent clause
with the loop directive in Fortran.
Committed to gomp-4_0-branch.
Jim
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-independent.f90 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-independent.f90
new file mode 100644
index 0000000..9f17308
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-independent.f90
@@ -0,0 +1,43 @@
+! { dg-do run } */
+! { dg-additional-options "-cpp" }
+! { dg-additional-options "-ftree-parallelize-loops=32" }
+
+#define N (1024 * 512)
+
+subroutine foo (a, b, c)
+ integer, parameter :: n = N
+ integer, dimension (n) :: a
+ integer, dimension (n) :: b
+ integer, dimension (n) :: c
+ integer i, ii
+
+ do i = 1, n
+ a(i) = i * 2;
+ end do
+
+ do i = 1, n
+ b(i) = i * 4;
+ end do
+
+ !$acc kernels copyin (a(1:n), b(1:n)) copyout (c(1:n))
+ !$acc loop independent
+ do ii = 1, n
+ c(ii) = a(ii) + b(ii)
+ end do
+ !$acc end kernels
+
+ do i = 1, n
+ if (c(i) .ne. a(i) + b(i)) call abort
+ end do
+
+end subroutine
+
+program main
+ integer, parameter :: n = N
+ integer :: a(n)
+ integer :: b(n)
+ integer :: c(n)
+
+ call foo (a, b, c)
+
+end program main