[flang][openacc][NFC] Get rid of use-desc-for-alloc=false option in atomic tests...
[llvm-project.git] / flang / test / Lower / OpenACC / locations.f90
blob031d8eda48acdc9ac36ad6a0221e8b6c5de82665
1 ! This test checks correct propagation of location information in OpenACC
2 ! operations.
4 ! RUN: bbc -fopenacc -emit-fir --mlir-print-debuginfo --mlir-print-local-scope %s -o - | FileCheck %s
5 ! RUN: bbc -fopenacc -emit-hlfir --mlir-print-debuginfo --mlir-print-local-scope %s -o - | FileCheck %s
6 module acc_locations
7 implicit none
9 contains
11 subroutine standalone_data_directive_locations(arr)
12 real, dimension(10) :: arr
14 !$acc enter data create(arr)
15 !CHECK-LABEL: acc.enter_data
16 !CHECK-SAME: loc("{{.*}}locations.f90":14:11)
18 !$acc update device(arr)
19 !CHECK-LABEL: acc.update_device varPtr
20 !CHECK-SAME: loc("{{.*}}locations.f90":18:25)
21 !CHECK-LABEL: acc.update dataOperands
22 !CHECK-SAME: loc("{{.*}}locations.f90":18:11)
24 !$acc update host(arr)
25 !CHECK-LABEL: acc.getdeviceptr varPtr
26 !CHECK-SAME: loc("{{.*}}locations.f90":24:23)
27 !CHECK-LABEL: acc.update dataOperands
28 !CHECK-SAME: loc("{{.*}}locations.f90":24:11)
29 !CHECK-LABEL: acc.update_host
30 !CHECK-SAME: loc("{{.*}}locations.f90":24:23)
32 !$acc exit data delete(arr)
33 !CHECK-LABEL: acc.exit_data
34 !CHECK-SAME: loc("{{.*}}locations.f90":32:11)
36 end subroutine
38 subroutine nested_acc_locations(arr1d)
39 real, dimension(10) :: arr1d
40 integer :: i
42 !$acc data copy(arr1d)
43 !$acc parallel
44 !$acc loop
45 do i = 1, 10
46 arr1d(i) = arr1d(i) * 2
47 end do
48 !$acc end parallel
49 !$acc end data
51 !CHECK: acc.data
52 !CHECK: acc.parallel
53 !CHECK: acc.loop
55 !CHECK: acc.yield loc("{{.*}}locations.f90":44:11)
56 !CHECK-NEXT: } loc("{{.*}}locations.f90":44:11)
58 !CHECK: acc.yield loc("{{.*}}locations.f90":43:11)
59 !CHECK-NEXT: } loc("{{.*}}locations.f90":43:11)
61 !CHECK-NEXT: acc.terminator loc("{{.*}}locations.f90":42:11)
62 !CHECK-NEXT: } loc("{{.*}}locations.f90":42:11)
64 end subroutine
66 subroutine runtime_directive()
68 !$acc init
69 !CHECK-LABEL: acc.init
70 !CHECK-SAME: loc("{{.*}}locations.f90":68:11)
72 !$acc shutdown
73 !CHECK-LABEL: acc.shutdown
74 !CHECK-SAME: loc("{{.*}}locations.f90":72:11)
76 end subroutine
78 subroutine combined_directive_locations(arr)
79 real :: arr(:)
80 integer :: i
82 !$acc parallel loop
83 do i = 1, size(arr)
84 arr(i) = arr(i) * arr(i)
85 end do
87 !CHECK: acc.parallel
88 !CHECK: acc.loop
89 !CHECK: acc.yield loc("{{.*}}locations.f90":82:11)
90 !CHECK-NEXT: } loc("{{.*}}locations.f90":82:11)
91 !CHECK: acc.yield loc("{{.*}}locations.f90":82:11)
92 !CHECK-NEXT: } loc("{{.*}}locations.f90":82:11)
93 end subroutine
95 subroutine if_clause_expr_location(arr)
96 real :: arr(:)
97 integer :: i
99 !$acc parallel loop if(.true.)
100 do i = 1, size(arr)
101 arr(i) = arr(i) * arr(i)
102 end do
104 !CHECK: %{{.*}} = arith.constant true loc("{{.*}}locations.f90":99:25)
106 !CHECK: acc.parallel
107 !CHECK: acc.loop
108 !CHECK: acc.yield loc("{{.*}}locations.f90":99:11)
109 !CHECK-NEXT: } loc("{{.*}}locations.f90":99:11)
110 !CHECK: acc.yield loc("{{.*}}locations.f90":99:11)
111 !CHECK-NEXT: } loc("{{.*}}locations.f90":99:11)
112 end subroutine
114 subroutine atomic_read_loc()
115 integer(4) :: x
116 integer(8) :: y
118 !$acc atomic read
119 y = x
121 !CHECK: acc.atomic.read {{.*}} loc("{{.*}}locations.f90":118:11)
123 subroutine atomic_capture_loc()
124 implicit none
125 integer :: k, v, i
127 k = 1
128 v = 0
130 !$acc atomic capture
131 v = k
132 k = (i + 1) * 3.14
133 !$acc end atomic
135 ! CHECK: acc.atomic.capture {
136 ! CHECK: acc.atomic.read {{.*}} loc("{{.*}}locations.f90":130:11)
137 ! CHECK: acc.atomic.write {{.*}} loc("{{.*}}locations.f90":130:11)
138 ! CHECK: } loc("{{.*}}locations.f90":130:11)
140 end subroutine
142 subroutine atomic_update_loc()
143 implicit none
144 integer :: x, y, z
146 !$acc atomic
147 y = y + 1
148 ! CHECK: acc.atomic.update %{{.*}} : !fir.ref<i32> {
149 ! CHECK: ^bb0(%{{.*}}: i32 loc("{{.*}}locations.f90":142:3)):
150 ! CHECK: } loc("{{.*}}locations.f90":142:3)
152 !$acc atomic update
153 z = x * z
155 ! %3 = fir.load %0 : !fir.ref<i32> loc("/local/home/vclement/llvm-project/flang/test/Lower/OpenACC/locations.f90":142:3)
156 ! acc.atomic.update %2 : !fir.ref<i32> {
157 ! ^bb0(%arg0: i32 loc("/local/home/vclement/llvm-project/flang/test/Lower/OpenACC/locations.f90":142:3)):
158 ! %4 = arith.muli %3, %arg0 : i32 loc("/local/home/vclement/llvm-project/flang/test/Lower/OpenACC/locations.f90":142:3)
159 ! acc.yield %4 : i32 loc("/local/home/vclement/llvm-project/flang/test/Lower/OpenACC/locations.f90":142:3)
160 ! } loc("/local/home/vclement/llvm-project/flang/test/Lower/OpenACC/locations.f90":142:3)
161 end subroutine
164 end module