|
1 | 1 | ! This test checks lowering of OpenACC host_data directive.
|
2 | 2 |
|
3 |
| -! RUN: bbc -fopenacc -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes=CHECK,FIR |
4 |
| -! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR |
| 3 | +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s |
5 | 4 |
|
6 | 5 | subroutine acc_host_data()
|
7 | 6 | real, dimension(10) :: a
|
8 | 7 | logical :: ifCondition = .TRUE.
|
9 | 8 |
|
10 | 9 | ! CHECK: %[[A:.*]] = fir.alloca !fir.array<10xf32> {bindc_name = "a", uniq_name = "_QFacc_host_dataEa"}
|
11 |
| -! HLFIR: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] |
| 10 | +! CHECK: %[[DECLA:.*]]:2 = hlfir.declare %[[A]] |
12 | 11 | ! CHECK: %[[IFCOND:.*]] = fir.address_of(@_QFacc_host_dataEifcondition) : !fir.ref<!fir.logical<4>>
|
13 |
| -! HLFIR: %[[DECLIFCOND:.*]]:2 = hlfir.declare %[[IFCOND]] |
| 12 | +! CHECK: %[[DECLIFCOND:.*]]:2 = hlfir.declare %[[IFCOND]] |
14 | 13 |
|
15 | 14 | !$acc host_data use_device(a)
|
16 | 15 | !$acc end host_data
|
17 | 16 |
|
18 | 17 | ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%{{.*}} : index) startIdx(%{{.*}} : index)
|
19 |
| -! FIR: %[[DA:.*]] = acc.use_device varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "a"} |
20 |
| -! HLFIR: %[[DA:.*]] = acc.use_device varPtr(%[[DECLA]]#1 : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "a"} |
| 18 | +! CHECK: %[[DA:.*]] = acc.use_device varPtr(%[[DECLA]]#1 : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "a"} |
21 | 19 | ! CHECK: acc.host_data dataOperands(%[[DA]] : !fir.ref<!fir.array<10xf32>>)
|
22 | 20 |
|
23 | 21 | !$acc host_data use_device(a) if_present
|
24 | 22 | !$acc end host_data
|
25 | 23 |
|
26 | 24 | ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%{{.*}} : index) startIdx(%{{.*}} : index)
|
27 |
| -! FIR: %[[DA:.*]] = acc.use_device varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "a"} |
28 |
| -! HLFIR: %[[DA:.*]] = acc.use_device varPtr(%[[DECLA]]#1 : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "a"} |
| 25 | +! CHECK: %[[DA:.*]] = acc.use_device varPtr(%[[DECLA]]#1 : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "a"} |
29 | 26 | ! CHECK: acc.host_data dataOperands(%[[DA]] : !fir.ref<!fir.array<10xf32>>) {
|
30 | 27 | ! CHECK: } attributes {ifPresent}
|
31 | 28 |
|
32 | 29 | !$acc host_data use_device(a) if(ifCondition)
|
33 | 30 | !$acc end host_data
|
34 | 31 |
|
35 | 32 | ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%{{.*}} : index) startIdx(%{{.*}} : index)
|
36 |
| -! FIR: %[[DA:.*]] = acc.use_device varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "a"} |
37 |
| -! HLFIR: %[[DA:.*]] = acc.use_device varPtr(%[[DECLA]]#1 : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "a"} |
38 |
| -! FIR: %[[LOAD_IFCOND:.*]] = fir.load %[[IFCOND]] : !fir.ref<!fir.logical<4>> |
39 |
| -! HLFIR: %[[LOAD_IFCOND:.*]] = fir.load %[[DECLIFCOND]]#0 : !fir.ref<!fir.logical<4>> |
| 33 | +! CHECK: %[[DA:.*]] = acc.use_device varPtr(%[[DECLA]]#1 : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "a"} |
| 34 | +! CHECK: %[[LOAD_IFCOND:.*]] = fir.load %[[DECLIFCOND]]#0 : !fir.ref<!fir.logical<4>> |
40 | 35 | ! CHECK: %[[IFCOND_I1:.*]] = fir.convert %[[LOAD_IFCOND]] : (!fir.logical<4>) -> i1
|
41 | 36 | ! CHECK: acc.host_data if(%[[IFCOND_I1]]) dataOperands(%[[DA]] : !fir.ref<!fir.array<10xf32>>)
|
42 | 37 |
|
43 | 38 | !$acc host_data use_device(a) if(.true.)
|
44 | 39 | !$acc end host_data
|
45 | 40 |
|
46 | 41 | ! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%{{.*}} : index) startIdx(%{{.*}} : index)
|
47 |
| -! FIR: %[[DA:.*]] = acc.use_device varPtr(%[[A]] : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "a"} |
48 |
| -! HLFIR: %[[DA:.*]] = acc.use_device varPtr(%[[DECLA]]#1 : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "a"} |
| 42 | +! CHECK: %[[DA:.*]] = acc.use_device varPtr(%[[DECLA]]#1 : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "a"} |
49 | 43 | ! CHECK: acc.host_data dataOperands(%[[DA]] : !fir.ref<!fir.array<10xf32>>)
|
50 | 44 |
|
51 | 45 | !$acc host_data use_device(a) if(.false.)
|
52 | 46 | a = 1.0
|
53 | 47 | !$acc end host_data
|
54 | 48 |
|
55 | 49 | ! CHECK-NOT: acc.host_data
|
56 |
| -! FIR: fir.do_loop |
57 |
| -! HLFIR: hlfir.assign %{{.*}} to %[[DECLA]]#0 |
| 50 | +! CHECK: hlfir.assign %{{.*}} to %[[DECLA]]#0 |
58 | 51 |
|
59 | 52 | end subroutine
|
0 commit comments