xref: /llvm-project/offload/test/offloading/fortran/target-nested-target-data.f90 (revision 372344995568cae076477a8b0e98fcdec7c49379)
1! Offloading test for target nested inside a target data region
2! REQUIRES: flang, amdgpu
3
4! RUN: %libomptarget-compile-fortran-run-and-check-generic
5program main
6   integer :: A(10), B(10), C(10)
7
8   do I = 1, 10
9      A(I) = 1
10      B(I) = 2
11   end do
12   !$omp target data map(to: A, B) map(alloc: C)
13   !$omp target map(from: C)
14   do I = 1, 10
15      C(I) = A(I) + B(I) ! assigns 3, A:1 + B:2
16   end do
17   !$omp end target
18   !$omp target update from(C) ! updates C device -> host
19   !$omp end target data
20
21   print *, C ! should be all 3's
22
23end program
24
25! CHECK: 3 3 3 3 3 3 3 3 3 3
26