1 ! This test checks correct propagation of location information in OpenACC
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
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)
38 subroutine nested_acc_locations(arr1d
)
39 real, dimension(10) :: arr1d
42 !$acc data copy(arr1d)
46 arr1d(i
) = arr1d(i
) * 2
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)
66 subroutine runtime_directive()
69 !CHECK-LABEL: acc.init
70 !CHECK-SAME: loc("{{.*}}locations.f90":68:11)
73 !CHECK-LABEL: acc.shutdown
74 !CHECK-SAME: loc("{{.*}}locations.f90":72:11)
78 subroutine combined_directive_locations(arr
)
84 arr(i
) = arr(i
) * arr(i
)
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)
95 subroutine if_clause_expr_location(arr
)
99 !$acc parallel loop if(.true.)
101 arr(i
) = arr(i
) * arr(i
)
104 !CHECK: %{{.*}} = arith.constant true loc("{{.*}}locations.f90":99:25)
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)
114 subroutine atomic_read_loc()
121 !CHECK: acc.atomic.read {{.*}} loc("{{.*}}locations.f90":118:11)
123 subroutine atomic_capture_loc()
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)
142 subroutine atomic_update_loc()
148 ! CHECK: acc.atomic.update %{{.*}} : !fir.ref<i32> {
149 ! CHECK: ^bb0(%{{.*}}: i32 loc("{{.*}}locations.f90":142:3)):
150 ! CHECK: } loc("{{.*}}locations.f90":142:3)
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)