Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / libomptarget / test / offloading / fortran / double-target-call-with-declare-target.f90
blobb4c793ca06cf798c14bc31c96dca05b24cce9737
1 ! Offloading test with two target regions mapping the same
2 ! declare target Fortran array and writing some values to
3 ! it before checking the host correctly receives the
4 ! correct updates made on the device.
5 ! REQUIRES: flang, amdgcn-amd-amdhsa
6 ! UNSUPPORTED: nvptx64-nvidia-cuda
7 ! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
8 ! UNSUPPORTED: aarch64-unknown-linux-gnu
9 ! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
10 ! UNSUPPORTED: x86_64-pc-linux-gnu
11 ! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
13 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
14 module test_0
15 implicit none
16 integer :: sp(10) = (/0,0,0,0,0,0,0,0,0,0/)
17 !$omp declare target link(sp)
18 end module test_0
20 program main
21 use test_0
22 integer :: i = 1
23 integer :: j = 11
25 !$omp target map(tofrom:sp) map(to: i, j)
26 do while (i <= j)
27 sp(i) = i;
28 i = i + 1
29 end do
30 !$omp end target
32 !$omp target map(tofrom:sp) map(to: i, j)
33 do while (i <= j)
34 sp(i) = sp(i) + i;
35 i = i + 1
36 end do
37 !$omp end target
39 print *, sp(:)
41 end program
43 ! CHECK: 2 4 6 8 10 12 14 16 18 20