1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
10 ! CHECK-LABEL: func @_QPs(
11 ! CHECK-SAME: %[[VAL_0:.*]]: !fir.boxchar<1> {fir.bindc_name = "ch"}) {
12 ! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {adapt.valuebyref, bindc_name = "i"}
13 ! CHECK: %[[VAL_2:.*]]:2 = fir.unboxchar %[[VAL_0]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
14 ! CHECK: %[[VAL_3:.*]] = arith.constant 1 : i32
15 ! CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_3]] : (i32) -> index
16 ! CHECK: %[[VAL_5:.*]] = arith.constant 4 : i32
17 ! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_5]] : (i32) -> index
18 ! CHECK: %[[VAL_7:.*]] = arith.constant 1 : index
19 ! CHECK: fir.do_loop %[[VAL_8:.*]] = %[[VAL_4]] to %[[VAL_6]] step %[[VAL_7]] unordered {
20 ! CHECK: %[[VAL_9:.*]] = fir.convert %[[VAL_8]] : (index) -> i32
21 ! CHECK: fir.store %[[VAL_9]] to %[[VAL_1]] : !fir.ref<i32>
22 ! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_1]] : !fir.ref<i32>
23 ! CHECK: %[[VAL_11:.*]] = arith.constant 1 : i32
24 ! CHECK: %[[VAL_12:.*]] = arith.addi %[[VAL_10]], %[[VAL_11]] : i32
25 ! CHECK: %[[VAL_13:.*]] = fir.convert %[[VAL_12]] : (i32) -> i64
26 ! CHECK: %[[VAL_14:.*]] = fir.load %[[VAL_1]] : !fir.ref<i32>
27 ! CHECK: %[[VAL_15:.*]] = arith.constant 1 : i32
28 ! CHECK: %[[VAL_16:.*]] = arith.addi %[[VAL_14]], %[[VAL_15]] : i32
29 ! CHECK: %[[VAL_17:.*]] = fir.convert %[[VAL_16]] : (i32) -> i64
30 ! CHECK: %[[VAL_18:.*]] = fir.convert %[[VAL_13]] : (i64) -> index
31 ! CHECK: %[[VAL_19:.*]] = fir.convert %[[VAL_17]] : (i64) -> index
32 ! CHECK: %[[VAL_20:.*]] = arith.constant 1 : index
33 ! CHECK: %[[VAL_21:.*]] = arith.subi %[[VAL_18]], %[[VAL_20]] : index
34 ! CHECK: %[[VAL_22:.*]] = fir.convert %[[VAL_2]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.array<?x!fir.char<1>>>
35 ! CHECK: %[[VAL_23:.*]] = fir.coordinate_of %[[VAL_22]], %[[VAL_21]] : (!fir.ref<!fir.array<?x!fir.char<1>>>, index) -> !fir.ref<!fir.char<1>>
36 ! CHECK: %[[VAL_24:.*]] = fir.convert %[[VAL_23]] : (!fir.ref<!fir.char<1>>) -> !fir.ref<!fir.char<1,?>>
37 ! CHECK: %[[VAL_25:.*]] = arith.subi %[[VAL_19]], %[[VAL_18]] : index
38 ! CHECK: %[[VAL_26:.*]] = arith.addi %[[VAL_25]], %[[VAL_20]] : index
39 ! CHECK: %[[VAL_27:.*]] = arith.constant 0 : index
40 ! CHECK: %[[VAL_28:.*]] = arith.cmpi slt, %[[VAL_26]], %[[VAL_27]] : index
41 ! CHECK: %[[VAL_29:.*]] = arith.select %[[VAL_28]], %[[VAL_27]], %[[VAL_26]] : index
42 ! CHECK: %[[VAL_30:.*]] = fir.load %[[VAL_1]] : !fir.ref<i32>
43 ! CHECK: %[[VAL_31:.*]] = fir.convert %[[VAL_30]] : (i32) -> i64
44 ! CHECK: %[[VAL_32:.*]] = fir.load %[[VAL_1]] : !fir.ref<i32>
45 ! CHECK: %[[VAL_33:.*]] = fir.convert %[[VAL_32]] : (i32) -> i64
46 ! CHECK: %[[VAL_34:.*]] = fir.convert %[[VAL_31]] : (i64) -> index
47 ! CHECK: %[[VAL_35:.*]] = fir.convert %[[VAL_33]] : (i64) -> index
48 ! CHECK: %[[VAL_36:.*]] = arith.constant 1 : index
49 ! CHECK: %[[VAL_37:.*]] = arith.subi %[[VAL_34]], %[[VAL_36]] : index
50 ! CHECK: %[[VAL_38:.*]] = fir.convert %[[VAL_2]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.array<?x!fir.char<1>>>
51 ! CHECK: %[[VAL_39:.*]] = fir.coordinate_of %[[VAL_38]], %[[VAL_37]] : (!fir.ref<!fir.array<?x!fir.char<1>>>, index) -> !fir.ref<!fir.char<1>>
52 ! CHECK: %[[VAL_40:.*]] = fir.convert %[[VAL_39]] : (!fir.ref<!fir.char<1>>) -> !fir.ref<!fir.char<1,?>>
53 ! CHECK: %[[VAL_41:.*]] = arith.subi %[[VAL_35]], %[[VAL_34]] : index
54 ! CHECK: %[[VAL_42:.*]] = arith.addi %[[VAL_41]], %[[VAL_36]] : index
55 ! CHECK: %[[VAL_43:.*]] = arith.constant 0 : index
56 ! CHECK: %[[VAL_44:.*]] = arith.cmpi slt, %[[VAL_42]], %[[VAL_43]] : index
57 ! CHECK: %[[VAL_45:.*]] = arith.select %[[VAL_44]], %[[VAL_43]], %[[VAL_42]] : index
58 ! CHECK: %[[VAL_46:.*]] = arith.cmpi slt, %[[VAL_45]], %[[VAL_29]] : index
59 ! CHECK: %[[VAL_47:.*]] = arith.select %[[VAL_46]], %[[VAL_45]], %[[VAL_29]] : index
60 ! CHECK: %[[VAL_48:.*]] = arith.constant 1 : i64
61 ! CHECK: %[[VAL_49:.*]] = fir.convert %[[VAL_47]] : (index) -> i64
62 ! CHECK: %[[VAL_50:.*]] = arith.muli %[[VAL_48]], %[[VAL_49]] : i64
63 ! CHECK: %[[VAL_51:.*]] = arith.constant false
64 ! CHECK: %[[VAL_52:.*]] = fir.convert %[[VAL_40]] : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
65 ! CHECK: %[[VAL_53:.*]] = fir.convert %[[VAL_24]] : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
66 ! CHECK: fir.call @llvm.memmove.p0.p0.i64(%[[VAL_52]], %[[VAL_53]], %[[VAL_50]], %[[VAL_51]]) {{.*}}: (!fir.ref<i8>, !fir.ref<i8>, i64, i1) -> ()
67 ! CHECK: %[[VAL_54:.*]] = arith.constant 1 : index
68 ! CHECK: %[[VAL_55:.*]] = arith.subi %[[VAL_45]], %[[VAL_54]] : index
69 ! CHECK: %[[VAL_56:.*]] = arith.constant 32 : i8
70 ! CHECK: %[[VAL_57:.*]] = fir.undefined !fir.char<1>
71 ! CHECK: %[[VAL_58:.*]] = fir.insert_value %[[VAL_57]], %[[VAL_56]], [0 : index] : (!fir.char<1>, i8) -> !fir.char<1>
72 ! CHECK: %[[VAL_59:.*]] = arith.constant 1 : index
73 ! CHECK: fir.do_loop %[[VAL_60:.*]] = %[[VAL_47]] to %[[VAL_55]] step %[[VAL_59]] {
74 ! CHECK: %[[VAL_61:.*]] = fir.convert %[[VAL_40]] : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.array<?x!fir.char<1>>>
75 ! CHECK: %[[VAL_62:.*]] = fir.coordinate_of %[[VAL_61]], %[[VAL_60]] : (!fir.ref<!fir.array<?x!fir.char<1>>>, index) -> !fir.ref<!fir.char<1>>
76 ! CHECK: fir.store %[[VAL_58]] to %[[VAL_62]] : !fir.ref<!fir.char<1>>