Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / offloading / fortran / target-map-declare-target-link-common-block.f90
blob47f50840befd3ee76c271c638181ebed420c138c
1 ! Offloading test checking interaction of
2 ! mapping a declare target link common
3 ! block with device_type any to a target
4 ! region
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 program main
15 implicit none
16 common /var_common/ var1, var2, var3
17 integer :: var1, var2, var3
18 !$omp declare target link(/var_common/)
20 call modify_1
22 !$omp target map(tofrom: var2)
23 var2 = var2 + var3
24 !$omp end target
26 call modify_2
27 call modify_3
29 print *, var1
30 print *, var2
31 print *, var3
32 end program
34 subroutine modify_1
35 common /var_common/ var1, var2, var3
36 integer :: var1, var2, var3
38 !$omp target map(tofrom: /var_common/)
39 var1 = 10
40 var2 = 20
41 var3 = 30
42 !$omp end target
44 end
46 subroutine modify_2
47 common /var_common/ var1, var2, var3
48 integer :: var1, var2, var3
49 integer :: copy
51 !$omp target map(tofrom: copy)
52 copy = var2 + var3
53 !$omp end target
55 print *, copy
56 end
58 subroutine modify_3
59 common /var_common/ var1, var2, var3
60 integer :: var1, var2, var3
62 !$omp target map(tofrom: /var_common/)
63 var1 = var1 + var1
64 var2 = var2 + var2
65 var3 = var3 + var3
66 !$omp end target
67 end
69 !CHECK: 80
70 !CHECK: 20
71 !CHECK: 100
72 !CHECK: 60