diff options
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 5 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.oacc-c-c++-common/combdir-1.c | 52 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.oacc-fortran/combdir-1.f90 | 37 |
3 files changed, 94 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index afc49ae164c..ca34af8203c 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2015-10-27 James Norris <jnorris@codesourcery.com> + + * testsuite/libgomp.oacc-c-c++-common/combdir-1.c: New file. + * testsuite/libgomp.oacc-fortran/combdir-1.f90: Likewise. + 2015-10-26 Thomas Schwinge <thomas@codesourcery.com> * testsuite/libgomp.oacc-c-c++-common/abort-1.c: Print to stderr. diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/combdir-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/combdir-1.c new file mode 100644 index 00000000000..a7def920b94 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/combdir-1.c @@ -0,0 +1,52 @@ +/* { dg-do run } */ + +#include <stdlib.h> + +int +main (int argc, char **argv) +{ + const int N = 32; + float a[N], b[N]; + int i; + + for (i = 0; i < N; i++) + { + a[i] = 1.0; + b[i] = 0.0; + } + +#pragma acc parallel loop copy (a[0:N]) copy (b[0:N]) + for (i = 0; i < N; i++) + { + b[i] = 2.0; + a[i] = a[i] + b[i]; + } + + for (i = 0; i < N; i++) + { + if (a[i] != 3.0) + abort (); + + if (b[i] != 2.0) + abort (); + } + +#pragma acc kernels loop copy (a[0:N]) copy (b[0:N]) + for (i = 0; i < N; i++) + { + b[i] = 3.0; + a[i] = a[i] + b[i]; + } + + for (i = 0; i < N; i++) + { + if (a[i] != 6.0) + abort (); + + if (b[i] != 3.0) + abort (); + } + + return 0; + +} diff --git a/libgomp/testsuite/libgomp.oacc-fortran/combdir-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/combdir-1.f90 new file mode 100644 index 00000000000..0cd8a670abb --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/combdir-1.f90 @@ -0,0 +1,37 @@ +! { dg-do run } + +program main + integer, parameter :: n = 32 + real :: a(n), b(n); + integer :: i + + do i = 1, n + a(i) = 1.0 + b(i) = 0.0 + end do + + !$acc parallel loop copy (a(1:n)) copy (b(1:n)) + do i = 1, n + b(i) = 2.0 + a(i) = a(i) + b(i) + end do + + do i = 1, n + if (a(i) .ne. 3.0) call abort + + if (b(i) .ne. 2.0) call abort + end do + + !$acc kernels loop copy (a(1:n)) copy (b(1:n)) + do i = 1, n + b(i) = 3.0; + a(i) = a(i) + b(i) + end do + + do i = 1, n + if (a(i) .ne. 6.0) call abort + + if (b(i) .ne. 3.0) call abort + end do + +end program main |