Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / array-temp.f90
blob396ebfad36b0cc47528992c1510b7a343b7b79e2
1 ! RUN: bbc %s -o - | FileCheck %s
3 ! CHECK-LABEL: func @_QPss1()
4 subroutine ss1
5 ! CHECK: %[[aa:[0-9]+]] = fir.alloca !fir.array<2650000xf32> {bindc_name = "aa", uniq_name = "_QFss1Eaa"}
6 ! CHECK: %[[shape:[0-9]+]] = fir.shape {{.*}} : (index) -> !fir.shape<1>
7 integer, parameter :: N = 2650000
8 real aa(N)
9 ! CHECK: fir.array_coor %[[aa]](%[[shape]]) {{.*}} : (!fir.ref<!fir.array<2650000xf32>>, !fir.shape<1>, index) -> !fir.ref<f32>
10 aa = -2
11 ! CHECK: %[[temp:[0-9]+]] = fir.allocmem !fir.array<2650000xf32>
12 ! CHECK: fir.array_coor %[[aa]](%[[shape]]) {{.*}} : (!fir.ref<!fir.array<2650000xf32>>, !fir.shape<1>, index) -> !fir.ref<f32>
13 ! CHECK: fir.array_coor %[[temp]](%[[shape]]) {{.*}} : (!fir.heap<!fir.array<2650000xf32>>, !fir.shape<1>, index) -> !fir.ref<f32>
14 ! CHECK: fir.array_coor %[[aa]](%[[shape]]) [{{.*}}] {{.*}} : (!fir.ref<!fir.array<2650000xf32>>, !fir.shape<1>, !fir.slice<1>, index) -> !fir.ref<f32>
15 ! CHECK: fir.array_coor %[[temp]](%[[shape]]) [{{.*}}] {{.*}} : (!fir.heap<!fir.array<2650000xf32>>, !fir.shape<1>, !fir.slice<1>, index) -> !fir.ref<f32>
16 ! CHECK: fir.array_coor %[[temp]](%[[shape]]) {{.*}} : (!fir.heap<!fir.array<2650000xf32>>, !fir.shape<1>, index) -> !fir.ref<f32>
17 ! CHECK: fir.array_coor %[[aa]](%[[shape]]) {{.*}} : (!fir.ref<!fir.array<2650000xf32>>, !fir.shape<1>, index) -> !fir.ref<f32>
18 ! CHECK: fir.freemem %[[temp]] : !fir.heap<!fir.array<2650000xf32>>
19 aa(2:N) = aa(1:N-1) + 7.0
20 ! print*, aa(1:2), aa(N-1:N)
21 end
23 subroutine ss2(N)
24 real aa(N)
25 aa = -2
26 aa(2:N) = aa(1:N-1) + 7.0
27 print*, aa(1:2), aa(N-1:N)
28 end
30 subroutine ss3(N)
31 real aa(2,N)
32 aa = -2
33 aa(:,2:N) = aa(:,1:N-1) + 7.0
34 print*, aa(:,1:2), aa(:,N-1:N)
35 end
37 subroutine ss4(N)
38 real aa(N,2)
39 aa = -2
40 aa(2:N,:) = aa(1:N-1,:) + 7.0
41 print*, aa(1:2,:), aa(N-1:N,:)
42 end
44 ! CHECK-LABEL: func @_QPss2(
45 ! CHECK-SAME: %arg0: !fir.ref<i32> {fir.bindc_name = "n"}) {
46 ! CHECK: %[[C_m1:[-0-9a-z_]+]] = arith.constant -1 : index
47 ! CHECK: %[[C_2:[-0-9a-z_]+]] = arith.constant 2 : index
48 ! CHECK: %[[C_1:[-0-9a-z_]+]] = arith.constant 1 : index
49 ! CHECK: %[[C_27_i32:[-0-9a-z_]+]] = arith.constant 27 : i32
50 ! CHECK: %[[C_m1_i32:[-0-9a-z_]+]] = arith.constant -1 : i32
51 ! CHECK: %[[C_st:[-0-9a-z_]+]] = arith.constant 7.000000e+00 : f32
52 ! CHECK: %[[C_1_i32:[-0-9a-z_]+]] = arith.constant 1 : i32
53 ! CHECK: %[[C_st_0:[-0-9a-z_]+]] = arith.constant -2.000000e+00 : f32
54 ! CHECK: %[[C_0:[-0-9a-z_]+]] = arith.constant 0 : index
55 ! CHECK: %[[V_0:[0-9]+]] = fir.load %arg0 : !fir.ref<i32>
56 ! CHECK: %[[V_1:[0-9]+]] = fir.convert %[[V_0:[0-9]+]] : (i32) -> index
57 ! CHECK: %[[V_2:[0-9]+]] = arith.cmpi sgt, %[[V_1]], %[[C_0]] : index
58 ! CHECK: %[[V_3:[0-9]+]] = arith.select %[[V_2]], %[[V_1]], %[[C_0]] : index
59 ! CHECK: %[[V_4:[0-9]+]] = fir.alloca !fir.array<?xf32>, %[[V_3]] {bindc_name = "aa", uniq_name = "_QFss2Eaa"}
60 ! CHECK: %[[V_5:[0-9]+]] = fir.shape %[[V_3:[0-9]+]] : (index) -> !fir.shape<1>
61 ! CHECK: cf.br ^bb1(%[[C_0]], %[[V_3:[0-9]+]] : index, index)
62 ! CHECK: ^bb1(%[[V_6:[0-9]+]]: index, %[[V_7:[0-9]+]]: index): // 2 preds: ^bb0, ^bb2
63 ! CHECK: %[[V_8:[0-9]+]] = arith.cmpi sgt, %[[V_7]], %[[C_0]] : index
64 ! CHECK: cf.cond_br %[[V_8]], ^bb2, ^bb3
65 ! CHECK: ^bb2: // pred: ^bb1
66 ! CHECK: %[[V_9:[0-9]+]] = arith.addi %[[V_6]], %[[C_1]] : index
67 ! CHECK: %[[V_10:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_9:[0-9]+]] : (!fir.ref<!fir.array<?xf32>>, !fir.shape<1>, index) -> !fir.ref<f32>
68 ! CHECK: fir.store %[[C_st_0]] to %[[V_10:[0-9]+]] : !fir.ref<f32>
69 ! CHECK: %[[V_11:[0-9]+]] = arith.subi %[[V_7]], %[[C_1]] : index
70 ! CHECK: cf.br ^bb1(%[[V_9]], %[[V_11:[0-9]+]] : index, index)
71 ! CHECK: ^bb3: // pred: ^bb1
72 ! CHECK: %[[V_12:[0-9]+]] = fir.load %arg0 : !fir.ref<i32>
73 ! CHECK: %[[V_13:[0-9]+]] = fir.convert %[[V_12:[0-9]+]] : (i32) -> index
74 ! CHECK: %[[V_14:[0-9]+]] = arith.addi %[[V_13]], %[[C_m1]] : index
75 ! CHECK: %[[V_15:[0-9]+]] = arith.cmpi sgt, %[[V_14]], %[[C_0]] : index
76 ! CHECK: %[[V_16:[0-9]+]] = arith.select %[[V_15]], %[[V_14]], %[[C_0]] : index
77 ! CHECK: %[[V_17:[0-9]+]] = fir.slice %[[C_2]], %[[V_13]], %[[C_1]] : (index, index, index) -> !fir.slice<1>
78 ! CHECK: %[[V_18:[0-9]+]] = fir.allocmem !fir.array<?xf32>, %[[V_3]]
79 ! CHECK: cf.br ^bb4(%[[C_0]], %[[V_3:[0-9]+]] : index, index)
80 ! CHECK: ^bb4(%[[V_19:[0-9]+]]: index, %[[V_20:[0-9]+]]: index): // 2 preds: ^bb3, ^bb5
81 ! CHECK: %[[V_21:[0-9]+]] = arith.cmpi sgt, %[[V_20]], %[[C_0]] : index
82 ! CHECK: cf.cond_br %[[V_21]], ^bb5, ^bb6
83 ! CHECK: ^bb5: // pred: ^bb4
84 ! CHECK: %[[V_22:[0-9]+]] = arith.addi %[[V_19]], %[[C_1]] : index
85 ! CHECK: %[[V_23:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_22:[0-9]+]] : (!fir.ref<!fir.array<?xf32>>, !fir.shape<1>, index) -> !fir.ref<f32>
86 ! CHECK: %[[V_24:[0-9]+]] = fir.array_coor %[[V_18]](%[[V_5]]) %[[V_22:[0-9]+]] : (!fir.heap<!fir.array<?xf32>>, !fir.shape<1>, index) -> !fir.ref<f32>
87 ! CHECK: %[[V_25:[0-9]+]] = fir.load %[[V_23:[0-9]+]] : !fir.ref<f32>
88 ! CHECK: fir.store %[[V_25]] to %[[V_24:[0-9]+]] : !fir.ref<f32>
89 ! CHECK: %[[V_26:[0-9]+]] = arith.subi %[[V_20]], %[[C_1]] : index
90 ! CHECK: cf.br ^bb4(%[[V_22]], %[[V_26:[0-9]+]] : index, index)
91 ! CHECK: ^bb6: // pred: ^bb4
92 ! CHECK: %[[V_27:[0-9]+]] = arith.subi %[[V_12]], %[[C_1_i32]] : i32
93 ! CHECK: %[[V_28:[0-9]+]] = fir.convert %[[V_27:[0-9]+]] : (i32) -> index
94 ! CHECK: %[[V_29:[0-9]+]] = fir.slice %[[C_1]], %[[V_28]], %[[C_1]] : (index, index, index) -> !fir.slice<1>
95 ! CHECK: cf.br ^bb7(%[[C_0]], %[[V_16:[0-9]+]] : index, index)
96 ! CHECK: ^bb7(%[[V_30:[0-9]+]]: index, %[[V_31:[0-9]+]]: index): // 2 preds: ^bb6, ^bb8
97 ! CHECK: %[[V_32:[0-9]+]] = arith.cmpi sgt, %[[V_31]], %[[C_0]] : index
98 ! CHECK: cf.cond_br %[[V_32]], ^bb8, ^bb9(%[[C_0]], %[[V_3:[0-9]+]] : index, index)
99 ! CHECK: ^bb8: // pred: ^bb7
100 ! CHECK: %[[V_33:[0-9]+]] = arith.addi %[[V_30]], %[[C_1]] : index
101 ! CHECK: %[[V_34:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) [%[[V_29]]] %[[V_33:[0-9]+]] : (!fir.ref<!fir.array<?xf32>>, !fir.shape<1>, !fir.slice<1>, index) -> !fir.ref<f32>
102 ! CHECK: %[[V_35:[0-9]+]] = fir.load %[[V_34:[0-9]+]] : !fir.ref<f32>
103 ! CHECK: %[[V_36:[0-9]+]] = arith.addf %[[V_35]], %[[C_st]] fastmath<contract> : f32
104 ! CHECK: %[[V_37:[0-9]+]] = fir.array_coor %[[V_18]](%[[V_5]]) [%[[V_17]]] %[[V_33:[0-9]+]] : (!fir.heap<!fir.array<?xf32>>, !fir.shape<1>, !fir.slice<1>, index) -> !fir.ref<f32>
105 ! CHECK: fir.store %[[V_36]] to %[[V_37:[0-9]+]] : !fir.ref<f32>
106 ! CHECK: %[[V_38:[0-9]+]] = arith.subi %[[V_31]], %[[C_1]] : index
107 ! CHECK: cf.br ^bb7(%[[V_33]], %[[V_38:[0-9]+]] : index, index)
108 ! CHECK: ^bb9(%[[V_39:[0-9]+]]: index, %[[V_40:[0-9]+]]: index): // 2 preds: ^bb7, ^bb10
109 ! CHECK: %[[V_41:[0-9]+]] = arith.cmpi sgt, %[[V_40]], %[[C_0]] : index
110 ! CHECK: cf.cond_br %[[V_41]], ^bb10, ^bb11
111 ! CHECK: ^bb10: // pred: ^bb9
112 ! CHECK: %[[V_42:[0-9]+]] = arith.addi %[[V_39]], %[[C_1]] : index
113 ! CHECK: %[[V_43:[0-9]+]] = fir.array_coor %[[V_18]](%[[V_5]]) %[[V_42:[0-9]+]] : (!fir.heap<!fir.array<?xf32>>, !fir.shape<1>, index) -> !fir.ref<f32>
114 ! CHECK: %[[V_44:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_42:[0-9]+]] : (!fir.ref<!fir.array<?xf32>>, !fir.shape<1>, index) -> !fir.ref<f32>
115 ! CHECK: %[[V_45:[0-9]+]] = fir.load %[[V_43:[0-9]+]] : !fir.ref<f32>
116 ! CHECK: fir.store %[[V_45]] to %[[V_44:[0-9]+]] : !fir.ref<f32>
117 ! CHECK: %[[V_46:[0-9]+]] = arith.subi %[[V_40]], %[[C_1]] : index
118 ! CHECK: cf.br ^bb9(%[[V_42]], %[[V_46:[0-9]+]] : index, index)
119 ! CHECK: ^bb11: // pred: ^bb9
120 ! CHECK: fir.freemem %[[V_18:[0-9]+]] : !fir.heap<!fir.array<?xf32>>
121 ! CHECK: %[[V_49:[0-9]+]] = fir.call @_FortranAioBeginExternalListOutput(%[[C_m1_i32]], %{{.*}}, %{{.*}}) {{.*}}: (i32, !fir.ref<i8>, i32) -> !fir.ref<i8>
122 ! CHECK: %[[V_50:[0-9]+]] = fir.slice %[[C_1]], %[[C_2]], %[[C_1]] : (index, index, index) -> !fir.slice<1>
123 ! CHECK: %[[V_51:[0-9]+]] = fir.embox %[[V_4]](%[[V_5]]) [%[[V_50]]] : (!fir.ref<!fir.array<?xf32>>, !fir.shape<1>, !fir.slice<1>) -> !fir.box<!fir.array<2xf32>>
124 ! CHECK: %[[V_52:[0-9]+]] = fir.convert %[[V_51:[0-9]+]] : (!fir.box<!fir.array<2xf32>>) -> !fir.box<none>
125 ! CHECK: %[[V_53:[0-9]+]] = fir.call @_FortranAioOutputDescriptor(%[[V_49]], %[[V_52]]) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>) -> i1
126 ! CHECK: %[[V_54:[0-9]+]] = fir.load %arg0 : !fir.ref<i32>
127 ! CHECK: %[[V_55:[0-9]+]] = arith.subi %[[V_54]], %[[C_1_i32]] : i32
128 ! CHECK: %[[V_56:[0-9]+]] = fir.convert %[[V_55:[0-9]+]] : (i32) -> index
129 ! CHECK: %[[V_57:[0-9]+]] = fir.convert %[[V_54:[0-9]+]] : (i32) -> index
130 ! CHECK: %[[V_58:[0-9]+]] = fir.slice %[[V_56]], %[[V_57]], %[[C_1]] : (index, index, index) -> !fir.slice<1>
131 ! CHECK: %[[V_59:[0-9]+]] = fir.embox %[[V_4]](%[[V_5]]) [%[[V_58]]] : (!fir.ref<!fir.array<?xf32>>, !fir.shape<1>, !fir.slice<1>) -> !fir.box<!fir.array<?xf32>>
132 ! CHECK: %[[V_60:[0-9]+]] = fir.convert %[[V_59:[0-9]+]] : (!fir.box<!fir.array<?xf32>>) -> !fir.box<none>
133 ! CHECK: %[[V_61:[0-9]+]] = fir.call @_FortranAioOutputDescriptor(%[[V_49]], %[[V_60]]) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>) -> i1
134 ! CHECK: %[[V_62:[0-9]+]] = fir.call @_FortranAioEndIoStatement(%[[V_49]]) fastmath<contract> : (!fir.ref<i8>) -> i32
135 ! CHECK: return
136 ! CHECK: }
138 ! CHECK-LABEL: func @_QPss3(
139 ! CHECK-SAME: %arg0: !fir.ref<i32> {fir.bindc_name = "n"}) {
140 ! CHECK: %[[C_m1:[-0-9a-z_]+]] = arith.constant -1 : index
141 ! CHECK: %[[C_2:[-0-9a-z_]+]] = arith.constant 2 : index
142 ! CHECK: %[[C_1:[-0-9a-z_]+]] = arith.constant 1 : index
143 ! CHECK: %[[C_34_i32:[-0-9a-z_]+]] = arith.constant 34 : i32
144 ! CHECK: %[[C_m1_i32:[-0-9a-z_]+]] = arith.constant -1 : i32
145 ! CHECK: %[[C_st:[-0-9a-z_]+]] = arith.constant 7.000000e+00 : f32
146 ! CHECK: %[[C_1_i32:[-0-9a-z_]+]] = arith.constant 1 : i32
147 ! CHECK: %[[C_st_0:[-0-9a-z_]+]] = arith.constant -2.000000e+00 : f32
148 ! CHECK: %[[C_0:[-0-9a-z_]+]] = arith.constant 0 : index
149 ! CHECK: %[[V_0:[0-9]+]] = fir.load %arg0 : !fir.ref<i32>
150 ! CHECK: %[[V_1:[0-9]+]] = fir.convert %[[V_0:[0-9]+]] : (i32) -> index
151 ! CHECK: %[[V_2:[0-9]+]] = arith.cmpi sgt, %[[V_1]], %[[C_0]] : index
152 ! CHECK: %[[V_3:[0-9]+]] = arith.select %[[V_2]], %[[V_1]], %[[C_0]] : index
153 ! CHECK: %[[V_4:[0-9]+]] = fir.alloca !fir.array<2x?xf32>, %[[V_3]] {bindc_name = "aa", uniq_name = "_QFss3Eaa"}
154 ! CHECK: %[[V_5:[0-9]+]] = fir.shape %[[C_2]], %[[V_3:[0-9]+]] : (index, index) -> !fir.shape<2>
155 ! CHECK: cf.br ^bb1(%[[C_0]], %[[V_3:[0-9]+]] : index, index)
156 ! CHECK: ^bb1(%[[V_6:[0-9]+]]: index, %[[V_7:[0-9]+]]: index): // 2 preds: ^bb0, ^bb4
157 ! CHECK: %[[V_8:[0-9]+]] = arith.cmpi sgt, %[[V_7]], %[[C_0]] : index
158 ! CHECK: cf.cond_br %[[V_8]], ^bb2(%[[C_0]], %[[C_2]] : index, index), ^bb5
159 ! CHECK: ^bb2(%[[V_9:[0-9]+]]: index, %[[V_10:[0-9]+]]: index): // 2 preds: ^bb1, ^bb3
160 ! CHECK: %[[V_11:[0-9]+]] = arith.cmpi sgt, %[[V_10]], %[[C_0]] : index
161 ! CHECK: cf.cond_br %[[V_11]], ^bb3, ^bb4
162 ! CHECK: ^bb3: // pred: ^bb2
163 ! CHECK: %[[V_12:[0-9]+]] = arith.addi %[[V_9]], %[[C_1]] : index
164 ! CHECK: %[[V_13:[0-9]+]] = arith.addi %[[V_6]], %[[C_1]] : index
165 ! CHECK: %[[V_14:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_12]], %[[V_13:[0-9]+]] : (!fir.ref<!fir.array<2x?xf32>>, !fir.shape<2>, index, index) -> !fir.ref<f32>
166 ! CHECK: fir.store %[[C_st_0]] to %[[V_14:[0-9]+]] : !fir.ref<f32>
167 ! CHECK: %[[V_15:[0-9]+]] = arith.subi %[[V_10]], %[[C_1]] : index
168 ! CHECK: cf.br ^bb2(%[[V_12]], %[[V_15:[0-9]+]] : index, index)
169 ! CHECK: ^bb4: // pred: ^bb2
170 ! CHECK: %[[V_16:[0-9]+]] = arith.addi %[[V_6]], %[[C_1]] : index
171 ! CHECK: %[[V_17:[0-9]+]] = arith.subi %[[V_7]], %[[C_1]] : index
172 ! CHECK: cf.br ^bb1(%[[V_16]], %[[V_17:[0-9]+]] : index, index)
173 ! CHECK: ^bb5: // pred: ^bb1
174 ! CHECK: %[[V_18:[0-9]+]] = fir.load %arg0 : !fir.ref<i32>
175 ! CHECK: %[[V_19:[0-9]+]] = fir.convert %[[V_18:[0-9]+]] : (i32) -> index
176 ! CHECK: %[[V_20:[0-9]+]] = arith.addi %[[V_19]], %[[C_m1]] : index
177 ! CHECK: %[[V_21:[0-9]+]] = arith.cmpi sgt, %[[V_20]], %[[C_0]] : index
178 ! CHECK: %[[V_22:[0-9]+]] = arith.select %[[V_21]], %[[V_20]], %[[C_0]] : index
179 ! CHECK: %[[V_23:[0-9]+]] = fir.slice %[[C_1]], %[[C_2]], %[[C_1]], %[[C_2]], %[[V_19]], %[[C_1]] : (index, index, index, index, index, index) -> !fir.slice<2>
180 ! CHECK: %[[V_24:[0-9]+]] = fir.allocmem !fir.array<2x?xf32>, %[[V_3]]
181 ! CHECK: cf.br ^bb6(%[[C_0]], %[[V_3:[0-9]+]] : index, index)
182 ! CHECK: ^bb6(%[[V_25:[0-9]+]]: index, %[[V_26:[0-9]+]]: index): // 2 preds: ^bb5, ^bb9
183 ! CHECK: %[[V_27:[0-9]+]] = arith.cmpi sgt, %[[V_26]], %[[C_0]] : index
184 ! CHECK: cf.cond_br %[[V_27]], ^bb7(%[[C_0]], %[[C_2]] : index, index), ^bb10
185 ! CHECK: ^bb7(%[[V_28:[0-9]+]]: index, %[[V_29:[0-9]+]]: index): // 2 preds: ^bb6, ^bb8
186 ! CHECK: %[[V_30:[0-9]+]] = arith.cmpi sgt, %[[V_29]], %[[C_0]] : index
187 ! CHECK: cf.cond_br %[[V_30]], ^bb8, ^bb9
188 ! CHECK: ^bb8: // pred: ^bb7
189 ! CHECK: %[[V_31:[0-9]+]] = arith.addi %[[V_28]], %[[C_1]] : index
190 ! CHECK: %[[V_32:[0-9]+]] = arith.addi %[[V_25]], %[[C_1]] : index
191 ! CHECK: %[[V_33:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_31]], %[[V_32:[0-9]+]] : (!fir.ref<!fir.array<2x?xf32>>, !fir.shape<2>, index, index) -> !fir.ref<f32>
192 ! CHECK: %[[V_34:[0-9]+]] = fir.array_coor %[[V_24]](%[[V_5]]) %[[V_31]], %[[V_32:[0-9]+]] : (!fir.heap<!fir.array<2x?xf32>>, !fir.shape<2>, index, index) -> !fir.ref<f32>
193 ! CHECK: %[[V_35:[0-9]+]] = fir.load %[[V_33:[0-9]+]] : !fir.ref<f32>
194 ! CHECK: fir.store %[[V_35]] to %[[V_34:[0-9]+]] : !fir.ref<f32>
195 ! CHECK: %[[V_36:[0-9]+]] = arith.subi %[[V_29]], %[[C_1]] : index
196 ! CHECK: cf.br ^bb7(%[[V_31]], %[[V_36:[0-9]+]] : index, index)
197 ! CHECK: ^bb9: // pred: ^bb7
198 ! CHECK: %[[V_37:[0-9]+]] = arith.addi %[[V_25]], %[[C_1]] : index
199 ! CHECK: %[[V_38:[0-9]+]] = arith.subi %[[V_26]], %[[C_1]] : index
200 ! CHECK: cf.br ^bb6(%[[V_37]], %[[V_38:[0-9]+]] : index, index)
201 ! CHECK: ^bb10: // pred: ^bb6
202 ! CHECK: %[[V_39:[0-9]+]] = arith.subi %[[V_18]], %[[C_1_i32]] : i32
203 ! CHECK: %[[V_40:[0-9]+]] = fir.convert %[[V_39:[0-9]+]] : (i32) -> index
204 ! CHECK: %[[V_41:[0-9]+]] = fir.slice %[[C_1]], %[[C_2]], %[[C_1]], %[[C_1]], %[[V_40]], %[[C_1]] : (index, index, index, index, index, index) -> !fir.slice<2>
205 ! CHECK: cf.br ^bb11(%[[C_0]], %[[V_22:[0-9]+]] : index, index)
206 ! CHECK: ^bb11(%[[V_42:[0-9]+]]: index, %[[V_43:[0-9]+]]: index): // 2 preds: ^bb10, ^bb14
207 ! CHECK: %[[V_44:[0-9]+]] = arith.cmpi sgt, %[[V_43]], %[[C_0]] : index
208 ! CHECK: cf.cond_br %[[V_44]], ^bb12(%[[C_0]], %[[C_2]] : index, index), ^bb15(%[[C_0]], %[[V_3:[0-9]+]] : index, index)
209 ! CHECK: ^bb12(%[[V_45:[0-9]+]]: index, %[[V_46:[0-9]+]]: index): // 2 preds: ^bb11, ^bb13
210 ! CHECK: %[[V_47:[0-9]+]] = arith.cmpi sgt, %[[V_46]], %[[C_0]] : index
211 ! CHECK: cf.cond_br %[[V_47]], ^bb13, ^bb14
212 ! CHECK: ^bb13: // pred: ^bb12
213 ! CHECK: %[[V_48:[0-9]+]] = arith.addi %[[V_45]], %[[C_1]] : index
214 ! CHECK: %[[V_49:[0-9]+]] = arith.addi %[[V_42]], %[[C_1]] : index
215 ! CHECK: %[[V_50:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) [%[[V_41]]] %[[V_48]], %[[V_49:[0-9]+]] : (!fir.ref<!fir.array<2x?xf32>>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref<f32>
216 ! CHECK: %[[V_51:[0-9]+]] = fir.load %[[V_50:[0-9]+]] : !fir.ref<f32>
217 ! CHECK: %[[V_52:[0-9]+]] = arith.addf %[[V_51]], %[[C_st]] fastmath<contract> : f32
218 ! CHECK: %[[V_53:[0-9]+]] = fir.array_coor %[[V_24]](%[[V_5]]) [%[[V_23]]] %[[V_48]], %[[V_49:[0-9]+]] : (!fir.heap<!fir.array<2x?xf32>>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref<f32>
219 ! CHECK: fir.store %[[V_52]] to %[[V_53:[0-9]+]] : !fir.ref<f32>
220 ! CHECK: %[[V_54:[0-9]+]] = arith.subi %[[V_46]], %[[C_1]] : index
221 ! CHECK: cf.br ^bb12(%[[V_48]], %[[V_54:[0-9]+]] : index, index)
222 ! CHECK: ^bb14: // pred: ^bb12
223 ! CHECK: %[[V_55:[0-9]+]] = arith.addi %[[V_42]], %[[C_1]] : index
224 ! CHECK: %[[V_56:[0-9]+]] = arith.subi %[[V_43]], %[[C_1]] : index
225 ! CHECK: cf.br ^bb11(%[[V_55]], %[[V_56:[0-9]+]] : index, index)
226 ! CHECK: ^bb15(%[[V_57:[0-9]+]]: index, %[[V_58:[0-9]+]]: index): // 2 preds: ^bb11, ^bb18
227 ! CHECK: %[[V_59:[0-9]+]] = arith.cmpi sgt, %[[V_58]], %[[C_0]] : index
228 ! CHECK: cf.cond_br %[[V_59]], ^bb16(%[[C_0]], %[[C_2]] : index, index), ^bb19
229 ! CHECK: ^bb16(%[[V_60:[0-9]+]]: index, %[[V_61:[0-9]+]]: index): // 2 preds: ^bb15, ^bb17
230 ! CHECK: %[[V_62:[0-9]+]] = arith.cmpi sgt, %[[V_61]], %[[C_0]] : index
231 ! CHECK: cf.cond_br %[[V_62]], ^bb17, ^bb18
232 ! CHECK: ^bb17: // pred: ^bb16
233 ! CHECK: %[[V_63:[0-9]+]] = arith.addi %[[V_60]], %[[C_1]] : index
234 ! CHECK: %[[V_64:[0-9]+]] = arith.addi %[[V_57]], %[[C_1]] : index
235 ! CHECK: %[[V_65:[0-9]+]] = fir.array_coor %[[V_24]](%[[V_5]]) %[[V_63]], %[[V_64:[0-9]+]] : (!fir.heap<!fir.array<2x?xf32>>, !fir.shape<2>, index, index) -> !fir.ref<f32>
236 ! CHECK: %[[V_66:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_63]], %[[V_64:[0-9]+]] : (!fir.ref<!fir.array<2x?xf32>>, !fir.shape<2>, index, index) -> !fir.ref<f32>
237 ! CHECK: %[[V_67:[0-9]+]] = fir.load %[[V_65:[0-9]+]] : !fir.ref<f32>
238 ! CHECK: fir.store %[[V_67]] to %[[V_66:[0-9]+]] : !fir.ref<f32>
239 ! CHECK: %[[V_68:[0-9]+]] = arith.subi %[[V_61]], %[[C_1]] : index
240 ! CHECK: cf.br ^bb16(%[[V_63]], %[[V_68:[0-9]+]] : index, index)
241 ! CHECK: ^bb18: // pred: ^bb16
242 ! CHECK: %[[V_69:[0-9]+]] = arith.addi %[[V_57]], %[[C_1]] : index
243 ! CHECK: %[[V_70:[0-9]+]] = arith.subi %[[V_58]], %[[C_1]] : index
244 ! CHECK: cf.br ^bb15(%[[V_69]], %[[V_70:[0-9]+]] : index, index)
245 ! CHECK: ^bb19: // pred: ^bb15
246 ! CHECK: fir.freemem %[[V_24:[0-9]+]] : !fir.heap<!fir.array<2x?xf32>>
247 ! CHECK: %[[V_73:[0-9]+]] = fir.call @_FortranAioBeginExternalListOutput(%[[C_m1_i32]], %{{.*}}, %{{.*}}) {{.*}}: (i32, !fir.ref<i8>, i32) -> !fir.ref<i8>
248 ! CHECK: %[[V_74:[0-9]+]] = fir.slice %[[C_1]], %[[C_2]], %[[C_1]], %[[C_1]], %[[C_2]], %[[C_1]] : (index, index, index, index, index, index) -> !fir.slice<2>
249 ! CHECK: %[[V_75:[0-9]+]] = fir.embox %[[V_4]](%[[V_5]]) [%[[V_74]]] : (!fir.ref<!fir.array<2x?xf32>>, !fir.shape<2>, !fir.slice<2>) -> !fir.box<!fir.array<?x2xf32>>
250 ! CHECK: %[[V_76:[0-9]+]] = fir.convert %[[V_75:[0-9]+]] : (!fir.box<!fir.array<?x2xf32>>) -> !fir.box<none>
251 ! CHECK: %[[V_77:[0-9]+]] = fir.call @_FortranAioOutputDescriptor(%[[V_73]], %[[V_76]]) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>) -> i1
252 ! CHECK: %[[V_78:[0-9]+]] = fir.load %arg0 : !fir.ref<i32>
253 ! CHECK: %[[V_79:[0-9]+]] = arith.subi %[[V_78]], %[[C_1_i32]] : i32
254 ! CHECK: %[[V_80:[0-9]+]] = fir.convert %[[V_79:[0-9]+]] : (i32) -> index
255 ! CHECK: %[[V_81:[0-9]+]] = fir.convert %[[V_78:[0-9]+]] : (i32) -> index
256 ! CHECK: %[[V_82:[0-9]+]] = fir.slice %[[C_1]], %[[C_2]], %[[C_1]], %[[V_80]], %[[V_81]], %[[C_1]] : (index, index, index, index, index, index) -> !fir.slice<2>
257 ! CHECK: %[[V_83:[0-9]+]] = fir.embox %[[V_4]](%[[V_5]]) [%[[V_82]]] : (!fir.ref<!fir.array<2x?xf32>>, !fir.shape<2>, !fir.slice<2>) -> !fir.box<!fir.array<?x?xf32>>
258 ! CHECK: %[[V_84:[0-9]+]] = fir.convert %[[V_83:[0-9]+]] : (!fir.box<!fir.array<?x?xf32>>) -> !fir.box<none>
259 ! CHECK: %[[V_85:[0-9]+]] = fir.call @_FortranAioOutputDescriptor(%[[V_73]], %[[V_84]]) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>) -> i1
260 ! CHECK: %[[V_86:[0-9]+]] = fir.call @_FortranAioEndIoStatement(%[[V_73]]) fastmath<contract> : (!fir.ref<i8>) -> i32
261 ! CHECK: return
262 ! CHECK: }
264 ! CHECK-LABEL: func @_QPss4(
265 ! CHECK-SAME: %arg0: !fir.ref<i32> {fir.bindc_name = "n"}) {
266 ! CHECK: %[[C_2:[-0-9a-z_]+]] = arith.constant 2 : index
267 ! CHECK: %[[C_m1:[-0-9a-z_]+]] = arith.constant -1 : index
268 ! CHECK: %[[C_1:[-0-9a-z_]+]] = arith.constant 1 : index
269 ! CHECK: %[[C_41_i32:[-0-9a-z_]+]] = arith.constant 41 : i32
270 ! CHECK: %[[C_m1_i32:[-0-9a-z_]+]] = arith.constant -1 : i32
271 ! CHECK: %[[C_st:[-0-9a-z_]+]] = arith.constant 7.000000e+00 : f32
272 ! CHECK: %[[C_1_i32:[-0-9a-z_]+]] = arith.constant 1 : i32
273 ! CHECK: %[[C_st_0:[-0-9a-z_]+]] = arith.constant -2.000000e+00 : f32
274 ! CHECK: %[[C_0:[-0-9a-z_]+]] = arith.constant 0 : index
275 ! CHECK: %[[V_0:[0-9]+]] = fir.load %arg0 : !fir.ref<i32>
276 ! CHECK: %[[V_1:[0-9]+]] = fir.convert %[[V_0:[0-9]+]] : (i32) -> index
277 ! CHECK: %[[V_2:[0-9]+]] = arith.cmpi sgt, %[[V_1]], %[[C_0]] : index
278 ! CHECK: %[[V_3:[0-9]+]] = arith.select %[[V_2]], %[[V_1]], %[[C_0]] : index
279 ! CHECK: %[[V_4:[0-9]+]] = fir.alloca !fir.array<?x2xf32>, %[[V_3]] {bindc_name = "aa", uniq_name = "_QFss4Eaa"}
280 ! CHECK: %[[V_5:[0-9]+]] = fir.shape %[[V_3]], %[[C_2]] : (index, index) -> !fir.shape<2>
281 ! CHECK: cf.br ^bb1(%[[C_0]], %[[C_2]] : index, index)
282 ! CHECK: ^bb1(%[[V_6:[0-9]+]]: index, %[[V_7:[0-9]+]]: index): // 2 preds: ^bb0, ^bb4
283 ! CHECK: %[[V_8:[0-9]+]] = arith.cmpi sgt, %[[V_7]], %[[C_0]] : index
284 ! CHECK: cf.cond_br %[[V_8]], ^bb2(%[[C_0]], %[[V_3:[0-9]+]] : index, index), ^bb5
285 ! CHECK: ^bb2(%[[V_9:[0-9]+]]: index, %[[V_10:[0-9]+]]: index): // 2 preds: ^bb1, ^bb3
286 ! CHECK: %[[V_11:[0-9]+]] = arith.cmpi sgt, %[[V_10]], %[[C_0]] : index
287 ! CHECK: cf.cond_br %[[V_11]], ^bb3, ^bb4
288 ! CHECK: ^bb3: // pred: ^bb2
289 ! CHECK: %[[V_12:[0-9]+]] = arith.addi %[[V_9]], %[[C_1]] : index
290 ! CHECK: %[[V_13:[0-9]+]] = arith.addi %[[V_6]], %[[C_1]] : index
291 ! CHECK: %[[V_14:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_12]], %[[V_13:[0-9]+]] : (!fir.ref<!fir.array<?x2xf32>>, !fir.shape<2>, index, index) -> !fir.ref<f32>
292 ! CHECK: fir.store %[[C_st_0]] to %[[V_14:[0-9]+]] : !fir.ref<f32>
293 ! CHECK: %[[V_15:[0-9]+]] = arith.subi %[[V_10]], %[[C_1]] : index
294 ! CHECK: cf.br ^bb2(%[[V_12]], %[[V_15:[0-9]+]] : index, index)
295 ! CHECK: ^bb4: // pred: ^bb2
296 ! CHECK: %[[V_16:[0-9]+]] = arith.addi %[[V_6]], %[[C_1]] : index
297 ! CHECK: %[[V_17:[0-9]+]] = arith.subi %[[V_7]], %[[C_1]] : index
298 ! CHECK: cf.br ^bb1(%[[V_16]], %[[V_17:[0-9]+]] : index, index)
299 ! CHECK: ^bb5: // pred: ^bb1
300 ! CHECK: %[[V_18:[0-9]+]] = fir.load %arg0 : !fir.ref<i32>
301 ! CHECK: %[[V_19:[0-9]+]] = fir.convert %[[V_18:[0-9]+]] : (i32) -> index
302 ! CHECK: %[[V_20:[0-9]+]] = arith.addi %[[V_19]], %[[C_m1]] : index
303 ! CHECK: %[[V_21:[0-9]+]] = arith.cmpi sgt, %[[V_20]], %[[C_0]] : index
304 ! CHECK: %[[V_22:[0-9]+]] = arith.select %[[V_21]], %[[V_20]], %[[C_0]] : index
305 ! CHECK: %[[V_23:[0-9]+]] = fir.slice %[[C_2]], %[[V_19]], %[[C_1]], %[[C_1]], %[[C_2]], %[[C_1]] : (index, index, index, index, index, index) -> !fir.slice<2>
306 ! CHECK: %[[V_24:[0-9]+]] = fir.allocmem !fir.array<?x2xf32>, %[[V_3]]
307 ! CHECK: cf.br ^bb6(%[[C_0]], %[[C_2]] : index, index)
308 ! CHECK: ^bb6(%[[V_25:[0-9]+]]: index, %[[V_26:[0-9]+]]: index): // 2 preds: ^bb5, ^bb9
309 ! CHECK: %[[V_27:[0-9]+]] = arith.cmpi sgt, %[[V_26]], %[[C_0]] : index
310 ! CHECK: cf.cond_br %[[V_27]], ^bb7(%[[C_0]], %[[V_3:[0-9]+]] : index, index), ^bb10
311 ! CHECK: ^bb7(%[[V_28:[0-9]+]]: index, %[[V_29:[0-9]+]]: index): // 2 preds: ^bb6, ^bb8
312 ! CHECK: %[[V_30:[0-9]+]] = arith.cmpi sgt, %[[V_29]], %[[C_0]] : index
313 ! CHECK: cf.cond_br %[[V_30]], ^bb8, ^bb9
314 ! CHECK: ^bb8: // pred: ^bb7
315 ! CHECK: %[[V_31:[0-9]+]] = arith.addi %[[V_28]], %[[C_1]] : index
316 ! CHECK: %[[V_32:[0-9]+]] = arith.addi %[[V_25]], %[[C_1]] : index
317 ! CHECK: %[[V_33:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_31]], %[[V_32:[0-9]+]] : (!fir.ref<!fir.array<?x2xf32>>, !fir.shape<2>, index, index) -> !fir.ref<f32>
318 ! CHECK: %[[V_34:[0-9]+]] = fir.array_coor %[[V_24]](%[[V_5]]) %[[V_31]], %[[V_32:[0-9]+]] : (!fir.heap<!fir.array<?x2xf32>>, !fir.shape<2>, index, index) -> !fir.ref<f32>
319 ! CHECK: %[[V_35:[0-9]+]] = fir.load %[[V_33:[0-9]+]] : !fir.ref<f32>
320 ! CHECK: fir.store %[[V_35]] to %[[V_34:[0-9]+]] : !fir.ref<f32>
321 ! CHECK: %[[V_36:[0-9]+]] = arith.subi %[[V_29]], %[[C_1]] : index
322 ! CHECK: cf.br ^bb7(%[[V_31]], %[[V_36:[0-9]+]] : index, index)
323 ! CHECK: ^bb9: // pred: ^bb7
324 ! CHECK: %[[V_37:[0-9]+]] = arith.addi %[[V_25]], %[[C_1]] : index
325 ! CHECK: %[[V_38:[0-9]+]] = arith.subi %[[V_26]], %[[C_1]] : index
326 ! CHECK: cf.br ^bb6(%[[V_37]], %[[V_38:[0-9]+]] : index, index)
327 ! CHECK: ^bb10: // pred: ^bb6
328 ! CHECK: %[[V_39:[0-9]+]] = arith.subi %[[V_18]], %[[C_1_i32]] : i32
329 ! CHECK: %[[V_40:[0-9]+]] = fir.convert %[[V_39:[0-9]+]] : (i32) -> index
330 ! CHECK: %[[V_41:[0-9]+]] = fir.slice %[[C_1]], %[[V_40]], %[[C_1]], %[[C_1]], %[[C_2]], %[[C_1]] : (index, index, index, index, index, index) -> !fir.slice<2>
331 ! CHECK: cf.br ^bb11(%[[C_0]], %[[C_2]] : index, index)
332 ! CHECK: ^bb11(%[[V_42:[0-9]+]]: index, %[[V_43:[0-9]+]]: index): // 2 preds: ^bb10, ^bb14
333 ! CHECK: %[[V_44:[0-9]+]] = arith.cmpi sgt, %[[V_43]], %[[C_0]] : index
334 ! CHECK: cf.cond_br %[[V_44]], ^bb12(%[[C_0]], %[[V_22:[0-9]+]] : index, index), ^bb15(%[[C_0]], %[[C_2]] : index, index)
335 ! CHECK: ^bb12(%[[V_45:[0-9]+]]: index, %[[V_46:[0-9]+]]: index): // 2 preds: ^bb11, ^bb13
336 ! CHECK: %[[V_47:[0-9]+]] = arith.cmpi sgt, %[[V_46]], %[[C_0]] : index
337 ! CHECK: cf.cond_br %[[V_47]], ^bb13, ^bb14
338 ! CHECK: ^bb13: // pred: ^bb12
339 ! CHECK: %[[V_48:[0-9]+]] = arith.addi %[[V_45]], %[[C_1]] : index
340 ! CHECK: %[[V_49:[0-9]+]] = arith.addi %[[V_42]], %[[C_1]] : index
341 ! CHECK: %[[V_50:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) [%[[V_41]]] %[[V_48]], %[[V_49:[0-9]+]] : (!fir.ref<!fir.array<?x2xf32>>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref<f32>
342 ! CHECK: %[[V_51:[0-9]+]] = fir.load %[[V_50:[0-9]+]] : !fir.ref<f32>
343 ! CHECK: %[[V_52:[0-9]+]] = arith.addf %[[V_51]], %[[C_st]] fastmath<contract> : f32
344 ! CHECK: %[[V_53:[0-9]+]] = fir.array_coor %[[V_24]](%[[V_5]]) [%[[V_23]]] %[[V_48]], %[[V_49:[0-9]+]] : (!fir.heap<!fir.array<?x2xf32>>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref<f32>
345 ! CHECK: fir.store %[[V_52]] to %[[V_53:[0-9]+]] : !fir.ref<f32>
346 ! CHECK: %[[V_54:[0-9]+]] = arith.subi %[[V_46]], %[[C_1]] : index
347 ! CHECK: cf.br ^bb12(%[[V_48]], %[[V_54:[0-9]+]] : index, index)
348 ! CHECK: ^bb14: // pred: ^bb12
349 ! CHECK: %[[V_55:[0-9]+]] = arith.addi %[[V_42]], %[[C_1]] : index
350 ! CHECK: %[[V_56:[0-9]+]] = arith.subi %[[V_43]], %[[C_1]] : index
351 ! CHECK: cf.br ^bb11(%[[V_55]], %[[V_56:[0-9]+]] : index, index)
352 ! CHECK: ^bb15(%[[V_57:[0-9]+]]: index, %[[V_58:[0-9]+]]: index): // 2 preds: ^bb11, ^bb18
353 ! CHECK: %[[V_59:[0-9]+]] = arith.cmpi sgt, %[[V_58]], %[[C_0]] : index
354 ! CHECK: cf.cond_br %[[V_59]], ^bb16(%[[C_0]], %[[V_3:[0-9]+]] : index, index), ^bb19
355 ! CHECK: ^bb16(%[[V_60:[0-9]+]]: index, %[[V_61:[0-9]+]]: index): // 2 preds: ^bb15, ^bb17
356 ! CHECK: %[[V_62:[0-9]+]] = arith.cmpi sgt, %[[V_61]], %[[C_0]] : index
357 ! CHECK: cf.cond_br %[[V_62]], ^bb17, ^bb18
358 ! CHECK: ^bb17: // pred: ^bb16
359 ! CHECK: %[[V_63:[0-9]+]] = arith.addi %[[V_60]], %[[C_1]] : index
360 ! CHECK: %[[V_64:[0-9]+]] = arith.addi %[[V_57]], %[[C_1]] : index
361 ! CHECK: %[[V_65:[0-9]+]] = fir.array_coor %[[V_24]](%[[V_5]]) %[[V_63]], %[[V_64:[0-9]+]] : (!fir.heap<!fir.array<?x2xf32>>, !fir.shape<2>, index, index) -> !fir.ref<f32>
362 ! CHECK: %[[V_66:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_63]], %[[V_64:[0-9]+]] : (!fir.ref<!fir.array<?x2xf32>>, !fir.shape<2>, index, index) -> !fir.ref<f32>
363 ! CHECK: %[[V_67:[0-9]+]] = fir.load %[[V_65:[0-9]+]] : !fir.ref<f32>
364 ! CHECK: fir.store %[[V_67]] to %[[V_66:[0-9]+]] : !fir.ref<f32>
365 ! CHECK: %[[V_68:[0-9]+]] = arith.subi %[[V_61]], %[[C_1]] : index
366 ! CHECK: cf.br ^bb16(%[[V_63]], %[[V_68:[0-9]+]] : index, index)
367 ! CHECK: ^bb18: // pred: ^bb16
368 ! CHECK: %[[V_69:[0-9]+]] = arith.addi %[[V_57]], %[[C_1]] : index
369 ! CHECK: %[[V_70:[0-9]+]] = arith.subi %[[V_58]], %[[C_1]] : index
370 ! CHECK: cf.br ^bb15(%[[V_69]], %[[V_70:[0-9]+]] : index, index)
371 ! CHECK: ^bb19: // pred: ^bb15
372 ! CHECK: fir.freemem %[[V_24:[0-9]+]] : !fir.heap<!fir.array<?x2xf32>>
373 ! CHECK: %[[V_73:[0-9]+]] = fir.call @_FortranAioBeginExternalListOutput(%[[C_m1_i32]], %{{.*}}, %{{.*}}) {{.*}}: (i32, !fir.ref<i8>, i32) -> !fir.ref<i8>
374 ! CHECK: %[[V_74:[0-9]+]] = fir.slice %[[C_1]], %[[C_2]], %[[C_1]], %[[C_1]], %[[C_2]], %[[C_1]] : (index, index, index, index, index, index) -> !fir.slice<2>
375 ! CHECK: %[[V_75:[0-9]+]] = fir.embox %[[V_4]](%[[V_5]]) [%[[V_74]]] : (!fir.ref<!fir.array<?x2xf32>>, !fir.shape<2>, !fir.slice<2>) -> !fir.box<!fir.array<2x?xf32>>
376 ! CHECK: %[[V_76:[0-9]+]] = fir.convert %[[V_75:[0-9]+]] : (!fir.box<!fir.array<2x?xf32>>) -> !fir.box<none>
377 ! CHECK: %[[V_77:[0-9]+]] = fir.call @_FortranAioOutputDescriptor(%[[V_73]], %[[V_76]]) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>) -> i1
378 ! CHECK: %[[V_78:[0-9]+]] = fir.load %arg0 : !fir.ref<i32>
379 ! CHECK: %[[V_79:[0-9]+]] = arith.subi %[[V_78]], %[[C_1_i32]] : i32
380 ! CHECK: %[[V_80:[0-9]+]] = fir.convert %[[V_79:[0-9]+]] : (i32) -> index
381 ! CHECK: %[[V_81:[0-9]+]] = fir.convert %[[V_78:[0-9]+]] : (i32) -> index
382 ! CHECK: %[[V_82:[0-9]+]] = fir.slice %[[V_80]], %[[V_81]], %[[C_1]], %[[C_1]], %[[C_2]], %[[C_1]] : (index, index, index, index, index, index) -> !fir.slice<2>
383 ! CHECK: %[[V_83:[0-9]+]] = fir.embox %[[V_4]](%[[V_5]]) [%[[V_82]]] : (!fir.ref<!fir.array<?x2xf32>>, !fir.shape<2>, !fir.slice<2>) -> !fir.box<!fir.array<?x?xf32>>
384 ! CHECK: %[[V_84:[0-9]+]] = fir.convert %[[V_83:[0-9]+]] : (!fir.box<!fir.array<?x?xf32>>) -> !fir.box<none>
385 ! CHECK: %[[V_85:[0-9]+]] = fir.call @_FortranAioOutputDescriptor(%[[V_73]], %[[V_84]]) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>) -> i1
386 ! CHECK: %[[V_86:[0-9]+]] = fir.call @_FortranAioEndIoStatement(%[[V_73]]) fastmath<contract> : (!fir.ref<i8>) -> i32
387 ! CHECK: return
388 ! CHECK: }
390 ! CHECK-LABEL: func @_QPtt1
391 subroutine tt1
392 ! CHECK: fir.call @_FortranAioBeginExternalListOutput
393 ! CHECK: %[[temp3:[0-9]+]] = fir.allocmem !fir.array<3xf32>
394 ! CHECK: br ^bb1(%[[temp3]]
395 ! CHECK-NEXT: ^bb1(%[[temp3arg:[0-9]+]]: !fir.heap<!fir.array<3xf32>>
396 ! CHECK: %[[temp1:[0-9]+]] = fir.allocmem !fir.array<1xf32>
397 ! CHECK: fir.call @_QFtt1Pr
398 ! CHECK: fir.call @realloc
399 ! CHECK: fir.freemem %[[temp1]] : !fir.heap<!fir.array<1xf32>>
400 ! CHECK: %[[temp3x:[0-9]+]] = fir.allocmem !fir.array<3xf32>
401 ! CHECK: fir.call @_FortranAioOutputDescriptor
402 ! CHECK-NEXT: fir.freemem %[[temp3x]] : !fir.heap<!fir.array<3xf32>>
403 ! CHECK-NEXT: fir.freemem %[[temp3arg]] : !fir.heap<!fir.array<3xf32>>
404 ! CHECK-NEXT: fir.call @_FortranAioEndIoStatement
405 print*, [(r([7.0]),i=1,3)]
406 contains
407 ! CHECK-LABEL: func @_QFtt1Pr
408 function r(x)
409 real x(:)
410 r = x(1)