1 ! Test lowering of array constructors as inlined temporary.
2 ! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
4 subroutine test_simple(i
)
5 call takes_int([42, i
])
7 ! CHECK-LABEL: func.func @_QPtest_simple(
8 ! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare {{.*}}Ei
9 ! CHECK: %[[VAL_2:.*]] = arith.constant 2 : index
10 ! CHECK: %[[VAL_3:.*]] = arith.constant 1 : index
11 ! CHECK: %[[VAL_4:.*]] = fir.allocmem !fir.array<2xi32> {bindc_name = ".tmp.arrayctor", uniq_name = ""}
12 ! CHECK: %[[VAL_5:.*]] = fir.shape %[[VAL_2]] : (index) -> !fir.shape<1>
13 ! CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_4]](%[[VAL_5]]) {uniq_name = ".tmp.arrayctor"} : (!fir.heap<!fir.array<2xi32>>, !fir.shape<1>) -> (!fir.heap<!fir.array<2xi32>>, !fir.heap<!fir.array<2xi32>>)
14 ! CHECK: %[[VAL_7:.*]] = arith.constant 42 : i32
15 ! CHECK: %[[VAL_8:.*]] = arith.addi %[[VAL_3]], %[[VAL_3]] : index
16 ! CHECK: %[[VAL_9:.*]] = hlfir.designate %[[VAL_6]]#0 (%[[VAL_3]]) : (!fir.heap<!fir.array<2xi32>>, index) -> !fir.ref<i32>
17 ! CHECK: hlfir.assign %[[VAL_7]] to %[[VAL_9]] : i32, !fir.ref<i32>
18 ! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_1]]#0 : !fir.ref<i32>
19 ! CHECK: %[[VAL_11:.*]] = hlfir.designate %[[VAL_6]]#0 (%[[VAL_8]]) : (!fir.heap<!fir.array<2xi32>>, index) -> !fir.ref<i32>
20 ! CHECK: hlfir.assign %[[VAL_10]] to %[[VAL_11]] : i32, !fir.ref<i32>
21 ! CHECK: %[[VAL_12:.*]] = arith.constant true
22 ! CHECK: %[[VAL_13:.*]] = hlfir.as_expr %[[VAL_6]]#0 move %[[VAL_12]] : (!fir.heap<!fir.array<2xi32>>, i1) -> !hlfir.expr<2xi32>
24 ! CHECK: hlfir.destroy %[[VAL_13]] : !hlfir.expr<2xi32>
26 subroutine test_simple_real(x
)
28 call takes_real_2([x
, 0._2
])
30 ! CHECK-LABEL: func.func @_QPtest_simple_real(
31 ! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare {{.*}}Ex
32 ! CHECK: %[[VAL_2:.*]] = arith.constant 2 : index
33 ! CHECK: %[[VAL_3:.*]] = arith.constant 1 : index
34 ! CHECK: %[[VAL_4:.*]] = fir.allocmem !fir.array<2xf16> {bindc_name = ".tmp.arrayctor", uniq_name = ""}
35 ! CHECK: %[[VAL_5:.*]] = fir.shape %[[VAL_2]] : (index) -> !fir.shape<1>
36 ! CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_4]](%[[VAL_5]]) {uniq_name = ".tmp.arrayctor"} : (!fir.heap<!fir.array<2xf16>>, !fir.shape<1>) -> (!fir.heap<!fir.array<2xf16>>, !fir.heap<!fir.array<2xf16>>)
37 ! CHECK: %[[VAL_7:.*]] = fir.load %[[VAL_1]]#0 : !fir.ref<f16>
38 ! CHECK: %[[VAL_8:.*]] = arith.addi %[[VAL_3]], %[[VAL_3]] : index
39 ! CHECK: %[[VAL_9:.*]] = hlfir.designate %[[VAL_6]]#0 (%[[VAL_3]]) : (!fir.heap<!fir.array<2xf16>>, index) -> !fir.ref<f16>
40 ! CHECK: hlfir.assign %[[VAL_7]] to %[[VAL_9]] : f16, !fir.ref<f16>
41 ! CHECK: %[[VAL_10:.*]] = arith.constant 0.000000e+00 : f16
42 ! CHECK: %[[VAL_11:.*]] = hlfir.designate %[[VAL_6]]#0 (%[[VAL_8]]) : (!fir.heap<!fir.array<2xf16>>, index) -> !fir.ref<f16>
43 ! CHECK: hlfir.assign %[[VAL_10]] to %[[VAL_11]] : f16, !fir.ref<f16>
44 ! CHECK: %[[VAL_12:.*]] = arith.constant true
45 ! CHECK: %[[VAL_13:.*]] = hlfir.as_expr %[[VAL_6]]#0 move %[[VAL_12]] : (!fir.heap<!fir.array<2xf16>>, i1) -> !hlfir.expr<2xf16>
47 ! CHECK: hlfir.destroy %[[VAL_13]] : !hlfir.expr<2xf16>
49 subroutine test_simple_complex(z
)
51 call takes_cmplx_8([complex(8):: 42, z
])
53 ! CHECK-LABEL: func.func @_QPtest_simple_complex(
54 ! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare {{.*}}Ez
55 ! CHECK: %[[VAL_2:.*]] = arith.constant 2 : index
56 ! CHECK: %[[VAL_3:.*]] = arith.constant 1 : index
57 ! CHECK: %[[VAL_4:.*]] = fir.allocmem !fir.array<2x!fir.complex<8>> {bindc_name = ".tmp.arrayctor", uniq_name = ""}
58 ! CHECK: %[[VAL_5:.*]] = fir.shape %[[VAL_2]] : (index) -> !fir.shape<1>
59 ! CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_4]](%[[VAL_5]]) {uniq_name = ".tmp.arrayctor"} : (!fir.heap<!fir.array<2x!fir.complex<8>>>, !fir.shape<1>) -> (!fir.heap<!fir.array<2x!fir.complex<8>>>, !fir.heap<!fir.array<2x!fir.complex<8>>>)
60 ! CHECK: %[[VAL_7:.*]] = arith.constant 42 : i32
61 ! CHECK: %[[VAL_8:.*]] = fir.convert %[[VAL_7]] : (i32) -> f64
62 ! CHECK: %[[VAL_9:.*]] = arith.constant 0.000000e+00 : f64
63 ! CHECK: %[[VAL_10:.*]] = fir.undefined !fir.complex<8>
64 ! CHECK: %[[VAL_11:.*]] = fir.insert_value %[[VAL_10]], %[[VAL_8]], [0 : index] : (!fir.complex<8>, f64) -> !fir.complex<8>
65 ! CHECK: %[[VAL_12:.*]] = fir.insert_value %[[VAL_11]], %[[VAL_9]], [1 : index] : (!fir.complex<8>, f64) -> !fir.complex<8>
66 ! CHECK: %[[VAL_13:.*]] = arith.addi %[[VAL_3]], %[[VAL_3]] : index
67 ! CHECK: %[[VAL_14:.*]] = hlfir.designate %[[VAL_6]]#0 (%[[VAL_3]]) : (!fir.heap<!fir.array<2x!fir.complex<8>>>, index) -> !fir.ref<!fir.complex<8>>
68 ! CHECK: hlfir.assign %[[VAL_12]] to %[[VAL_14]] : !fir.complex<8>, !fir.ref<!fir.complex<8>>
69 ! CHECK: %[[VAL_15:.*]] = fir.load %[[VAL_1]]#0 : !fir.ref<!fir.complex<4>>
70 ! CHECK: %[[VAL_16:.*]] = fir.convert %[[VAL_15]] : (!fir.complex<4>) -> !fir.complex<8>
71 ! CHECK: %[[VAL_17:.*]] = hlfir.designate %[[VAL_6]]#0 (%[[VAL_13]]) : (!fir.heap<!fir.array<2x!fir.complex<8>>>, index) -> !fir.ref<!fir.complex<8>>
72 ! CHECK: hlfir.assign %[[VAL_16]] to %[[VAL_17]] : !fir.complex<8>, !fir.ref<!fir.complex<8>>
73 ! CHECK: %[[VAL_18:.*]] = arith.constant true
74 ! CHECK: %[[VAL_19:.*]] = hlfir.as_expr %[[VAL_6]]#0 move %[[VAL_18]] : (!fir.heap<!fir.array<2x!fir.complex<8>>>, i1) -> !hlfir.expr<2x!fir.complex<8>>
76 ! CHECK: hlfir.destroy %[[VAL_19]] : !hlfir.expr<2x!fir.complex<8>>
78 subroutine test_simple_logical(a
, b
)
80 call takes_logical([a
, a
.and
.b
])
82 ! CHECK-LABEL: func.func @_QPtest_simple_logical(
83 ! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare {{.*}}Ea
84 ! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare {{.*}}Eb
85 ! CHECK: %[[VAL_4:.*]] = arith.constant 2 : index
86 ! CHECK: %[[VAL_5:.*]] = arith.constant 1 : index
87 ! CHECK: %[[VAL_6:.*]] = fir.allocmem !fir.array<2x!fir.logical<4>> {bindc_name = ".tmp.arrayctor", uniq_name = ""}
88 ! CHECK: %[[VAL_7:.*]] = fir.shape %[[VAL_4]] : (index) -> !fir.shape<1>
89 ! CHECK: %[[VAL_8:.*]]:2 = hlfir.declare %[[VAL_6]](%[[VAL_7]]) {uniq_name = ".tmp.arrayctor"} : (!fir.heap<!fir.array<2x!fir.logical<4>>>, !fir.shape<1>) -> (!fir.heap<!fir.array<2x!fir.logical<4>>>, !fir.heap<!fir.array<2x!fir.logical<4>>>)
90 ! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_2]]#0 : !fir.ref<!fir.logical<4>>
91 ! CHECK: %[[VAL_10:.*]] = arith.addi %[[VAL_5]], %[[VAL_5]] : index
92 ! CHECK: %[[VAL_11:.*]] = hlfir.designate %[[VAL_8]]#0 (%[[VAL_5]]) : (!fir.heap<!fir.array<2x!fir.logical<4>>>, index) -> !fir.ref<!fir.logical<4>>
93 ! CHECK: hlfir.assign %[[VAL_9]] to %[[VAL_11]] : !fir.logical<4>, !fir.ref<!fir.logical<4>>
94 ! CHECK: %[[VAL_12:.*]] = fir.load %[[VAL_2]]#0 : !fir.ref<!fir.logical<4>>
95 ! CHECK: %[[VAL_13:.*]] = fir.load %[[VAL_3]]#0 : !fir.ref<!fir.logical<4>>
96 ! CHECK: %[[VAL_14:.*]] = fir.convert %[[VAL_12]] : (!fir.logical<4>) -> i1
97 ! CHECK: %[[VAL_15:.*]] = fir.convert %[[VAL_13]] : (!fir.logical<4>) -> i1
98 ! CHECK: %[[VAL_16:.*]] = arith.andi %[[VAL_14]], %[[VAL_15]] : i1
99 ! CHECK: %[[VAL_17:.*]] = hlfir.designate %[[VAL_8]]#0 (%[[VAL_10]]) : (!fir.heap<!fir.array<2x!fir.logical<4>>>, index) -> !fir.ref<!fir.logical<4>>
100 ! CHECK: hlfir.assign %[[VAL_16]] to %[[VAL_17]] : i1, !fir.ref<!fir.logical<4>>
101 ! CHECK: %[[VAL_18:.*]] = arith.constant true
102 ! CHECK: %[[VAL_19:.*]] = hlfir.as_expr %[[VAL_8]]#0 move %[[VAL_18]] : (!fir.heap<!fir.array<2x!fir.logical<4>>>, i1) -> !hlfir.expr<2x!fir.logical<4>>
104 ! CHECK: hlfir.destroy %[[VAL_19]] : !hlfir.expr<2x!fir.logical<4>>
106 subroutine test_implied_do(n
)
108 ! This implied do cannot easily be promoted to hlfir.elemental because
109 ! the implied do contains more than one scalar ac-value.
110 call takes_int([(42, j
, j
=1,n
)])
112 ! CHECK-LABEL: func.func @_QPtest_implied_do(
113 ! CHECK: %[[VAL_1:.*]] = fir.alloca index
114 ! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare {{.*}}En
115 ! CHECK: %[[VAL_3:.*]] = arith.constant 0 : i64
116 ! CHECK: %[[VAL_4:.*]] = arith.constant 2 : i64
117 ! CHECK: %[[VAL_5:.*]] = fir.load %[[VAL_2]]#0 : !fir.ref<i64>
118 ! CHECK: %[[VAL_6:.*]] = arith.constant 1 : i64
119 ! CHECK: %[[VAL_7:.*]] = arith.subi %[[VAL_5]], %[[VAL_6]] : i64
120 ! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i64
121 ! CHECK: %[[VAL_9:.*]] = arith.addi %[[VAL_7]], %[[VAL_8]] : i64
122 ! CHECK: %[[VAL_10:.*]] = arith.constant 1 : i64
123 ! CHECK: %[[VAL_11:.*]] = arith.divsi %[[VAL_9]], %[[VAL_10]] : i64
124 ! CHECK: %[[VAL_12:.*]] = arith.constant 0 : i64
125 ! CHECK: %[[VAL_13:.*]] = arith.cmpi sgt, %[[VAL_11]], %[[VAL_12]] : i64
126 ! CHECK: %[[VAL_14:.*]] = arith.select %[[VAL_13]], %[[VAL_11]], %[[VAL_12]] : i64
127 ! CHECK: %[[VAL_15:.*]] = arith.muli %[[VAL_4]], %[[VAL_14]] : i64
128 ! CHECK: %[[VAL_16:.*]] = arith.addi %[[VAL_3]], %[[VAL_15]] : i64
129 ! CHECK: %[[VAL_17:.*]] = fir.convert %[[VAL_16]] : (i64) -> index
130 ! CHECK: %[[VAL_18:.*]] = arith.constant 1 : index
131 ! CHECK: fir.store %[[VAL_18]] to %[[VAL_1]] : !fir.ref<index>
132 ! CHECK: %[[VAL_19:.*]] = fir.allocmem !fir.array<?xi32>, %[[VAL_17]] {bindc_name = ".tmp.arrayctor", uniq_name = ""}
133 ! CHECK: %[[VAL_20:.*]] = fir.shape %[[VAL_17]] : (index) -> !fir.shape<1>
134 ! CHECK: %[[VAL_21:.*]]:2 = hlfir.declare %[[VAL_19]](%[[VAL_20]]) {uniq_name = ".tmp.arrayctor"} : (!fir.heap<!fir.array<?xi32>>, !fir.shape<1>) -> (!fir.box<!fir.array<?xi32>>, !fir.heap<!fir.array<?xi32>>)
135 ! CHECK: %[[VAL_22:.*]] = arith.constant 1 : i64
136 ! CHECK: %[[VAL_23:.*]] = fir.convert %[[VAL_22]] : (i64) -> index
137 ! CHECK: %[[VAL_24:.*]] = fir.load %[[VAL_2]]#0 : !fir.ref<i64>
138 ! CHECK: %[[VAL_25:.*]] = fir.convert %[[VAL_24]] : (i64) -> index
139 ! CHECK: %[[VAL_26:.*]] = arith.constant 1 : i64
140 ! CHECK: %[[VAL_27:.*]] = fir.convert %[[VAL_26]] : (i64) -> index
141 ! CHECK: fir.do_loop %[[VAL_28:.*]] = %[[VAL_23]] to %[[VAL_25]] step %[[VAL_27]] {
142 ! CHECK: %[[VAL_29:.*]] = arith.constant 42 : i32
143 ! CHECK: %[[VAL_30:.*]] = fir.load %[[VAL_1]] : !fir.ref<index>
144 ! CHECK: %[[VAL_31:.*]] = arith.addi %[[VAL_30]], %[[VAL_18]] : index
145 ! CHECK: fir.store %[[VAL_31]] to %[[VAL_1]] : !fir.ref<index>
146 ! CHECK: %[[VAL_32:.*]] = hlfir.designate %[[VAL_21]]#0 (%[[VAL_31]]) : (!fir.box<!fir.array<?xi32>>, index) -> !fir.ref<i32>
147 ! CHECK: hlfir.assign %[[VAL_29]] to %[[VAL_32]] : i32, !fir.ref<i32>
148 ! CHECK: %[[VAL_33:.*]] = fir.convert %[[VAL_28]] : (index) -> i32
149 ! CHECK: %[[VAL_34:.*]] = fir.load %[[VAL_1]] : !fir.ref<index>
150 ! CHECK: %[[VAL_35:.*]] = arith.addi %[[VAL_34]], %[[VAL_18]] : index
151 ! CHECK: fir.store %[[VAL_35]] to %[[VAL_1]] : !fir.ref<index>
152 ! CHECK: %[[VAL_36:.*]] = hlfir.designate %[[VAL_21]]#0 (%[[VAL_35]]) : (!fir.box<!fir.array<?xi32>>, index) -> !fir.ref<i32>
153 ! CHECK: hlfir.assign %[[VAL_33]] to %[[VAL_36]] : i32, !fir.ref<i32>
155 ! CHECK: %[[VAL_37:.*]] = arith.constant true
156 ! CHECK: %[[VAL_38:.*]] = hlfir.as_expr %[[VAL_21]]#0 move %[[VAL_37]] : (!fir.box<!fir.array<?xi32>>, i1) -> !hlfir.expr<?xi32>
158 ! CHECK: hlfir.destroy %[[VAL_38]] : !hlfir.expr<?xi32>
160 subroutine test_strided_implied_do(lb
, ub
, stride
)
161 integer(8) :: lb
, ub
, stride
162 call takes_int([(42, j
, j
=lb
,ub
,stride
)])
164 ! CHECK-LABEL: func.func @_QPtest_strided_implied_do(
165 ! CHECK: %[[VAL_3:.*]] = fir.alloca index
166 ! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare {{.*}}Elb
167 ! CHECK: %[[VAL_5:.*]]:2 = hlfir.declare {{.*}}Estride
168 ! CHECK: %[[VAL_6:.*]]:2 = hlfir.declare {{.*}}Eub
169 ! CHECK: %[[VAL_7:.*]] = arith.constant 0 : i64
170 ! CHECK: %[[VAL_8:.*]] = arith.constant 2 : i64
171 ! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_6]]#0 : !fir.ref<i64>
172 ! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_4]]#0 : !fir.ref<i64>
173 ! CHECK: %[[VAL_11:.*]] = arith.subi %[[VAL_9]], %[[VAL_10]] : i64
174 ! CHECK: %[[VAL_12:.*]] = fir.load %[[VAL_5]]#0 : !fir.ref<i64>
175 ! CHECK: %[[VAL_13:.*]] = arith.addi %[[VAL_11]], %[[VAL_12]] : i64
176 ! CHECK: %[[VAL_14:.*]] = fir.load %[[VAL_5]]#0 : !fir.ref<i64>
177 ! CHECK: %[[VAL_15:.*]] = arith.divsi %[[VAL_13]], %[[VAL_14]] : i64
178 ! CHECK: %[[VAL_16:.*]] = arith.constant 0 : i64
179 ! CHECK: %[[VAL_17:.*]] = arith.cmpi sgt, %[[VAL_15]], %[[VAL_16]] : i64
180 ! CHECK: %[[VAL_18:.*]] = arith.select %[[VAL_17]], %[[VAL_15]], %[[VAL_16]] : i64
181 ! CHECK: %[[VAL_19:.*]] = arith.muli %[[VAL_8]], %[[VAL_18]] : i64
182 ! CHECK: %[[VAL_20:.*]] = arith.addi %[[VAL_7]], %[[VAL_19]] : i64
183 ! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_20]] : (i64) -> index
184 ! CHECK: %[[VAL_22:.*]] = arith.constant 1 : index
185 ! CHECK: fir.store %[[VAL_22]] to %[[VAL_3]] : !fir.ref<index>
186 ! CHECK: %[[VAL_23:.*]] = fir.allocmem !fir.array<?xi32>, %[[VAL_21]] {bindc_name = ".tmp.arrayctor", uniq_name = ""}
187 ! CHECK: %[[VAL_24:.*]] = fir.shape %[[VAL_21]] : (index) -> !fir.shape<1>
188 ! CHECK: %[[VAL_25:.*]]:2 = hlfir.declare %[[VAL_23]](%[[VAL_24]]) {uniq_name = ".tmp.arrayctor"} : (!fir.heap<!fir.array<?xi32>>, !fir.shape<1>) -> (!fir.box<!fir.array<?xi32>>, !fir.heap<!fir.array<?xi32>>)
189 ! CHECK: %[[VAL_26:.*]] = fir.load %[[VAL_4]]#0 : !fir.ref<i64>
190 ! CHECK: %[[VAL_27:.*]] = fir.convert %[[VAL_26]] : (i64) -> index
191 ! CHECK: %[[VAL_28:.*]] = fir.load %[[VAL_6]]#0 : !fir.ref<i64>
192 ! CHECK: %[[VAL_29:.*]] = fir.convert %[[VAL_28]] : (i64) -> index
193 ! CHECK: %[[VAL_30:.*]] = fir.load %[[VAL_5]]#0 : !fir.ref<i64>
194 ! CHECK: %[[VAL_31:.*]] = fir.convert %[[VAL_30]] : (i64) -> index
195 ! CHECK: fir.do_loop %[[VAL_32:.*]] = %[[VAL_27]] to %[[VAL_29]] step %[[VAL_31]] {
196 ! CHECK: %[[VAL_33:.*]] = arith.constant 42 : i32
197 ! CHECK: %[[VAL_34:.*]] = fir.load %[[VAL_3]] : !fir.ref<index>
198 ! CHECK: %[[VAL_35:.*]] = arith.addi %[[VAL_34]], %[[VAL_22]] : index
199 ! CHECK: fir.store %[[VAL_35]] to %[[VAL_3]] : !fir.ref<index>
200 ! CHECK: %[[VAL_36:.*]] = hlfir.designate %[[VAL_25]]#0 (%[[VAL_35]]) : (!fir.box<!fir.array<?xi32>>, index) -> !fir.ref<i32>
201 ! CHECK: hlfir.assign %[[VAL_33]] to %[[VAL_36]] : i32, !fir.ref<i32>
202 ! CHECK: %[[VAL_37:.*]] = fir.convert %[[VAL_32]] : (index) -> i32
203 ! CHECK: %[[VAL_38:.*]] = fir.load %[[VAL_3]] : !fir.ref<index>
204 ! CHECK: %[[VAL_39:.*]] = arith.addi %[[VAL_38]], %[[VAL_22]] : index
205 ! CHECK: fir.store %[[VAL_39]] to %[[VAL_3]] : !fir.ref<index>
206 ! CHECK: %[[VAL_40:.*]] = hlfir.designate %[[VAL_25]]#0 (%[[VAL_39]]) : (!fir.box<!fir.array<?xi32>>, index) -> !fir.ref<i32>
207 ! CHECK: hlfir.assign %[[VAL_37]] to %[[VAL_40]] : i32, !fir.ref<i32>
209 ! CHECK: %[[VAL_41:.*]] = arith.constant true
210 ! CHECK: %[[VAL_42:.*]] = hlfir.as_expr %[[VAL_25]]#0 move %[[VAL_41]] : (!fir.box<!fir.array<?xi32>>, i1) -> !hlfir.expr<?xi32>
212 ! CHECK: hlfir.destroy %[[VAL_42]] : !hlfir.expr<?xi32>
214 subroutine test_nested_implied_do(n
, m
)
216 call takes_int([((i
+j
, i
=1,m
), j
=1,n
)])
218 ! CHECK-LABEL: func.func @_QPtest_nested_implied_do(
219 ! CHECK: %[[VAL_2:.*]] = fir.alloca index
220 ! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare {{.*}}Em
221 ! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare {{.*}}En
222 ! CHECK: %[[VAL_5:.*]] = arith.constant 0 : i64
223 ! CHECK: %[[VAL_6:.*]] = arith.constant 0 : i64
224 ! CHECK: %[[VAL_7:.*]] = fir.load %[[VAL_3]]#0 : !fir.ref<i64>
225 ! CHECK: %[[VAL_8:.*]] = arith.constant 1 : i64
226 ! CHECK: %[[VAL_9:.*]] = arith.subi %[[VAL_7]], %[[VAL_8]] : i64
227 ! CHECK: %[[VAL_10:.*]] = arith.constant 1 : i64
228 ! CHECK: %[[VAL_11:.*]] = arith.addi %[[VAL_9]], %[[VAL_10]] : i64
229 ! CHECK: %[[VAL_12:.*]] = arith.constant 1 : i64
230 ! CHECK: %[[VAL_13:.*]] = arith.divsi %[[VAL_11]], %[[VAL_12]] : i64
231 ! CHECK: %[[VAL_14:.*]] = arith.constant 0 : i64
232 ! CHECK: %[[VAL_15:.*]] = arith.cmpi sgt, %[[VAL_13]], %[[VAL_14]] : i64
233 ! CHECK: %[[VAL_16:.*]] = arith.select %[[VAL_15]], %[[VAL_13]], %[[VAL_14]] : i64
234 ! CHECK: %[[VAL_17:.*]] = arith.addi %[[VAL_6]], %[[VAL_16]] : i64
235 ! CHECK: %[[VAL_18:.*]] = fir.load %[[VAL_4]]#0 : !fir.ref<i64>
236 ! CHECK: %[[VAL_19:.*]] = arith.constant 1 : i64
237 ! CHECK: %[[VAL_20:.*]] = arith.subi %[[VAL_18]], %[[VAL_19]] : i64
238 ! CHECK: %[[VAL_21:.*]] = arith.constant 1 : i64
239 ! CHECK: %[[VAL_22:.*]] = arith.addi %[[VAL_20]], %[[VAL_21]] : i64
240 ! CHECK: %[[VAL_23:.*]] = arith.constant 1 : i64
241 ! CHECK: %[[VAL_24:.*]] = arith.divsi %[[VAL_22]], %[[VAL_23]] : i64
242 ! CHECK: %[[VAL_25:.*]] = arith.constant 0 : i64
243 ! CHECK: %[[VAL_26:.*]] = arith.cmpi sgt, %[[VAL_24]], %[[VAL_25]] : i64
244 ! CHECK: %[[VAL_27:.*]] = arith.select %[[VAL_26]], %[[VAL_24]], %[[VAL_25]] : i64
245 ! CHECK: %[[VAL_28:.*]] = arith.muli %[[VAL_17]], %[[VAL_27]] : i64
246 ! CHECK: %[[VAL_29:.*]] = arith.addi %[[VAL_5]], %[[VAL_28]] : i64
247 ! CHECK: %[[VAL_30:.*]] = fir.convert %[[VAL_29]] : (i64) -> index
248 ! CHECK: %[[VAL_31:.*]] = arith.constant 1 : index
249 ! CHECK: fir.store %[[VAL_31]] to %[[VAL_2]] : !fir.ref<index>
250 ! CHECK: %[[VAL_32:.*]] = fir.allocmem !fir.array<?xi32>, %[[VAL_30]] {bindc_name = ".tmp.arrayctor", uniq_name = ""}
251 ! CHECK: %[[VAL_33:.*]] = fir.shape %[[VAL_30]] : (index) -> !fir.shape<1>
252 ! CHECK: %[[VAL_34:.*]]:2 = hlfir.declare %[[VAL_32]](%[[VAL_33]]) {uniq_name = ".tmp.arrayctor"} : (!fir.heap<!fir.array<?xi32>>, !fir.shape<1>) -> (!fir.box<!fir.array<?xi32>>, !fir.heap<!fir.array<?xi32>>)
253 ! CHECK: %[[VAL_35:.*]] = arith.constant 1 : i64
254 ! CHECK: %[[VAL_36:.*]] = fir.convert %[[VAL_35]] : (i64) -> index
255 ! CHECK: %[[VAL_37:.*]] = fir.load %[[VAL_4]]#0 : !fir.ref<i64>
256 ! CHECK: %[[VAL_38:.*]] = fir.convert %[[VAL_37]] : (i64) -> index
257 ! CHECK: %[[VAL_39:.*]] = arith.constant 1 : i64
258 ! CHECK: %[[VAL_40:.*]] = fir.convert %[[VAL_39]] : (i64) -> index
259 ! CHECK: fir.do_loop %[[VAL_41:.*]] = %[[VAL_36]] to %[[VAL_38]] step %[[VAL_40]] {
260 ! CHECK: %[[VAL_42:.*]] = arith.constant 1 : i64
261 ! CHECK: %[[VAL_43:.*]] = fir.convert %[[VAL_42]] : (i64) -> index
262 ! CHECK: %[[VAL_44:.*]] = fir.load %[[VAL_3]]#0 : !fir.ref<i64>
263 ! CHECK: %[[VAL_45:.*]] = fir.convert %[[VAL_44]] : (i64) -> index
264 ! CHECK: %[[VAL_46:.*]] = arith.constant 1 : i64
265 ! CHECK: %[[VAL_47:.*]] = fir.convert %[[VAL_46]] : (i64) -> index
266 ! CHECK: fir.do_loop %[[VAL_48:.*]] = %[[VAL_43]] to %[[VAL_45]] step %[[VAL_47]] {
267 ! CHECK: %[[VAL_49:.*]] = fir.convert %[[VAL_48]] : (index) -> i32
268 ! CHECK: %[[VAL_50:.*]] = fir.convert %[[VAL_41]] : (index) -> i32
269 ! CHECK: %[[VAL_51:.*]] = arith.addi %[[VAL_49]], %[[VAL_50]] : i32
270 ! CHECK: %[[VAL_52:.*]] = fir.load %[[VAL_2]] : !fir.ref<index>
271 ! CHECK: %[[VAL_53:.*]] = arith.addi %[[VAL_52]], %[[VAL_31]] : index
272 ! CHECK: fir.store %[[VAL_53]] to %[[VAL_2]] : !fir.ref<index>
273 ! CHECK: %[[VAL_54:.*]] = hlfir.designate %[[VAL_34]]#0 (%[[VAL_53]]) : (!fir.box<!fir.array<?xi32>>, index) -> !fir.ref<i32>
274 ! CHECK: hlfir.assign %[[VAL_51]] to %[[VAL_54]] : i32, !fir.ref<i32>
277 ! CHECK: %[[VAL_55:.*]] = arith.constant true
278 ! CHECK: %[[VAL_56:.*]] = hlfir.as_expr %[[VAL_34]]#0 move %[[VAL_55]] : (!fir.box<!fir.array<?xi32>>, i1) -> !hlfir.expr<?xi32>
280 ! CHECK: hlfir.destroy %[[VAL_56]] : !hlfir.expr<?xi32>