1
- ! This test checks lowering of `FIRSTPRIVATE ` clause for scalar types.
1
+ ! This test checks lowering of `LASTPRIVATE ` clause for scalar types.
2
2
3
3
! RUN: bbc -fopenmp -emit-fir %s -o - | FileCheck %s
4
4
! RUN: flang-new -fc1 -fopenmp -emit-fir %s -o - | FileCheck %s
24
24
! CHECK-NEXT: %[[CALL_END_IO:.*]] = fir.call @_FortranAioEndIoStatement(%[[CALL_BEGIN_IO]])
25
25
26
26
! Testing last iteration check
27
- ! CHECK-NEXT: %[[IV_CMP:.*]] = arith.cmpi eq, %[[INDX_WS]]
27
+ ! CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32
28
+ ! CHECK: %[[C0:.*]] = arith.constant 0 : i32
29
+ ! CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32
30
+ ! CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32
31
+ ! CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32
32
+ ! CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1
28
33
! CHECK: fir.if %[[IV_CMP]] {
34
+ ! CHECK: fir.store %[[V]] to %{{.*}} : !fir.ref<i32>
29
35
30
36
! Testing lastprivate val update
31
37
! CHECK-DAG: %[[CVT:.*]] = fir.convert %[[ARG1_REF]] : (!fir.ref<!fir.char<1,5>>) -> !fir.ref<i8>
@@ -52,8 +58,14 @@ subroutine lastprivate_character(arg1)
52
58
! CHECK: omp.wsloop for (%[[INDX_WS:.*]]) : {{.*}} {
53
59
54
60
! Testing last iteration check
55
- ! CHECK-DAG: %[[IV_CMP:.*]] = arith.cmpi eq, %[[INDX_WS]]
56
- ! CHECK-DAG: fir.if %[[IV_CMP]] {
61
+ ! CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32
62
+ ! CHECK: %[[C0:.*]] = arith.constant 0 : i32
63
+ ! CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32
64
+ ! CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32
65
+ ! CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32
66
+ ! CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1
67
+ ! CHECK: fir.if %[[IV_CMP]] {
68
+ ! CHECK: fir.store %[[V]] to %{{.*}} : !fir.ref<i32>
57
69
58
70
! Testing lastprivate val update
59
71
! CHECK-NEXT: %[[CLONE_LD:.*]] = fir.load %[[CLONE]] : !fir.ref<i32>
@@ -81,8 +93,14 @@ subroutine lastprivate_int(arg1)
81
93
! CHECK: omp.wsloop for (%[[INDX_WS:.*]]) : {{.*}} {
82
94
83
95
! Testing last iteration check
84
- ! CHECK: %[[IV_CMP1:.*]] = arith.cmpi eq, %[[INDX_WS]]
85
- ! CHECK-NEXT: fir.if %[[IV_CMP1]] {
96
+ ! CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32
97
+ ! CHECK: %[[C0:.*]] = arith.constant 0 : i32
98
+ ! CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32
99
+ ! CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32
100
+ ! CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32
101
+ ! CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1
102
+ ! CHECK: fir.if %[[IV_CMP]] {
103
+ ! CHECK: fir.store %[[V]] to %{{.*}} : !fir.ref<i32>
86
104
! Testing lastprivate val update
87
105
! CHECK-DAG: %[[CLONE_LD1:.*]] = fir.load %[[CLONE1]] : !fir.ref<i32>
88
106
! CHECK-DAG: fir.store %[[CLONE_LD1]] to %[[ARG1]] : !fir.ref<i32>
@@ -112,8 +130,14 @@ subroutine mult_lastprivate_int(arg1, arg2)
112
130
! CHECK: omp.wsloop for (%[[INDX_WS:.*]]) : {{.*}} {
113
131
114
132
! Testing last iteration check
115
- ! CHECK: %[[IV_CMP1:.*]] = arith.cmpi eq, %[[INDX_WS]]
116
- ! CHECK-NEXT: fir.if %[[IV_CMP1]] {
133
+ ! CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32
134
+ ! CHECK: %[[C0:.*]] = arith.constant 0 : i32
135
+ ! CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32
136
+ ! CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32
137
+ ! CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32
138
+ ! CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1
139
+ ! CHECK: fir.if %[[IV_CMP]] {
140
+ ! CHECK: fir.store %[[V]] to %{{.*}} : !fir.ref<i32>
117
141
! Testing lastprivate val update
118
142
! CHECK-DAG: %[[CLONE_LD2:.*]] = fir.load %[[CLONE2]] : !fir.ref<i32>
119
143
! CHECK-DAG: fir.store %[[CLONE_LD2]] to %[[ARG2]] : !fir.ref<i32>
@@ -148,8 +172,14 @@ subroutine mult_lastprivate_int2(arg1, arg2)
148
172
! CHECK: omp.wsloop for (%[[INDX_WS:.*]]) : {{.*}} {
149
173
150
174
! Testing last iteration check
151
- ! CHECK: %[[IV_CMP1:.*]] = arith.cmpi eq, %[[INDX_WS]]
152
- ! CHECK-NEXT: fir.if %[[IV_CMP1]] {
175
+ ! CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32
176
+ ! CHECK: %[[C0:.*]] = arith.constant 0 : i32
177
+ ! CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32
178
+ ! CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32
179
+ ! CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32
180
+ ! CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1
181
+ ! CHECK: fir.if %[[IV_CMP]] {
182
+ ! CHECK: fir.store %[[V]] to %{{.*}} : !fir.ref<i32>
153
183
! Testing lastprivate val update
154
184
! CHECK-NEXT: %[[CLONE_LD:.*]] = fir.load %[[CLONE2]] : !fir.ref<i32>
155
185
! CHECK-NEXT: fir.store %[[CLONE_LD]] to %[[ARG2]] : !fir.ref<i32>
@@ -179,8 +209,14 @@ subroutine firstpriv_lastpriv_int(arg1, arg2)
179
209
! CHECK-NEXT: omp.barrier
180
210
! CHECK: omp.wsloop for (%[[INDX_WS:.*]]) : {{.*}} {
181
211
! Testing last iteration check
182
- ! CHECK: %[[IV_CMP1:.*]] = arith.cmpi eq, %[[INDX_WS]]
183
- ! CHECK-NEXT: fir.if %[[IV_CMP1]] {
212
+ ! CHECK: %[[V:.*]] = arith.addi %[[INDX_WS]], %{{.*}} : i32
213
+ ! CHECK: %[[C0:.*]] = arith.constant 0 : i32
214
+ ! CHECK: %[[T1:.*]] = arith.cmpi slt, %{{.*}}, %[[C0]] : i32
215
+ ! CHECK: %[[T2:.*]] = arith.cmpi slt, %[[V]], %{{.*}} : i32
216
+ ! CHECK: %[[T3:.*]] = arith.cmpi sgt, %[[V]], %{{.*}} : i32
217
+ ! CHECK: %[[IV_CMP:.*]] = arith.select %[[T1]], %[[T2]], %[[T3]] : i1
218
+ ! CHECK: fir.if %[[IV_CMP]] {
219
+ ! CHECK: fir.store %[[V]] to %{{.*}} : !fir.ref<i32>
184
220
! Testing lastprivate val update
185
221
! CHECK-NEXT: %[[CLONE_LD:.*]] = fir.load %[[CLONE1]] : !fir.ref<i32>
186
222
! CHECK-NEXT: fir.store %[[CLONE_LD]] to %[[ARG1]] : !fir.ref<i32>
0 commit comments