diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2023-01-27 11:32:19 +0100 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2023-01-27 11:33:46 +0100 |
commit | 2325c8920bbc99edcc9fffaa79577c528df41eb8 (patch) | |
tree | c3a8d2d90e6f1b4aa998ce5b5401da5783ee157f /libgomp | |
parent | 16f30680f403891556da2ad6329fcef9dc9b47db (diff) | |
download | gcc-2325c8920bbc99edcc9fffaa79577c528df41eb8.zip gcc-2325c8920bbc99edcc9fffaa79577c528df41eb8.tar.gz gcc-2325c8920bbc99edcc9fffaa79577c528df41eb8.tar.bz2 |
OpenMP/Fortran: Fix has_device_addr clause splitting [PR108558]
gcc/fortran/ChangeLog:
PR fortran/108558
* trans-openmp.cc (gfc_split_omp_clauses): Handle has_device_addr.
libgomp/ChangeLog:
PR fortran/108558
* testsuite/libgomp.fortran/has_device_addr.f90: New test.
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/testsuite/libgomp.fortran/has_device_addr.f90 | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.fortran/has_device_addr.f90 b/libgomp/testsuite/libgomp.fortran/has_device_addr.f90 new file mode 100644 index 0000000..95cc778 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/has_device_addr.f90 @@ -0,0 +1,59 @@ +! { dg-additional-options "-fdump-tree-original" } + +! +! PR fortran/108558 +! + +! { dg-final { scan-tree-dump-times "#pragma omp target has_device_addr\\(x\\) has_device_addr\\(y\\)" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(tofrom:x\\) map\\(tofrom:y\\)" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target data use_device_addr\\(x\\) use_device_addr\\(y\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target update from\\(y\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(tofrom:x\\) map\\(tofrom:y\\) use_device_addr\\(x\\) use_device_addr\\(y\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp teams" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp distribute" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp parallel" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp for nowait" 2 "original" } } + +module m +contains +subroutine vectorAdd(x, y, N) + implicit none + integer :: N + integer(4) :: x(N), y(N) + integer :: i + + !$omp target teams distribute parallel do has_device_addr(x, y) + do i = 1, N + y(i) = x(i) + y(i) + end do +end subroutine vectorAdd +end module m + +program main + use m + implicit none + integer, parameter :: N = 9876 + integer(4) :: x(N), y(N) + integer :: i + + x(:) = 1 + y(:) = 2 + + !$omp target data map(x, y) + !$omp target data use_device_addr(x, y) + call vectorAdd(x, y, N) + !$omp end target data + !$omp target update from(y) + if (any (y /= 3)) error stop + !$omp end target data + + x = 1 + y = 2 + !$omp target data map(x, y) use_device_addr(x, y) + !$omp target teams distribute parallel do has_device_addr(x, y) + do i = 1, N + y(i) = x(i) + y(i) + end do + !$omp end target data + if (any (y /= 3)) error stop +end program |