Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / libomptarget / test / offloading / fortran / basic-target-region-3D-array-section.f90
blobe3df7983e6b5c18e37d3f508af5f81d123954b9c
1 ! Basic offloading test of a regular array explicitly
2 ! passed within a target region
3 ! REQUIRES: flang, amdgcn-amd-amdhsa
4 ! UNSUPPORTED: nvptx64-nvidia-cuda
5 ! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
6 ! UNSUPPORTED: aarch64-unknown-linux-gnu
7 ! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
8 ! UNSUPPORTED: x86_64-pc-linux-gnu
9 ! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
11 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
12 program main
13 implicit none
14 integer :: inArray(3,3,3)
15 integer :: outArray(3,3,3)
16 integer :: i, j, k
17 integer :: j2 = 3, k2 = 3
19 do i = 1, 3
20 do j = 1, 3
21 do k = 1, 3
22 inArray(i, j, k) = 42
23 outArray(i, j, k) = 0
24 end do
25 end do
26 end do
28 j = 1
29 k = 1
30 !$omp target map(tofrom:inArray(1:3, 1:3, 2:2), outArray(1:3, 1:3, 1:3), j, k, j2, k2)
31 do while (j <= j2)
32 k = 1
33 do while (k <= k2)
34 outArray(k, j, 2) = inArray(k, j, 2)
35 k = k + 1
36 end do
37 j = j + 1
38 end do
39 !$omp end target
41 print *, outArray
43 end program
45 ! CHECK: 0 0 0 0 0 0 0 0 0 42 42 42 42 42 42 42 42 42 0 0 0 0 0 0 0 0 0