1 // RUN: fir-opt --split-input-file --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s | FileCheck %s
2 // RUN: fir-opt --split-input-file --fir-to-llvm-ir="target=aarch64-unknown-linux-gnu" %s | FileCheck %s
3 // RUN: fir-opt --split-input-file --fir-to-llvm-ir="target=i386-unknown-linux-gnu" %s | FileCheck %s
4 // RUN: fir-opt --split-input-file --fir-to-llvm-ir="target=powerpc64le-unknown-linux-gn" %s | FileCheck %s
7 // CHECK-LABEL: @test_l1_i1
8 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i8
9 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i8
10 // CHECK: llvm.return [[t1]] : i1
11 func.func @test_l1_i1(%arg0: !fir.logical<1>) -> i1 {
12 %0 = fir.convert %arg0 : (!fir.logical<1>) -> i1
16 // CHECK-LABEL: @test_l1_i8
17 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i8
18 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i8
19 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i8
20 // CHECK: llvm.return [[t2]] : i8
21 func.func @test_l1_i8(%arg0: !fir.logical<1>) -> i8 {
22 %0 = fir.convert %arg0 : (!fir.logical<1>) -> i8
26 // CHECK-LABEL: @test_l1_i16
27 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i8
28 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i8
29 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i16
30 // CHECK: llvm.return [[t2]] : i16
31 func.func @test_l1_i16(%arg0: !fir.logical<1>) -> i16 {
32 %0 = fir.convert %arg0 : (!fir.logical<1>) -> i16
36 // CHECK-LABEL: @test_l1_i32
37 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i8
38 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i8
39 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i32
40 // CHECK: llvm.return [[t2]] : i32
41 func.func @test_l1_i32(%arg0: !fir.logical<1>) -> i32 {
42 %0 = fir.convert %arg0 : (!fir.logical<1>) -> i32
46 // CHECK-LABEL: @test_l1_i64
47 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i8
48 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i8
49 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i64
50 // CHECK: llvm.return [[t2]] : i64
51 func.func @test_l1_i64(%arg0: !fir.logical<1>) -> i64 {
52 %0 = fir.convert %arg0 : (!fir.logical<1>) -> i64
56 // CHECK-LABEL: @test_l2_i1
57 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i16
58 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i16
59 // CHECK: llvm.return [[t1]] : i1
60 func.func @test_l2_i1(%arg0: !fir.logical<2>) -> i1 {
61 %0 = fir.convert %arg0 : (!fir.logical<2>) -> i1
65 // CHECK-LABEL: @test_l2_i8
66 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i16
67 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i16
68 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i8
69 // CHECK: llvm.return [[t2]] : i8
70 func.func @test_l2_i8(%arg0: !fir.logical<2>) -> i8 {
71 %0 = fir.convert %arg0 : (!fir.logical<2>) -> i8
75 // CHECK-LABEL: @test_l2_i16
76 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i16
77 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i16
78 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i16
79 // CHECK: llvm.return [[t2]] : i16
80 func.func @test_l2_i16(%arg0: !fir.logical<2>) -> i16 {
81 %0 = fir.convert %arg0 : (!fir.logical<2>) -> i16
85 // CHECK-LABEL: @test_l2_i32
86 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i16
87 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i16
88 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i32
89 // CHECK: llvm.return [[t2]] : i32
90 func.func @test_l2_i32(%arg0: !fir.logical<2>) -> i32 {
91 %0 = fir.convert %arg0 : (!fir.logical<2>) -> i32
95 // CHECK-LABEL: @test_l2_i64
96 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i16
97 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i16
98 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i64
99 // CHECK: llvm.return [[t2]] : i64
100 func.func @test_l2_i64(%arg0: !fir.logical<2>) -> i64 {
101 %0 = fir.convert %arg0 : (!fir.logical<2>) -> i64
105 // CHECK-LABEL: @test_l4_i1
106 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i32
107 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i32
108 // CHECK: llvm.return [[t1]] : i1
109 func.func @test_l4_i1(%arg0: !fir.logical<4>) -> i1 {
110 %0 = fir.convert %arg0 : (!fir.logical<4>) -> i1
114 // CHECK-LABEL: @test_l4_i8
115 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i32
116 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i32
117 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i8
118 // CHECK: llvm.return [[t2]] : i8
119 func.func @test_l4_i8(%arg0: !fir.logical<4>) -> i8 {
120 %0 = fir.convert %arg0 : (!fir.logical<4>) -> i8
124 // CHECK-LABEL: @test_l4_i16
125 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i32
126 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i32
127 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i16
128 // CHECK: llvm.return [[t2]] : i16
129 func.func @test_l4_i16(%arg0: !fir.logical<4>) -> i16 {
130 %0 = fir.convert %arg0 : (!fir.logical<4>) -> i16
134 // CHECK-LABEL: @test_l4_i32
135 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i32
136 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i32
137 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i32
138 // CHECK: llvm.return [[t2]] : i32
139 func.func @test_l4_i32(%arg0: !fir.logical<4>) -> i32 {
140 %0 = fir.convert %arg0 : (!fir.logical<4>) -> i32
144 // CHECK-LABEL: @test_l4_i64
145 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i32
146 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i32
147 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i64
148 // CHECK: llvm.return [[t2]] : i64
149 func.func @test_l4_i64(%arg0: !fir.logical<4>) -> i64 {
150 %0 = fir.convert %arg0 : (!fir.logical<4>) -> i64
154 // CHECK-LABEL: @test_l8_i1
155 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i64
156 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i64
157 // CHECK: llvm.return [[t1]] : i1
158 func.func @test_l8_i1(%arg0: !fir.logical<8>) -> i1 {
159 %0 = fir.convert %arg0 : (!fir.logical<8>) -> i1
163 // CHECK-LABEL: @test_l8_i8
164 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i64
165 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i64
166 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i8
167 // CHECK: llvm.return [[t2]] : i8
168 func.func @test_l8_i8(%arg0: !fir.logical<8>) -> i8 {
169 %0 = fir.convert %arg0 : (!fir.logical<8>) -> i8
173 // CHECK-LABEL: @test_l8_i16
174 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i64
175 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i64
176 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i16
177 // CHECK: llvm.return [[t2]] : i16
178 func.func @test_l8_i16(%arg0: !fir.logical<8>) -> i16 {
179 %0 = fir.convert %arg0 : (!fir.logical<8>) -> i16
183 // CHECK-LABEL: @test_l8_i32
184 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i64
185 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i64
186 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i32
187 // CHECK: llvm.return [[t2]] : i32
188 func.func @test_l8_i32(%arg0: !fir.logical<8>) -> i32 {
189 %0 = fir.convert %arg0 : (!fir.logical<8>) -> i32
193 // CHECK-LABEL: @test_l8_i64
194 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i64
195 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i64
196 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i64
197 // CHECK: llvm.return [[t2]] : i64
198 func.func @test_l8_i64(%arg0: !fir.logical<8>) -> i64 {
199 %0 = fir.convert %arg0 : (!fir.logical<8>) -> i64
203 // CHECK-LABEL: @test_i1_l1
204 // CHECK: [[t0:%[0-9]*]] = llvm.zext %arg0 : i1 to i8
205 // CHECK: llvm.return [[t0]] : i8
206 func.func @test_i1_l1(%arg0: i1) -> !fir.logical<1> {
207 %0 = fir.convert %arg0 : (i1) -> !fir.logical<1>
208 return %0 : !fir.logical<1>
211 // CHECK-LABEL: @test_i1_l2
212 // CHECK: [[t0:%[0-9]*]] = llvm.zext %arg0 : i1 to i16
213 // CHECK: llvm.return [[t0]] : i16
214 func.func @test_i1_l2(%arg0: i1) -> !fir.logical<2> {
215 %0 = fir.convert %arg0 : (i1) -> !fir.logical<2>
216 return %0 : !fir.logical<2>
219 // CHECK-LABEL: @test_i1_l4
220 // CHECK: [[t0:%[0-9]*]] = llvm.zext %arg0 : i1 to i32
221 // CHECK: llvm.return [[t0]] : i32
222 func.func @test_i1_l4(%arg0: i1) -> !fir.logical<4> {
223 %0 = fir.convert %arg0 : (i1) -> !fir.logical<4>
224 return %0 : !fir.logical<4>
227 // CHECK-LABEL: @test_i1_l8
228 // CHECK: [[t0:%[0-9]*]] = llvm.zext %arg0 : i1 to i64
229 // CHECK: llvm.return [[t0]] : i64
230 func.func @test_i1_l8(%arg0: i1) -> !fir.logical<8> {
231 %0 = fir.convert %arg0 : (i1) -> !fir.logical<8>
232 return %0 : !fir.logical<8>
235 // CHECK-LABEL: @test_i8_l1
236 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i8
237 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i8
238 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i8
239 // CHECK: llvm.return [[t2]] : i8
240 func.func @test_i8_l1(%arg0: i8) -> !fir.logical<1> {
241 %0 = fir.convert %arg0 : (i8) -> !fir.logical<1>
242 return %0 : !fir.logical<1>
245 // CHECK-LABEL: @test_i8_l2
246 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i8
247 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i8
248 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i16
249 // CHECK: llvm.return [[t2]] : i16
250 func.func @test_i8_l2(%arg0: i8) -> !fir.logical<2> {
251 %0 = fir.convert %arg0 : (i8) -> !fir.logical<2>
252 return %0 : !fir.logical<2>
255 // CHECK-LABEL: @test_i8_l4
256 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i8
257 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i8
258 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i32
259 // CHECK: llvm.return [[t2]] : i32
260 func.func @test_i8_l4(%arg0: i8) -> !fir.logical<4> {
261 %0 = fir.convert %arg0 : (i8) -> !fir.logical<4>
262 return %0 : !fir.logical<4>
265 // CHECK-LABEL: @test_i8_l8
266 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i8
267 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i8
268 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i64
269 // CHECK: llvm.return [[t2]] : i64
270 func.func @test_i8_l8(%arg0: i8) -> !fir.logical<8> {
271 %0 = fir.convert %arg0 : (i8) -> !fir.logical<8>
272 return %0 : !fir.logical<8>
275 // CHECK-LABEL: @test_i16_l1
276 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i16
277 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i16
278 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i8
279 // CHECK: llvm.return [[t2]] : i8
280 func.func @test_i16_l1(%arg0: i16) -> !fir.logical<1> {
281 %0 = fir.convert %arg0 : (i16) -> !fir.logical<1>
282 return %0 : !fir.logical<1>
285 // CHECK-LABEL: @test_i16_l2
286 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i16
287 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i16
288 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i16
289 // CHECK: llvm.return [[t2]] : i16
290 func.func @test_i16_l2(%arg0: i16) -> !fir.logical<2> {
291 %0 = fir.convert %arg0 : (i16) -> !fir.logical<2>
292 return %0 : !fir.logical<2>
295 // CHECK-LABEL: @test_i16_l4
296 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i16
297 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i16
298 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i32
299 // CHECK: llvm.return [[t2]] : i32
300 func.func @test_i16_l4(%arg0: i16) -> !fir.logical<4> {
301 %0 = fir.convert %arg0 : (i16) -> !fir.logical<4>
302 return %0 : !fir.logical<4>
305 // CHECK-LABEL: @test_i16_l8
306 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i16
307 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i16
308 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i64
309 // CHECK: llvm.return [[t2]] : i64
310 func.func @test_i16_l8(%arg0: i16) -> !fir.logical<8> {
311 %0 = fir.convert %arg0 : (i16) -> !fir.logical<8>
312 return %0 : !fir.logical<8>
315 // CHECK-LABEL: @test_i32_l1
316 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i32
317 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i32
318 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i8
319 // CHECK: llvm.return [[t2]] : i8
320 func.func @test_i32_l1(%arg0: i32) -> !fir.logical<1> {
321 %0 = fir.convert %arg0 : (i32) -> !fir.logical<1>
322 return %0 : !fir.logical<1>
325 // CHECK-LABEL: @test_i32_l2
326 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i32
327 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i32
328 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i16
329 // CHECK: llvm.return [[t2]] : i16
330 func.func @test_i32_l2(%arg0: i32) -> !fir.logical<2> {
331 %0 = fir.convert %arg0 : (i32) -> !fir.logical<2>
332 return %0 : !fir.logical<2>
335 // CHECK-LABEL: @test_i32_l4
336 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i32
337 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i32
338 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i32
339 // CHECK: llvm.return [[t2]] : i32
340 func.func @test_i32_l4(%arg0: i32) -> !fir.logical<4> {
341 %0 = fir.convert %arg0 : (i32) -> !fir.logical<4>
342 return %0 : !fir.logical<4>
345 // CHECK-LABEL: @test_i32_l8
346 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i32
347 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i32
348 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i64
349 // CHECK: llvm.return [[t2]] : i64
350 func.func @test_i32_l8(%arg0: i32) -> !fir.logical<8> {
351 %0 = fir.convert %arg0 : (i32) -> !fir.logical<8>
352 return %0 : !fir.logical<8>
355 // CHECK-LABEL: @test_i64_l1
356 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i64
357 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i64
358 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i8
359 // CHECK: llvm.return [[t2]] : i8
360 func.func @test_i64_l1(%arg0: i64) -> !fir.logical<1> {
361 %0 = fir.convert %arg0 : (i64) -> !fir.logical<1>
362 return %0 : !fir.logical<1>
365 // CHECK-LABEL: @test_i64_l2
366 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i64
367 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i64
368 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i16
369 // CHECK: llvm.return [[t2]] : i16
370 func.func @test_i64_l2(%arg0: i64) -> !fir.logical<2> {
371 %0 = fir.convert %arg0 : (i64) -> !fir.logical<2>
372 return %0 : !fir.logical<2>
375 // CHECK-LABEL: @test_i64_l4
376 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i64
377 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i64
378 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i32
379 // CHECK: llvm.return [[t2]] : i32
380 func.func @test_i64_l4(%arg0: i64) -> !fir.logical<4> {
381 %0 = fir.convert %arg0 : (i64) -> !fir.logical<4>
382 return %0 : !fir.logical<4>
385 // CHECK-LABEL: @test_i64_l8
386 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i64
387 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i64
388 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i64
389 // CHECK: llvm.return [[t2]] : i64
390 func.func @test_i64_l8(%arg0: i64) -> !fir.logical<8> {
391 %0 = fir.convert %arg0 : (i64) -> !fir.logical<8>
392 return %0 : !fir.logical<8>
395 // CHECK-LABEL: @test_l1_l2
396 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i8
397 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i8
398 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i16
399 // CHECK: llvm.return [[t2]] : i16
400 func.func @test_l1_l2(%arg0: !fir.logical<1>) -> !fir.logical<2> {
401 %0 = fir.convert %arg0 : (!fir.logical<1>) -> !fir.logical<2>
402 return %0 : !fir.logical<2>
405 // CHECK-LABEL: @test_l1_l4
406 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i8
407 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i8
408 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i32
409 // CHECK: llvm.return [[t2]] : i32
410 func.func @test_l1_l4(%arg0: !fir.logical<1>) -> !fir.logical<4> {
411 %0 = fir.convert %arg0 : (!fir.logical<1>) -> !fir.logical<4>
412 return %0 : !fir.logical<4>
415 // CHECK-LABEL: @test_l1_l8
416 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i8
417 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i8
418 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i64
419 // CHECK: llvm.return [[t2]] : i64
420 func.func @test_l1_l8(%arg0: !fir.logical<1>) -> !fir.logical<8> {
421 %0 = fir.convert %arg0 : (!fir.logical<1>) -> !fir.logical<8>
422 return %0 : !fir.logical<8>
425 // CHECK-LABEL: @test_l2_l1
426 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i16
427 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i16
428 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i8
429 // CHECK: llvm.return [[t2]] : i8
430 func.func @test_l2_l1(%arg0: !fir.logical<2>) -> !fir.logical<1> {
431 %0 = fir.convert %arg0 : (!fir.logical<2>) -> !fir.logical<1>
432 return %0 : !fir.logical<1>
435 // CHECK-LABEL: @test_l2_l4
436 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i16
437 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i16
438 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i32
439 // CHECK: llvm.return [[t2]] : i32
440 func.func @test_l2_l4(%arg0: !fir.logical<2>) -> !fir.logical<4> {
441 %0 = fir.convert %arg0 : (!fir.logical<2>) -> !fir.logical<4>
442 return %0 : !fir.logical<4>
445 // CHECK-LABEL: @test_l2_l8
446 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i16
447 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i16
448 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i64
449 // CHECK: llvm.return [[t2]] : i64
450 func.func @test_l2_l8(%arg0: !fir.logical<2>) -> !fir.logical<8> {
451 %0 = fir.convert %arg0 : (!fir.logical<2>) -> !fir.logical<8>
452 return %0 : !fir.logical<8>
455 // CHECK-LABEL: @test_l4_l1
456 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i32
457 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i32
458 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i8
459 // CHECK: llvm.return [[t2]] : i8
460 func.func @test_l4_l1(%arg0: !fir.logical<4>) -> !fir.logical<1> {
461 %0 = fir.convert %arg0 : (!fir.logical<4>) -> !fir.logical<1>
462 return %0 : !fir.logical<1>
465 // CHECK-LABEL: @test_l4_l2
466 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i32
467 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i32
468 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i16
469 // CHECK: llvm.return [[t2]] : i16
470 func.func @test_l4_l2(%arg0: !fir.logical<4>) -> !fir.logical<2> {
471 %0 = fir.convert %arg0 : (!fir.logical<4>) -> !fir.logical<2>
472 return %0 : !fir.logical<2>
475 // CHECK-LABEL: @test_l4_l8
476 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i32
477 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i32
478 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i64
479 // CHECK: llvm.return [[t2]] : i64
480 func.func @test_l4_l8(%arg0: !fir.logical<4>) -> !fir.logical<8> {
481 %0 = fir.convert %arg0 : (!fir.logical<4>) -> !fir.logical<8>
482 return %0 : !fir.logical<8>
485 // CHECK-LABEL: @test_l8_l1
486 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i64
487 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i64
488 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i8
489 // CHECK: llvm.return [[t2]] : i8
490 func.func @test_l8_l1(%arg0: !fir.logical<8>) -> !fir.logical<1> {
491 %0 = fir.convert %arg0 : (!fir.logical<8>) -> !fir.logical<1>
492 return %0 : !fir.logical<1>
495 // CHECK-LABEL: @test_l8_l2
496 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i64
497 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i64
498 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i16
499 // CHECK: llvm.return [[t2]] : i16
500 func.func @test_l8_l2(%arg0: !fir.logical<8>) -> !fir.logical<2> {
501 %0 = fir.convert %arg0 : (!fir.logical<8>) -> !fir.logical<2>
502 return %0 : !fir.logical<2>
505 // CHECK-LABEL: @test_l8_l4
506 // CHECK: [[t0:%[0-9]*]] = llvm.mlir.constant(0 : i64) : i64
507 // CHECK: [[t1:%[0-9]*]] = llvm.icmp "ne" %arg0, [[t0]] : i64
508 // CHECK: [[t2:%[0-9]*]] = llvm.zext [[t1]] : i1 to i32
509 // CHECK: llvm.return [[t2]] : i32
510 func.func @test_l8_l4(%arg0: !fir.logical<8>) -> !fir.logical<4> {
511 %0 = fir.convert %arg0 : (!fir.logical<8>) -> !fir.logical<4>
512 return %0 : !fir.logical<4>