Debian Codegraph @

flang/test/Lower/OpenMP/declare-target-link-tarop-cap.f90

raw
1 !RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
2 !RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-is-device %s -o - | FileCheck %s
3 !RUN: bbc -emit-hlfir -fopenmp %s -o - | FileCheck %s
4 !RUN: bbc -emit-hlfir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s
5
6 program test_link
7
8 integer :: test_int = 1
9 !$omp declare target link(test_int)
10
11 integer :: test_array_1d(3) = (/1,2,3/)
12 !$omp declare target link(test_array_1d)
13
14 integer, pointer :: test_ptr1
15 !$omp declare target link(test_ptr1)
16
17 integer, target :: test_target = 1
18 !$omp declare target link(test_target)
19
20 integer, pointer :: test_ptr2
21 !$omp declare target link(test_ptr2)
22
23 !CHECK-DAG: {{%.*}} = omp.map.info var_ptr({{%.*}} : !fir.ref<i32>, i32) map_clauses(implicit, tofrom) capture(ByRef) -> !fir.ref<i32> {name = "test_int"}
24 !$omp target
25 test_int = test_int + 1
26 !$omp end target
27
28
29 !CHECK-DAG: {{%.*}} = omp.map.info var_ptr({{%.*}} : !fir.ref<!fir.array<3xi32>>, !fir.array<3xi32>) map_clauses(implicit, tofrom) capture(ByRef) bounds({{%.*}}) -> !fir.ref<!fir.array<3xi32>> {name = "test_array_1d"}
30 !$omp target
31 do i = 1,3
32 test_array_1d(i) = i * 2
33 end do
34 !$omp end target
35
36 allocate(test_ptr1)
37 test_ptr1 = 1
38 !CHECK-DAG: {{%.*}} = omp.map.info var_ptr({{%.*}} : !fir.ref<!fir.box<!fir.ptr<i32>>>, !fir.box<!fir.ptr<i32>>) map_clauses(implicit, tofrom) capture(ByRef) members({{%.*}} : !fir.llvm_ptr<!fir.ref<i32>>) -> !fir.ref<!fir.box<!fir.ptr<i32>>> {name = "test_ptr1"}
39 !$omp target
40 test_ptr1 = test_ptr1 + 1
41 !$omp end target
42
43 !CHECK-DAG: {{%.*}} = omp.map.info var_ptr({{%.*}} : !fir.ref<i32>, i32) map_clauses(implicit, tofrom) capture(ByRef) -> !fir.ref<i32> {name = "test_target"}
44 !$omp target
45 test_target = test_target + 1
46 !$omp end target
47
48
49 !CHECK-DAG: {{%.*}} = omp.map.info var_ptr({{%.*}} : !fir.ref<!fir.box<!fir.ptr<i32>>>, !fir.box<!fir.ptr<i32>>) map_clauses(implicit, tofrom) capture(ByRef) members({{%.*}} : !fir.llvm_ptr<!fir.ref<i32>>) -> !fir.ref<!fir.box<!fir.ptr<i32>>> {name = "test_ptr2"}
50 test_ptr2 => test_target
51 !$omp target
52 test_ptr2 = test_ptr2 + 1
53 !$omp end target
54
55 end