diff --git a/flang/lib/Semantics/expression.cpp b/flang/lib/Semantics/expression.cpp --- a/flang/lib/Semantics/expression.cpp +++ b/flang/lib/Semantics/expression.cpp @@ -3950,7 +3950,8 @@ (lhsType.category() == TypeCategory::Derived || lhsType.kind() == rhsType.kind())) { // no conversion necessary - } else if (auto rhsExpr{evaluate::ConvertToType(lhsType, MoveExpr(1))}) { + } else if (auto rhsExpr{evaluate::Fold(context_.GetFoldingContext(), + evaluate::ConvertToType(lhsType, MoveExpr(1)))}) { std::optional source; if (actuals_[1]) { source = actuals_[1]->sourceLocation(); diff --git a/flang/test/Evaluate/errors01.f90 b/flang/test/Evaluate/errors01.f90 --- a/flang/test/Evaluate/errors01.f90 +++ b/flang/test/Evaluate/errors01.f90 @@ -107,5 +107,7 @@ real, parameter :: bad1 = scale(1.0, 99999) !CHECK: complex ABS intrinsic folding overflow real, parameter :: bad2 = abs(cmplx(huge(0.),huge(0.))) + !CHECK: warning: overflow on REAL(8) to REAL(4) conversion + x = 1.D40 end subroutine end module diff --git a/flang/test/Lower/Intrinsics/system_clock.f90 b/flang/test/Lower/Intrinsics/system_clock.f90 --- a/flang/test/Lower/Intrinsics/system_clock.f90 +++ b/flang/test/Lower/Intrinsics/system_clock.f90 @@ -102,8 +102,8 @@ ! CHECK: } ! CHECK: %[[V_17:[0-9]+]] = fir.is_present %arg0 : (!fir.ref) -> i1 ! CHECK: fir.if %[[V_17]] { - ! CHECK: %[[V_29]] = fir.convert %c0{{.*}}_i32 : (i32) -> i64 - ! CHECK: fir.store %[[V_29]] to %arg0 : !fir.ref + ! CHECK: %[[C_0:c[0-9a-z_]+]] = arith.constant 0 : i64 + ! CHECK: fir.store %[[C_0]] to %arg0 : !fir.ref ! CHECK: } else { ! CHECK: } ! CHECK: %[[V_18:[0-9]+]] = fir.zero_bits !fir.ptr diff --git a/flang/test/Lower/array-expression.f90 b/flang/test/Lower/array-expression.f90 --- a/flang/test/Lower/array-expression.f90 +++ b/flang/test/Lower/array-expression.f90 @@ -574,8 +574,7 @@ ! CHECK: %[[VAL_2:.*]] = arith.constant 3 : index ! CHECK: %[[VAL_3:.*]] = fir.shape %[[VAL_1]], %[[VAL_2]] : (index, index) -> !fir.shape<2> ! CHECK: %[[VAL_4:.*]] = fir.array_load %[[VAL_0]](%[[VAL_3]]) : (!fir.ref>, !fir.shape<2>) -> !fir.array<2x3xf32> -! CHECK: %[[VAL_5:.*]] = arith.constant 42 : i32 -! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_5]] : (i32) -> f32 +! CHECK: %[[VAL_6:.*]] = arith.constant 4.200000e+01 : f32 ! CHECK: %[[VAL_7:.*]] = arith.constant 1 : index ! CHECK: %[[VAL_8:.*]] = arith.constant 0 : index ! CHECK: %[[VAL_9:.*]] = arith.subi %[[VAL_1]], %[[VAL_7]] : index diff --git a/flang/test/Lower/array-temp.f90 b/flang/test/Lower/array-temp.f90 --- a/flang/test/Lower/array-temp.f90 +++ b/flang/test/Lower/array-temp.f90 @@ -42,351 +42,350 @@ end ! CHECK-LABEL: func @_QPss2( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref {fir.bindc_name = "n"}) { -! CHECK-DAG: %[[VAL_1:.*]] = arith.constant -1 : index -! CHECK-DAG: %[[VAL_2:.*]] = arith.constant -2 : i32 -! CHECK-DAG: %[[VAL_3:.*]] = arith.constant 1 : index -! CHECK-DAG: %[[VAL_4:.*]] = arith.constant 0 : index -! CHECK-DAG: %[[VAL_5:.*]] = arith.constant 2 : index -! CHECK-DAG: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK-DAG: %[[VAL_7:.*]] = arith.constant 7.000000e+00 : f32 -! CHECK-DAG: %[[VAL_8:.*]] = arith.constant -1 : i32 -! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_0]] : !fir.ref -! CHECK: %[[VAL_11A:.*]] = fir.convert %[[VAL_10]] : (i32) -> index -! CHECK: %[[CMP:.*]] = arith.cmpi sgt, %[[VAL_11A]], %[[VAL_4]] : index -! CHECK: %[[VAL_11:.*]] = arith.select %[[CMP]], %[[VAL_11A]], %[[VAL_4]] : index -! CHECK: %[[VAL_12:.*]] = fir.alloca !fir.array, %[[VAL_11]] {bindc_name = "aa", uniq_name = "_QFss2Eaa"} -! CHECK: %[[VAL_13:.*]] = fir.shape %[[VAL_11]] : (index) -> !fir.shape<1> -! CHECK: %[[VAL_14:.*]] = fir.convert %[[VAL_2]] : (i32) -> f32 -! CHECK: br ^bb1(%[[VAL_4]], %[[VAL_11]] : index, index) -! CHECK: ^bb1(%[[VAL_15:.*]]: index, %[[VAL_16:.*]]: index): -! CHECK: %[[VAL_17:.*]] = arith.cmpi sgt, %[[VAL_16]], %[[VAL_4]] : index -! CHECK: cond_br %[[VAL_17]], ^bb2, ^bb3 -! CHECK: ^bb2: -! CHECK: %[[VAL_18:.*]] = arith.addi %[[VAL_15]], %[[VAL_3]] : index -! CHECK: %[[VAL_19:.*]] = fir.array_coor %[[VAL_12]](%[[VAL_13]]) %[[VAL_18]] : (!fir.ref>, !fir.shape<1>, index) -> !fir.ref -! CHECK: fir.store %[[VAL_14]] to %[[VAL_19]] : !fir.ref -! CHECK: %[[VAL_20:.*]] = arith.subi %[[VAL_16]], %[[VAL_3]] : index -! CHECK: br ^bb1(%[[VAL_18]], %[[VAL_20]] : index, index) -! CHECK: ^bb3: -! CHECK: %[[VAL_21:.*]] = fir.load %[[VAL_0]] : !fir.ref -! CHECK: %[[VAL_22:.*]] = fir.convert %[[VAL_21]] : (i32) -> index -! CHECK: %[[VAL_23:.*]] = arith.addi %[[VAL_22]], %[[VAL_1]] : index -! CHECK: %[[VAL_24:.*]] = arith.cmpi sgt, %[[VAL_23]], %[[VAL_4]] : index -! CHECK: %[[VAL_25:.*]] = arith.select %[[VAL_24]], %[[VAL_23]], %[[VAL_4]] : index -! CHECK: %[[VAL_26:.*]] = fir.slice %[[VAL_5]], %[[VAL_22]], %[[VAL_3]] : (index, index, index) -> !fir.slice<1> -! CHECK: %[[VAL_27:.*]] = fir.allocmem !fir.array, %[[VAL_11]] -! CHECK: br ^bb4(%[[VAL_4]], %[[VAL_11]] : index, index) -! CHECK: ^bb4(%[[VAL_28:.*]]: index, %[[VAL_29:.*]]: index): -! CHECK: %[[VAL_30:.*]] = arith.cmpi sgt, %[[VAL_29]], %[[VAL_4]] : index -! CHECK: cond_br %[[VAL_30]], ^bb5, ^bb6 -! CHECK: ^bb5: -! CHECK: %[[VAL_31:.*]] = arith.addi %[[VAL_28]], %[[VAL_3]] : index -! CHECK: %[[VAL_32:.*]] = fir.array_coor %[[VAL_12]](%[[VAL_13]]) %[[VAL_31]] : (!fir.ref>, !fir.shape<1>, index) -> !fir.ref -! CHECK: %[[VAL_33:.*]] = fir.array_coor %[[VAL_27]](%[[VAL_13]]) %[[VAL_31]] : (!fir.heap>, !fir.shape<1>, index) -> !fir.ref -! CHECK: %[[VAL_34:.*]] = fir.load %[[VAL_32]] : !fir.ref -! CHECK: fir.store %[[VAL_34]] to %[[VAL_33]] : !fir.ref -! CHECK: %[[VAL_35:.*]] = arith.subi %[[VAL_29]], %[[VAL_3]] : index -! CHECK: br ^bb4(%[[VAL_31]], %[[VAL_35]] : index, index) -! CHECK: ^bb6: -! CHECK: %[[VAL_36:.*]] = arith.subi %[[VAL_21]], %[[VAL_6]] : i32 -! CHECK: %[[VAL_37:.*]] = fir.convert %[[VAL_36]] : (i32) -> index -! CHECK: %[[VAL_38:.*]] = fir.slice %[[VAL_3]], %[[VAL_37]], %[[VAL_3]] : (index, index, index) -> !fir.slice<1> -! CHECK: br ^bb7(%[[VAL_4]], %[[VAL_25]] : index, index) -! CHECK: ^bb7(%[[VAL_39:.*]]: index, %[[VAL_40:.*]]: index): -! CHECK: %[[VAL_41:.*]] = arith.cmpi sgt, %[[VAL_40]], %[[VAL_4]] : index -! CHECK: cond_br %[[VAL_41]], ^bb8, ^bb9(%[[VAL_4]], %[[VAL_11]] : index, index) -! CHECK: ^bb8: -! CHECK: %[[VAL_42:.*]] = arith.addi %[[VAL_39]], %[[VAL_3]] : index -! CHECK: %[[VAL_43:.*]] = fir.array_coor %[[VAL_12]](%[[VAL_13]]) {{\[}}%[[VAL_38]]] %[[VAL_42]] : (!fir.ref>, !fir.shape<1>, !fir.slice<1>, index) -> !fir.ref -! CHECK: %[[VAL_44:.*]] = fir.load %[[VAL_43]] : !fir.ref -! CHECK: %[[VAL_45:.*]] = arith.addf %[[VAL_44]], %[[VAL_7]] {{.*}}: f32 -! CHECK: %[[VAL_46:.*]] = fir.array_coor %[[VAL_27]](%[[VAL_13]]) {{\[}}%[[VAL_26]]] %[[VAL_42]] : (!fir.heap>, !fir.shape<1>, !fir.slice<1>, index) -> !fir.ref -! CHECK: fir.store %[[VAL_45]] to %[[VAL_46]] : !fir.ref -! CHECK: %[[VAL_47:.*]] = arith.subi %[[VAL_40]], %[[VAL_3]] : index -! CHECK: br ^bb7(%[[VAL_42]], %[[VAL_47]] : index, index) -! CHECK: ^bb9(%[[VAL_48:.*]]: index, %[[VAL_49:.*]]: index): -! CHECK: %[[VAL_50:.*]] = arith.cmpi sgt, %[[VAL_49]], %[[VAL_4]] : index -! CHECK: cond_br %[[VAL_50]], ^bb10, ^bb11 -! CHECK: ^bb10: -! CHECK: %[[VAL_51:.*]] = arith.addi %[[VAL_48]], %[[VAL_3]] : index -! CHECK: %[[VAL_52:.*]] = fir.array_coor %[[VAL_27]](%[[VAL_13]]) %[[VAL_51]] : (!fir.heap>, !fir.shape<1>, index) -> !fir.ref -! CHECK: %[[VAL_53:.*]] = fir.array_coor %[[VAL_12]](%[[VAL_13]]) %[[VAL_51]] : (!fir.ref>, !fir.shape<1>, index) -> !fir.ref -! CHECK: %[[VAL_54:.*]] = fir.load %[[VAL_52]] : !fir.ref -! CHECK: fir.store %[[VAL_54]] to %[[VAL_53]] : !fir.ref -! CHECK: %[[VAL_55:.*]] = arith.subi %[[VAL_49]], %[[VAL_3]] : index -! CHECK: br ^bb9(%[[VAL_51]], %[[VAL_55]] : index, index) -! CHECK: ^bb11: -! CHECK: fir.freemem %[[VAL_27]] : !fir.heap> -! CHECK: %[[VAL_58:.*]] = fir.call @_FortranAioBeginExternalListOutput(%[[VAL_8]], %{{.*}}, %{{.*}}) {{.*}}: (i32, !fir.ref, i32) -> !fir.ref -! CHECK: %[[VAL_59:.*]] = fir.slice %[[VAL_3]], %[[VAL_5]], %[[VAL_3]] : (index, index, index) -> !fir.slice<1> -! CHECK: %[[VAL_60:.*]] = fir.embox %[[VAL_12]](%[[VAL_13]]) {{\[}}%[[VAL_59]]] : (!fir.ref>, !fir.shape<1>, !fir.slice<1>) -> !fir.box> -! CHECK: %[[VAL_61:.*]] = fir.convert %[[VAL_60]] : (!fir.box>) -> !fir.box -! CHECK: %[[VAL_62:.*]] = fir.call @_FortranAioOutputDescriptor(%[[VAL_58]], %[[VAL_61]]) {{.*}}: (!fir.ref, !fir.box) -> i1 -! CHECK: %[[VAL_63:.*]] = fir.load %[[VAL_0]] : !fir.ref -! CHECK: %[[VAL_64:.*]] = arith.subi %[[VAL_63]], %[[VAL_6]] : i32 -! CHECK: %[[VAL_65:.*]] = fir.convert %[[VAL_64]] : (i32) -> index -! CHECK: %[[VAL_66:.*]] = fir.convert %[[VAL_63]] : (i32) -> index -! CHECK: %[[VAL_67:.*]] = fir.slice %[[VAL_65]], %[[VAL_66]], %[[VAL_3]] : (index, index, index) -> !fir.slice<1> -! CHECK: %[[VAL_68:.*]] = fir.embox %[[VAL_12]](%[[VAL_13]]) {{\[}}%[[VAL_67]]] : (!fir.ref>, !fir.shape<1>, !fir.slice<1>) -> !fir.box> -! CHECK: %[[VAL_69:.*]] = fir.convert %[[VAL_68]] : (!fir.box>) -> !fir.box -! CHECK: %[[VAL_70:.*]] = fir.call @_FortranAioOutputDescriptor(%[[VAL_58]], %[[VAL_69]]) {{.*}}: (!fir.ref, !fir.box) -> i1 -! CHECK: %[[VAL_71:.*]] = fir.call @_FortranAioEndIoStatement(%[[VAL_58]]) {{.*}}: (!fir.ref) -> i32 -! CHECK: return -! CHECK: } +! CHECK-SAME: %arg0: !fir.ref {fir.bindc_name = "n"}) { +! CHECK: %[[C_m1:[-0-9a-z_]+]] = arith.constant -1 : index +! CHECK: %[[C_2:[-0-9a-z_]+]] = arith.constant 2 : index +! CHECK: %[[C_1:[-0-9a-z_]+]] = arith.constant 1 : index +! CHECK: %[[C_27_i32:[-0-9a-z_]+]] = arith.constant 27 : i32 +! CHECK: %[[C_m1_i32:[-0-9a-z_]+]] = arith.constant -1 : i32 +! CHECK: %[[C_st:[-0-9a-z_]+]] = arith.constant 7.000000e+00 : f32 +! CHECK: %[[C_1_i32:[-0-9a-z_]+]] = arith.constant 1 : i32 +! CHECK: %[[C_st_0:[-0-9a-z_]+]] = arith.constant -2.000000e+00 : f32 +! CHECK: %[[C_0:[-0-9a-z_]+]] = arith.constant 0 : index +! CHECK: %[[V_0:[0-9]+]] = fir.load %arg0 : !fir.ref +! CHECK: %[[V_1:[0-9]+]] = fir.convert %[[V_0:[0-9]+]] : (i32) -> index +! CHECK: %[[V_2:[0-9]+]] = arith.cmpi sgt, %[[V_1]], %[[C_0]] : index +! CHECK: %[[V_3:[0-9]+]] = arith.select %[[V_2]], %[[V_1]], %[[C_0]] : index +! CHECK: %[[V_4:[0-9]+]] = fir.alloca !fir.array, %[[V_3]] {bindc_name = "aa", uniq_name = "_QFss2Eaa"} +! CHECK: %[[V_5:[0-9]+]] = fir.shape %[[V_3:[0-9]+]] : (index) -> !fir.shape<1> +! CHECK: cf.br ^bb1(%[[C_0]], %[[V_3:[0-9]+]] : index, index) +! CHECK: ^bb1(%[[V_6:[0-9]+]]: index, %[[V_7:[0-9]+]]: index): // 2 preds: ^bb0, ^bb2 +! CHECK: %[[V_8:[0-9]+]] = arith.cmpi sgt, %[[V_7]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_8]], ^bb2, ^bb3 +! CHECK: ^bb2: // pred: ^bb1 +! CHECK: %[[V_9:[0-9]+]] = arith.addi %[[V_6]], %[[C_1]] : index +! CHECK: %[[V_10:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_9:[0-9]+]] : (!fir.ref>, !fir.shape<1>, index) -> !fir.ref +! CHECK: fir.store %[[C_st_0]] to %[[V_10:[0-9]+]] : !fir.ref +! CHECK: %[[V_11:[0-9]+]] = arith.subi %[[V_7]], %[[C_1]] : index +! CHECK: cf.br ^bb1(%[[V_9]], %[[V_11:[0-9]+]] : index, index) +! CHECK: ^bb3: // pred: ^bb1 +! CHECK: %[[V_12:[0-9]+]] = fir.load %arg0 : !fir.ref +! CHECK: %[[V_13:[0-9]+]] = fir.convert %[[V_12:[0-9]+]] : (i32) -> index +! CHECK: %[[V_14:[0-9]+]] = arith.addi %[[V_13]], %[[C_m1]] : index +! CHECK: %[[V_15:[0-9]+]] = arith.cmpi sgt, %[[V_14]], %[[C_0]] : index +! CHECK: %[[V_16:[0-9]+]] = arith.select %[[V_15]], %[[V_14]], %[[C_0]] : index +! CHECK: %[[V_17:[0-9]+]] = fir.slice %[[C_2]], %[[V_13]], %[[C_1]] : (index, index, index) -> !fir.slice<1> +! CHECK: %[[V_18:[0-9]+]] = fir.allocmem !fir.array, %[[V_3]] +! CHECK: cf.br ^bb4(%[[C_0]], %[[V_3:[0-9]+]] : index, index) +! CHECK: ^bb4(%[[V_19:[0-9]+]]: index, %[[V_20:[0-9]+]]: index): // 2 preds: ^bb3, ^bb5 +! CHECK: %[[V_21:[0-9]+]] = arith.cmpi sgt, %[[V_20]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_21]], ^bb5, ^bb6 +! CHECK: ^bb5: // pred: ^bb4 +! CHECK: %[[V_22:[0-9]+]] = arith.addi %[[V_19]], %[[C_1]] : index +! CHECK: %[[V_23:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_22:[0-9]+]] : (!fir.ref>, !fir.shape<1>, index) -> !fir.ref +! CHECK: %[[V_24:[0-9]+]] = fir.array_coor %[[V_18]](%[[V_5]]) %[[V_22:[0-9]+]] : (!fir.heap>, !fir.shape<1>, index) -> !fir.ref +! CHECK: %[[V_25:[0-9]+]] = fir.load %[[V_23:[0-9]+]] : !fir.ref +! CHECK: fir.store %[[V_25]] to %[[V_24:[0-9]+]] : !fir.ref +! CHECK: %[[V_26:[0-9]+]] = arith.subi %[[V_20]], %[[C_1]] : index +! CHECK: cf.br ^bb4(%[[V_22]], %[[V_26:[0-9]+]] : index, index) +! CHECK: ^bb6: // pred: ^bb4 +! CHECK: %[[V_27:[0-9]+]] = arith.subi %[[V_12]], %[[C_1_i32]] : i32 +! CHECK: %[[V_28:[0-9]+]] = fir.convert %[[V_27:[0-9]+]] : (i32) -> index +! CHECK: %[[V_29:[0-9]+]] = fir.slice %[[C_1]], %[[V_28]], %[[C_1]] : (index, index, index) -> !fir.slice<1> +! CHECK: cf.br ^bb7(%[[C_0]], %[[V_16:[0-9]+]] : index, index) +! CHECK: ^bb7(%[[V_30:[0-9]+]]: index, %[[V_31:[0-9]+]]: index): // 2 preds: ^bb6, ^bb8 +! CHECK: %[[V_32:[0-9]+]] = arith.cmpi sgt, %[[V_31]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_32]], ^bb8, ^bb9(%[[C_0]], %[[V_3:[0-9]+]] : index, index) +! CHECK: ^bb8: // pred: ^bb7 +! CHECK: %[[V_33:[0-9]+]] = arith.addi %[[V_30]], %[[C_1]] : index +! CHECK: %[[V_34:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) [%[[V_29]]] %[[V_33:[0-9]+]] : (!fir.ref>, !fir.shape<1>, !fir.slice<1>, index) -> !fir.ref +! CHECK: %[[V_35:[0-9]+]] = fir.load %[[V_34:[0-9]+]] : !fir.ref +! CHECK: %[[V_36:[0-9]+]] = arith.addf %[[V_35]], %[[C_st]] fastmath : f32 +! CHECK: %[[V_37:[0-9]+]] = fir.array_coor %[[V_18]](%[[V_5]]) [%[[V_17]]] %[[V_33:[0-9]+]] : (!fir.heap>, !fir.shape<1>, !fir.slice<1>, index) -> !fir.ref +! CHECK: fir.store %[[V_36]] to %[[V_37:[0-9]+]] : !fir.ref +! CHECK: %[[V_38:[0-9]+]] = arith.subi %[[V_31]], %[[C_1]] : index +! CHECK: cf.br ^bb7(%[[V_33]], %[[V_38:[0-9]+]] : index, index) +! CHECK: ^bb9(%[[V_39:[0-9]+]]: index, %[[V_40:[0-9]+]]: index): // 2 preds: ^bb7, ^bb10 +! CHECK: %[[V_41:[0-9]+]] = arith.cmpi sgt, %[[V_40]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_41]], ^bb10, ^bb11 +! CHECK: ^bb10: // pred: ^bb9 +! CHECK: %[[V_42:[0-9]+]] = arith.addi %[[V_39]], %[[C_1]] : index +! CHECK: %[[V_43:[0-9]+]] = fir.array_coor %[[V_18]](%[[V_5]]) %[[V_42:[0-9]+]] : (!fir.heap>, !fir.shape<1>, index) -> !fir.ref +! CHECK: %[[V_44:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_42:[0-9]+]] : (!fir.ref>, !fir.shape<1>, index) -> !fir.ref +! CHECK: %[[V_45:[0-9]+]] = fir.load %[[V_43:[0-9]+]] : !fir.ref +! CHECK: fir.store %[[V_45]] to %[[V_44:[0-9]+]] : !fir.ref +! CHECK: %[[V_46:[0-9]+]] = arith.subi %[[V_40]], %[[C_1]] : index +! CHECK: cf.br ^bb9(%[[V_42]], %[[V_46:[0-9]+]] : index, index) +! CHECK: ^bb11: // pred: ^bb9 +! CHECK: fir.freemem %[[V_18:[0-9]+]] : !fir.heap> +! CHECK: %[[V_49:[0-9]+]] = fir.call @_FortranAioBeginExternalListOutput(%[[C_m1_i32]], %{{.*}}, %{{.*}}) {{.*}}: (i32, !fir.ref, i32) -> !fir.ref +! CHECK: %[[V_50:[0-9]+]] = fir.slice %[[C_1]], %[[C_2]], %[[C_1]] : (index, index, index) -> !fir.slice<1> +! CHECK: %[[V_51:[0-9]+]] = fir.embox %[[V_4]](%[[V_5]]) [%[[V_50]]] : (!fir.ref>, !fir.shape<1>, !fir.slice<1>) -> !fir.box> +! CHECK: %[[V_52:[0-9]+]] = fir.convert %[[V_51:[0-9]+]] : (!fir.box>) -> !fir.box +! CHECK: %[[V_53:[0-9]+]] = fir.call @_FortranAioOutputDescriptor(%[[V_49]], %[[V_52]]) fastmath : (!fir.ref, !fir.box) -> i1 +! CHECK: %[[V_54:[0-9]+]] = fir.load %arg0 : !fir.ref +! CHECK: %[[V_55:[0-9]+]] = arith.subi %[[V_54]], %[[C_1_i32]] : i32 +! CHECK: %[[V_56:[0-9]+]] = fir.convert %[[V_55:[0-9]+]] : (i32) -> index +! CHECK: %[[V_57:[0-9]+]] = fir.convert %[[V_54:[0-9]+]] : (i32) -> index +! CHECK: %[[V_58:[0-9]+]] = fir.slice %[[V_56]], %[[V_57]], %[[C_1]] : (index, index, index) -> !fir.slice<1> +! CHECK: %[[V_59:[0-9]+]] = fir.embox %[[V_4]](%[[V_5]]) [%[[V_58]]] : (!fir.ref>, !fir.shape<1>, !fir.slice<1>) -> !fir.box> +! CHECK: %[[V_60:[0-9]+]] = fir.convert %[[V_59:[0-9]+]] : (!fir.box>) -> !fir.box +! CHECK: %[[V_61:[0-9]+]] = fir.call @_FortranAioOutputDescriptor(%[[V_49]], %[[V_60]]) fastmath : (!fir.ref, !fir.box) -> i1 +! CHECK: %[[V_62:[0-9]+]] = fir.call @_FortranAioEndIoStatement(%[[V_49]]) fastmath : (!fir.ref) -> i32 +! CHECK: return +! CHECK: } ! CHECK-LABEL: func @_QPss3( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref {fir.bindc_name = "n"}) { -! CHECK-DAG: %[[VAL_1:.*]] = arith.constant -1 : index -! CHECK-DAG: %[[VAL_2:.*]] = arith.constant 2 : index -! CHECK-DAG: %[[VAL_3:.*]] = arith.constant 1 : index -! CHECK-DAG: %[[VAL_4:.*]] = arith.constant -2 : i32 -! CHECK-DAG: %[[VAL_5:.*]] = arith.constant 0 : index -! CHECK-DAG: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK-DAG: %[[VAL_7:.*]] = arith.constant 7.000000e+00 : f32 -! CHECK-DAG: %[[VAL_8:.*]] = arith.constant -1 : i32 -! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_0]] : !fir.ref -! CHECK: %[[VAL_11:.*]] = fir.convert %[[VAL_10]] : (i32) -> index -! CHECK: %[[CMP:.*]] = arith.cmpi sgt, %[[VAL_11A]], %[[VAL_5]] : index -! CHECK: %[[VAL_11:.*]] = arith.select %[[CMP]], %[[VAL_11A]], %[[VAL_5]] : index -! CHECK: %[[VAL_12:.*]] = fir.alloca !fir.array<2x?xf32>, %[[VAL_11]] {bindc_name = "aa", uniq_name = "_QFss3Eaa"} -! CHECK: %[[VAL_13:.*]] = fir.shape %[[VAL_2]], %[[VAL_11]] : (index, index) -> !fir.shape<2> -! CHECK: %[[VAL_14:.*]] = fir.convert %[[VAL_4]] : (i32) -> f32 -! CHECK: br ^bb1(%[[VAL_5]], %[[VAL_11]] : index, index) -! CHECK: ^bb1(%[[VAL_15:.*]]: index, %[[VAL_16:.*]]: index): -! CHECK: %[[VAL_17:.*]] = arith.cmpi sgt, %[[VAL_16]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_17]], ^bb2(%[[VAL_5]], %[[VAL_2]] : index, index), ^bb5 -! CHECK: ^bb2(%[[VAL_18:.*]]: index, %[[VAL_19:.*]]: index): -! CHECK: %[[VAL_20:.*]] = arith.cmpi sgt, %[[VAL_19]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_20]], ^bb3, ^bb4 -! CHECK: ^bb3: -! CHECK: %[[VAL_21:.*]] = arith.addi %[[VAL_18]], %[[VAL_3]] : index -! CHECK: %[[VAL_22:.*]] = arith.addi %[[VAL_15]], %[[VAL_3]] : index -! CHECK: %[[VAL_23:.*]] = fir.array_coor %[[VAL_12]](%[[VAL_13]]) %[[VAL_21]], %[[VAL_22]] : (!fir.ref>, !fir.shape<2>, index, index) -> !fir.ref -! CHECK: fir.store %[[VAL_14]] to %[[VAL_23]] : !fir.ref -! CHECK: %[[VAL_24:.*]] = arith.subi %[[VAL_19]], %[[VAL_3]] : index -! CHECK: br ^bb2(%[[VAL_21]], %[[VAL_24]] : index, index) -! CHECK: ^bb4: -! CHECK: %[[VAL_25:.*]] = arith.addi %[[VAL_15]], %[[VAL_3]] : index -! CHECK: %[[VAL_26:.*]] = arith.subi %[[VAL_16]], %[[VAL_3]] : index -! CHECK: br ^bb1(%[[VAL_25]], %[[VAL_26]] : index, index) -! CHECK: ^bb5: -! CHECK: %[[VAL_27:.*]] = fir.load %[[VAL_0]] : !fir.ref -! CHECK: %[[VAL_28:.*]] = fir.convert %[[VAL_27]] : (i32) -> index -! CHECK: %[[VAL_29:.*]] = arith.addi %[[VAL_28]], %[[VAL_1]] : index -! CHECK: %[[VAL_30:.*]] = arith.cmpi sgt, %[[VAL_29]], %[[VAL_5]] : index -! CHECK: %[[VAL_31:.*]] = arith.select %[[VAL_30]], %[[VAL_29]], %[[VAL_5]] : index -! CHECK: %[[VAL_32:.*]] = fir.slice %[[VAL_3]], %[[VAL_2]], %[[VAL_3]], %[[VAL_2]], %[[VAL_28]], %[[VAL_3]] : (index, index, index, index, index, index) -> !fir.slice<2> -! CHECK: %[[VAL_33:.*]] = fir.allocmem !fir.array<2x?xf32>, %[[VAL_11]] -! CHECK: br ^bb6(%[[VAL_5]], %[[VAL_11]] : index, index) -! CHECK: ^bb6(%[[VAL_34:.*]]: index, %[[VAL_35:.*]]: index): -! CHECK: %[[VAL_36:.*]] = arith.cmpi sgt, %[[VAL_35]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_36]], ^bb7(%[[VAL_5]], %[[VAL_2]] : index, index), ^bb10 -! CHECK: ^bb7(%[[VAL_37:.*]]: index, %[[VAL_38:.*]]: index): -! CHECK: %[[VAL_39:.*]] = arith.cmpi sgt, %[[VAL_38]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_39]], ^bb8, ^bb9 -! CHECK: ^bb8: -! CHECK: %[[VAL_40:.*]] = arith.addi %[[VAL_37]], %[[VAL_3]] : index -! CHECK: %[[VAL_41:.*]] = arith.addi %[[VAL_34]], %[[VAL_3]] : index -! CHECK: %[[VAL_42:.*]] = fir.array_coor %[[VAL_12]](%[[VAL_13]]) %[[VAL_40]], %[[VAL_41]] : (!fir.ref>, !fir.shape<2>, index, index) -> !fir.ref -! CHECK: %[[VAL_43:.*]] = fir.array_coor %[[VAL_33]](%[[VAL_13]]) %[[VAL_40]], %[[VAL_41]] : (!fir.heap>, !fir.shape<2>, index, index) -> !fir.ref -! CHECK: %[[VAL_44:.*]] = fir.load %[[VAL_42]] : !fir.ref -! CHECK: fir.store %[[VAL_44]] to %[[VAL_43]] : !fir.ref -! CHECK: %[[VAL_45:.*]] = arith.subi %[[VAL_38]], %[[VAL_3]] : index -! CHECK: br ^bb7(%[[VAL_40]], %[[VAL_45]] : index, index) -! CHECK: ^bb9: -! CHECK: %[[VAL_46:.*]] = arith.addi %[[VAL_34]], %[[VAL_3]] : index -! CHECK: %[[VAL_47:.*]] = arith.subi %[[VAL_35]], %[[VAL_3]] : index -! CHECK: br ^bb6(%[[VAL_46]], %[[VAL_47]] : index, index) -! CHECK: ^bb10: -! CHECK: %[[VAL_48:.*]] = arith.subi %[[VAL_27]], %[[VAL_6]] : i32 -! CHECK: %[[VAL_49:.*]] = fir.convert %[[VAL_48]] : (i32) -> index -! CHECK: %[[VAL_50:.*]] = fir.slice %[[VAL_3]], %[[VAL_2]], %[[VAL_3]], %[[VAL_3]], %[[VAL_49]], %[[VAL_3]] : (index, index, index, index, index, index) -> !fir.slice<2> -! CHECK: br ^bb11(%[[VAL_5]], %[[VAL_31]] : index, index) -! CHECK: ^bb11(%[[VAL_51:.*]]: index, %[[VAL_52:.*]]: index): -! CHECK: %[[VAL_53:.*]] = arith.cmpi sgt, %[[VAL_52]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_53]], ^bb12(%[[VAL_5]], %[[VAL_2]] : index, index), ^bb15(%[[VAL_5]], %[[VAL_11]] : index, index) -! CHECK: ^bb12(%[[VAL_54:.*]]: index, %[[VAL_55:.*]]: index): -! CHECK: %[[VAL_56:.*]] = arith.cmpi sgt, %[[VAL_55]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_56]], ^bb13, ^bb14 -! CHECK: ^bb13: -! CHECK: %[[VAL_57:.*]] = arith.addi %[[VAL_54]], %[[VAL_3]] : index -! CHECK: %[[VAL_58:.*]] = arith.addi %[[VAL_51]], %[[VAL_3]] : index -! CHECK: %[[VAL_59:.*]] = fir.array_coor %[[VAL_12]](%[[VAL_13]]) {{\[}}%[[VAL_50]]] %[[VAL_57]], %[[VAL_58]] : (!fir.ref>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref -! CHECK: %[[VAL_60:.*]] = fir.load %[[VAL_59]] : !fir.ref -! CHECK: %[[VAL_61:.*]] = arith.addf %[[VAL_60]], %[[VAL_7]] {{.*}}: f32 -! CHECK: %[[VAL_62:.*]] = fir.array_coor %[[VAL_33]](%[[VAL_13]]) {{\[}}%[[VAL_32]]] %[[VAL_57]], %[[VAL_58]] : (!fir.heap>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref -! CHECK: fir.store %[[VAL_61]] to %[[VAL_62]] : !fir.ref -! CHECK: %[[VAL_63:.*]] = arith.subi %[[VAL_55]], %[[VAL_3]] : index -! CHECK: br ^bb12(%[[VAL_57]], %[[VAL_63]] : index, index) -! CHECK: ^bb14: -! CHECK: %[[VAL_64:.*]] = arith.addi %[[VAL_51]], %[[VAL_3]] : index -! CHECK: %[[VAL_65:.*]] = arith.subi %[[VAL_52]], %[[VAL_3]] : index -! CHECK: br ^bb11(%[[VAL_64]], %[[VAL_65]] : index, index) -! CHECK: ^bb15(%[[VAL_66:.*]]: index, %[[VAL_67:.*]]: index): -! CHECK: %[[VAL_68:.*]] = arith.cmpi sgt, %[[VAL_67]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_68]], ^bb16(%[[VAL_5]], %[[VAL_2]] : index, index), ^bb19 -! CHECK: ^bb16(%[[VAL_69:.*]]: index, %[[VAL_70:.*]]: index): -! CHECK: %[[VAL_71:.*]] = arith.cmpi sgt, %[[VAL_70]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_71]], ^bb17, ^bb18 -! CHECK: ^bb17: -! CHECK: %[[VAL_72:.*]] = arith.addi %[[VAL_69]], %[[VAL_3]] : index -! CHECK: %[[VAL_73:.*]] = arith.addi %[[VAL_66]], %[[VAL_3]] : index -! CHECK: %[[VAL_74:.*]] = fir.array_coor %[[VAL_33]](%[[VAL_13]]) %[[VAL_72]], %[[VAL_73]] : (!fir.heap>, !fir.shape<2>, index, index) -> !fir.ref -! CHECK: %[[VAL_75:.*]] = fir.array_coor %[[VAL_12]](%[[VAL_13]]) %[[VAL_72]], %[[VAL_73]] : (!fir.ref>, !fir.shape<2>, index, index) -> !fir.ref -! CHECK: %[[VAL_76:.*]] = fir.load %[[VAL_74]] : !fir.ref -! CHECK: fir.store %[[VAL_76]] to %[[VAL_75]] : !fir.ref -! CHECK: %[[VAL_77:.*]] = arith.subi %[[VAL_70]], %[[VAL_3]] : index -! CHECK: br ^bb16(%[[VAL_72]], %[[VAL_77]] : index, index) -! CHECK: ^bb18: -! CHECK: %[[VAL_78:.*]] = arith.addi %[[VAL_66]], %[[VAL_3]] : index -! CHECK: %[[VAL_79:.*]] = arith.subi %[[VAL_67]], %[[VAL_3]] : index -! CHECK: br ^bb15(%[[VAL_78]], %[[VAL_79]] : index, index) -! CHECK: ^bb19: -! CHECK: fir.freemem %[[VAL_33]] : !fir.heap> -! CHECK: %[[VAL_82:.*]] = fir.call @_FortranAioBeginExternalListOutput(%[[VAL_8]], %{{.*}}, %{{.*}}) {{.*}}: (i32, !fir.ref, i32) -> !fir.ref -! CHECK: %[[VAL_83:.*]] = fir.slice %[[VAL_3]], %[[VAL_2]], %[[VAL_3]], %[[VAL_3]], %[[VAL_2]], %[[VAL_3]] : (index, index, index, index, index, index) -> !fir.slice<2> -! CHECK: %[[VAL_84:.*]] = fir.embox %[[VAL_12]](%[[VAL_13]]) {{\[}}%[[VAL_83]]] : (!fir.ref>, !fir.shape<2>, !fir.slice<2>) -> !fir.box> -! CHECK: %[[VAL_85:.*]] = fir.convert %[[VAL_84]] : (!fir.box>) -> !fir.box -! CHECK: %[[VAL_86:.*]] = fir.call @_FortranAioOutputDescriptor(%[[VAL_82]], %[[VAL_85]]) {{.*}}: (!fir.ref, !fir.box) -> i1 -! CHECK: %[[VAL_87:.*]] = fir.load %[[VAL_0]] : !fir.ref -! CHECK: %[[VAL_88:.*]] = arith.subi %[[VAL_87]], %[[VAL_6]] : i32 -! CHECK: %[[VAL_89:.*]] = fir.convert %[[VAL_88]] : (i32) -> index -! CHECK: %[[VAL_90:.*]] = fir.convert %[[VAL_87]] : (i32) -> index -! CHECK: %[[VAL_91:.*]] = fir.slice %[[VAL_3]], %[[VAL_2]], %[[VAL_3]], %[[VAL_89]], %[[VAL_90]], %[[VAL_3]] : (index, index, index, index, index, index) -> !fir.slice<2> -! CHECK: %[[VAL_92:.*]] = fir.embox %[[VAL_12]](%[[VAL_13]]) {{\[}}%[[VAL_91]]] : (!fir.ref>, !fir.shape<2>, !fir.slice<2>) -> !fir.box> -! CHECK: %[[VAL_93:.*]] = fir.convert %[[VAL_92]] : (!fir.box>) -> !fir.box -! CHECK: %[[VAL_94:.*]] = fir.call @_FortranAioOutputDescriptor(%[[VAL_82]], %[[VAL_93]]) {{.*}}: (!fir.ref, !fir.box) -> i1 -! CHECK: %[[VAL_95:.*]] = fir.call @_FortranAioEndIoStatement(%[[VAL_82]]) {{.*}}: (!fir.ref) -> i32 -! CHECK: return -! CHECK: } +! CHECK-SAME: %arg0: !fir.ref {fir.bindc_name = "n"}) { +! CHECK: %[[C_m1:[-0-9a-z_]+]] = arith.constant -1 : index +! CHECK: %[[C_2:[-0-9a-z_]+]] = arith.constant 2 : index +! CHECK: %[[C_1:[-0-9a-z_]+]] = arith.constant 1 : index +! CHECK: %[[C_34_i32:[-0-9a-z_]+]] = arith.constant 34 : i32 +! CHECK: %[[C_m1_i32:[-0-9a-z_]+]] = arith.constant -1 : i32 +! CHECK: %[[C_st:[-0-9a-z_]+]] = arith.constant 7.000000e+00 : f32 +! CHECK: %[[C_1_i32:[-0-9a-z_]+]] = arith.constant 1 : i32 +! CHECK: %[[C_st_0:[-0-9a-z_]+]] = arith.constant -2.000000e+00 : f32 +! CHECK: %[[C_0:[-0-9a-z_]+]] = arith.constant 0 : index +! CHECK: %[[V_0:[0-9]+]] = fir.load %arg0 : !fir.ref +! CHECK: %[[V_1:[0-9]+]] = fir.convert %[[V_0:[0-9]+]] : (i32) -> index +! CHECK: %[[V_2:[0-9]+]] = arith.cmpi sgt, %[[V_1]], %[[C_0]] : index +! CHECK: %[[V_3:[0-9]+]] = arith.select %[[V_2]], %[[V_1]], %[[C_0]] : index +! CHECK: %[[V_4:[0-9]+]] = fir.alloca !fir.array<2x?xf32>, %[[V_3]] {bindc_name = "aa", uniq_name = "_QFss3Eaa"} +! CHECK: %[[V_5:[0-9]+]] = fir.shape %[[C_2]], %[[V_3:[0-9]+]] : (index, index) -> !fir.shape<2> +! CHECK: cf.br ^bb1(%[[C_0]], %[[V_3:[0-9]+]] : index, index) +! CHECK: ^bb1(%[[V_6:[0-9]+]]: index, %[[V_7:[0-9]+]]: index): // 2 preds: ^bb0, ^bb4 +! CHECK: %[[V_8:[0-9]+]] = arith.cmpi sgt, %[[V_7]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_8]], ^bb2(%[[C_0]], %[[C_2]] : index, index), ^bb5 +! CHECK: ^bb2(%[[V_9:[0-9]+]]: index, %[[V_10:[0-9]+]]: index): // 2 preds: ^bb1, ^bb3 +! CHECK: %[[V_11:[0-9]+]] = arith.cmpi sgt, %[[V_10]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_11]], ^bb3, ^bb4 +! CHECK: ^bb3: // pred: ^bb2 +! CHECK: %[[V_12:[0-9]+]] = arith.addi %[[V_9]], %[[C_1]] : index +! CHECK: %[[V_13:[0-9]+]] = arith.addi %[[V_6]], %[[C_1]] : index +! CHECK: %[[V_14:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_12]], %[[V_13:[0-9]+]] : (!fir.ref>, !fir.shape<2>, index, index) -> !fir.ref +! CHECK: fir.store %[[C_st_0]] to %[[V_14:[0-9]+]] : !fir.ref +! CHECK: %[[V_15:[0-9]+]] = arith.subi %[[V_10]], %[[C_1]] : index +! CHECK: cf.br ^bb2(%[[V_12]], %[[V_15:[0-9]+]] : index, index) +! CHECK: ^bb4: // pred: ^bb2 +! CHECK: %[[V_16:[0-9]+]] = arith.addi %[[V_6]], %[[C_1]] : index +! CHECK: %[[V_17:[0-9]+]] = arith.subi %[[V_7]], %[[C_1]] : index +! CHECK: cf.br ^bb1(%[[V_16]], %[[V_17:[0-9]+]] : index, index) +! CHECK: ^bb5: // pred: ^bb1 +! CHECK: %[[V_18:[0-9]+]] = fir.load %arg0 : !fir.ref +! CHECK: %[[V_19:[0-9]+]] = fir.convert %[[V_18:[0-9]+]] : (i32) -> index +! CHECK: %[[V_20:[0-9]+]] = arith.addi %[[V_19]], %[[C_m1]] : index +! CHECK: %[[V_21:[0-9]+]] = arith.cmpi sgt, %[[V_20]], %[[C_0]] : index +! CHECK: %[[V_22:[0-9]+]] = arith.select %[[V_21]], %[[V_20]], %[[C_0]] : index +! 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> +! CHECK: %[[V_24:[0-9]+]] = fir.allocmem !fir.array<2x?xf32>, %[[V_3]] +! CHECK: cf.br ^bb6(%[[C_0]], %[[V_3:[0-9]+]] : index, index) +! CHECK: ^bb6(%[[V_25:[0-9]+]]: index, %[[V_26:[0-9]+]]: index): // 2 preds: ^bb5, ^bb9 +! CHECK: %[[V_27:[0-9]+]] = arith.cmpi sgt, %[[V_26]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_27]], ^bb7(%[[C_0]], %[[C_2]] : index, index), ^bb10 +! CHECK: ^bb7(%[[V_28:[0-9]+]]: index, %[[V_29:[0-9]+]]: index): // 2 preds: ^bb6, ^bb8 +! CHECK: %[[V_30:[0-9]+]] = arith.cmpi sgt, %[[V_29]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_30]], ^bb8, ^bb9 +! CHECK: ^bb8: // pred: ^bb7 +! CHECK: %[[V_31:[0-9]+]] = arith.addi %[[V_28]], %[[C_1]] : index +! CHECK: %[[V_32:[0-9]+]] = arith.addi %[[V_25]], %[[C_1]] : index +! CHECK: %[[V_33:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_31]], %[[V_32:[0-9]+]] : (!fir.ref>, !fir.shape<2>, index, index) -> !fir.ref +! CHECK: %[[V_34:[0-9]+]] = fir.array_coor %[[V_24]](%[[V_5]]) %[[V_31]], %[[V_32:[0-9]+]] : (!fir.heap>, !fir.shape<2>, index, index) -> !fir.ref +! CHECK: %[[V_35:[0-9]+]] = fir.load %[[V_33:[0-9]+]] : !fir.ref +! CHECK: fir.store %[[V_35]] to %[[V_34:[0-9]+]] : !fir.ref +! CHECK: %[[V_36:[0-9]+]] = arith.subi %[[V_29]], %[[C_1]] : index +! CHECK: cf.br ^bb7(%[[V_31]], %[[V_36:[0-9]+]] : index, index) +! CHECK: ^bb9: // pred: ^bb7 +! CHECK: %[[V_37:[0-9]+]] = arith.addi %[[V_25]], %[[C_1]] : index +! CHECK: %[[V_38:[0-9]+]] = arith.subi %[[V_26]], %[[C_1]] : index +! CHECK: cf.br ^bb6(%[[V_37]], %[[V_38:[0-9]+]] : index, index) +! CHECK: ^bb10: // pred: ^bb6 +! CHECK: %[[V_39:[0-9]+]] = arith.subi %[[V_18]], %[[C_1_i32]] : i32 +! CHECK: %[[V_40:[0-9]+]] = fir.convert %[[V_39:[0-9]+]] : (i32) -> index +! 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> +! CHECK: cf.br ^bb11(%[[C_0]], %[[V_22:[0-9]+]] : index, index) +! CHECK: ^bb11(%[[V_42:[0-9]+]]: index, %[[V_43:[0-9]+]]: index): // 2 preds: ^bb10, ^bb14 +! CHECK: %[[V_44:[0-9]+]] = arith.cmpi sgt, %[[V_43]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_44]], ^bb12(%[[C_0]], %[[C_2]] : index, index), ^bb15(%[[C_0]], %[[V_3:[0-9]+]] : index, index) +! CHECK: ^bb12(%[[V_45:[0-9]+]]: index, %[[V_46:[0-9]+]]: index): // 2 preds: ^bb11, ^bb13 +! CHECK: %[[V_47:[0-9]+]] = arith.cmpi sgt, %[[V_46]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_47]], ^bb13, ^bb14 +! CHECK: ^bb13: // pred: ^bb12 +! CHECK: %[[V_48:[0-9]+]] = arith.addi %[[V_45]], %[[C_1]] : index +! CHECK: %[[V_49:[0-9]+]] = arith.addi %[[V_42]], %[[C_1]] : index +! CHECK: %[[V_50:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) [%[[V_41]]] %[[V_48]], %[[V_49:[0-9]+]] : (!fir.ref>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref +! CHECK: %[[V_51:[0-9]+]] = fir.load %[[V_50:[0-9]+]] : !fir.ref +! CHECK: %[[V_52:[0-9]+]] = arith.addf %[[V_51]], %[[C_st]] fastmath : f32 +! CHECK: %[[V_53:[0-9]+]] = fir.array_coor %[[V_24]](%[[V_5]]) [%[[V_23]]] %[[V_48]], %[[V_49:[0-9]+]] : (!fir.heap>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref +! CHECK: fir.store %[[V_52]] to %[[V_53:[0-9]+]] : !fir.ref +! CHECK: %[[V_54:[0-9]+]] = arith.subi %[[V_46]], %[[C_1]] : index +! CHECK: cf.br ^bb12(%[[V_48]], %[[V_54:[0-9]+]] : index, index) +! CHECK: ^bb14: // pred: ^bb12 +! CHECK: %[[V_55:[0-9]+]] = arith.addi %[[V_42]], %[[C_1]] : index +! CHECK: %[[V_56:[0-9]+]] = arith.subi %[[V_43]], %[[C_1]] : index +! CHECK: cf.br ^bb11(%[[V_55]], %[[V_56:[0-9]+]] : index, index) +! CHECK: ^bb15(%[[V_57:[0-9]+]]: index, %[[V_58:[0-9]+]]: index): // 2 preds: ^bb11, ^bb18 +! CHECK: %[[V_59:[0-9]+]] = arith.cmpi sgt, %[[V_58]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_59]], ^bb16(%[[C_0]], %[[C_2]] : index, index), ^bb19 +! CHECK: ^bb16(%[[V_60:[0-9]+]]: index, %[[V_61:[0-9]+]]: index): // 2 preds: ^bb15, ^bb17 +! CHECK: %[[V_62:[0-9]+]] = arith.cmpi sgt, %[[V_61]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_62]], ^bb17, ^bb18 +! CHECK: ^bb17: // pred: ^bb16 +! CHECK: %[[V_63:[0-9]+]] = arith.addi %[[V_60]], %[[C_1]] : index +! CHECK: %[[V_64:[0-9]+]] = arith.addi %[[V_57]], %[[C_1]] : index +! CHECK: %[[V_65:[0-9]+]] = fir.array_coor %[[V_24]](%[[V_5]]) %[[V_63]], %[[V_64:[0-9]+]] : (!fir.heap>, !fir.shape<2>, index, index) -> !fir.ref +! CHECK: %[[V_66:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_63]], %[[V_64:[0-9]+]] : (!fir.ref>, !fir.shape<2>, index, index) -> !fir.ref +! CHECK: %[[V_67:[0-9]+]] = fir.load %[[V_65:[0-9]+]] : !fir.ref +! CHECK: fir.store %[[V_67]] to %[[V_66:[0-9]+]] : !fir.ref +! CHECK: %[[V_68:[0-9]+]] = arith.subi %[[V_61]], %[[C_1]] : index +! CHECK: cf.br ^bb16(%[[V_63]], %[[V_68:[0-9]+]] : index, index) +! CHECK: ^bb18: // pred: ^bb16 +! CHECK: %[[V_69:[0-9]+]] = arith.addi %[[V_57]], %[[C_1]] : index +! CHECK: %[[V_70:[0-9]+]] = arith.subi %[[V_58]], %[[C_1]] : index +! CHECK: cf.br ^bb15(%[[V_69]], %[[V_70:[0-9]+]] : index, index) +! CHECK: ^bb19: // pred: ^bb15 +! CHECK: fir.freemem %[[V_24:[0-9]+]] : !fir.heap> +! CHECK: %[[V_73:[0-9]+]] = fir.call @_FortranAioBeginExternalListOutput(%[[C_m1_i32]], %{{.*}}, %{{.*}}) {{.*}}: (i32, !fir.ref, i32) -> !fir.ref +! 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> +! CHECK: %[[V_75:[0-9]+]] = fir.embox %[[V_4]](%[[V_5]]) [%[[V_74]]] : (!fir.ref>, !fir.shape<2>, !fir.slice<2>) -> !fir.box> +! CHECK: %[[V_76:[0-9]+]] = fir.convert %[[V_75:[0-9]+]] : (!fir.box>) -> !fir.box +! CHECK: %[[V_77:[0-9]+]] = fir.call @_FortranAioOutputDescriptor(%[[V_73]], %[[V_76]]) fastmath : (!fir.ref, !fir.box) -> i1 +! CHECK: %[[V_78:[0-9]+]] = fir.load %arg0 : !fir.ref +! CHECK: %[[V_79:[0-9]+]] = arith.subi %[[V_78]], %[[C_1_i32]] : i32 +! CHECK: %[[V_80:[0-9]+]] = fir.convert %[[V_79:[0-9]+]] : (i32) -> index +! CHECK: %[[V_81:[0-9]+]] = fir.convert %[[V_78:[0-9]+]] : (i32) -> index +! 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> +! CHECK: %[[V_83:[0-9]+]] = fir.embox %[[V_4]](%[[V_5]]) [%[[V_82]]] : (!fir.ref>, !fir.shape<2>, !fir.slice<2>) -> !fir.box> +! CHECK: %[[V_84:[0-9]+]] = fir.convert %[[V_83:[0-9]+]] : (!fir.box>) -> !fir.box +! CHECK: %[[V_85:[0-9]+]] = fir.call @_FortranAioOutputDescriptor(%[[V_73]], %[[V_84]]) fastmath : (!fir.ref, !fir.box) -> i1 +! CHECK: %[[V_86:[0-9]+]] = fir.call @_FortranAioEndIoStatement(%[[V_73]]) fastmath : (!fir.ref) -> i32 +! CHECK: return +! CHECK: } ! CHECK-LABEL: func @_QPss4( -! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref {fir.bindc_name = "n"}) { -! CHECK-DAG: %[[VAL_1:.*]] = arith.constant -1 : index -! CHECK-DAG: %[[VAL_2:.*]] = arith.constant 2 : index -! CHECK-DAG: %[[VAL_3:.*]] = arith.constant 1 : index -! CHECK-DAG: %[[VAL_4:.*]] = arith.constant -2 : i32 -! CHECK-DAG: %[[VAL_5:.*]] = arith.constant 0 : index -! CHECK-DAG: %[[VAL_6:.*]] = arith.constant 1 : i32 -! CHECK-DAG: %[[VAL_7:.*]] = arith.constant 7.000000e+00 : f32 -! CHECK-DAG: %[[VAL_8:.*]] = arith.constant -1 : i32 -! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_0]] : !fir.ref -! CHECK: %[[VAL_11A:.*]] = fir.convert %[[VAL_10]] : (i32) -> index -! CHECK: %[[CMP:.*]] = arith.cmpi sgt, %[[VAL_11A]], %[[VAL_5]] : index -! CHECK: %[[VAL_11:.*]] = arith.select %[[CMP]], %[[VAL_11A]], %[[VAL_5]] : index -! CHECK: %[[VAL_12:.*]] = fir.alloca !fir.array, %[[VAL_11]] {bindc_name = "aa", uniq_name = "_QFss4Eaa"} -! CHECK: %[[VAL_13:.*]] = fir.shape %[[VAL_11]], %[[VAL_2]] : (index, index) -> !fir.shape<2> -! CHECK: %[[VAL_14:.*]] = fir.convert %[[VAL_4]] : (i32) -> f32 -! CHECK: br ^bb1(%[[VAL_5]], %[[VAL_2]] : index, index) -! CHECK: ^bb1(%[[VAL_15:.*]]: index, %[[VAL_16:.*]]: index): -! CHECK: %[[VAL_17:.*]] = arith.cmpi sgt, %[[VAL_16]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_17]], ^bb2(%[[VAL_5]], %[[VAL_11]] : index, index), ^bb5 -! CHECK: ^bb2(%[[VAL_18:.*]]: index, %[[VAL_19:.*]]: index): -! CHECK: %[[VAL_20:.*]] = arith.cmpi sgt, %[[VAL_19]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_20]], ^bb3, ^bb4 -! CHECK: ^bb3: -! CHECK: %[[VAL_21:.*]] = arith.addi %[[VAL_18]], %[[VAL_3]] : index -! CHECK: %[[VAL_22:.*]] = arith.addi %[[VAL_15]], %[[VAL_3]] : index -! CHECK: %[[VAL_23:.*]] = fir.array_coor %[[VAL_12]](%[[VAL_13]]) %[[VAL_21]], %[[VAL_22]] : (!fir.ref>, !fir.shape<2>, index, index) -> !fir.ref -! CHECK: fir.store %[[VAL_14]] to %[[VAL_23]] : !fir.ref -! CHECK: %[[VAL_24:.*]] = arith.subi %[[VAL_19]], %[[VAL_3]] : index -! CHECK: br ^bb2(%[[VAL_21]], %[[VAL_24]] : index, index) -! CHECK: ^bb4: -! CHECK: %[[VAL_25:.*]] = arith.addi %[[VAL_15]], %[[VAL_3]] : index -! CHECK: %[[VAL_26:.*]] = arith.subi %[[VAL_16]], %[[VAL_3]] : index -! CHECK: br ^bb1(%[[VAL_25]], %[[VAL_26]] : index, index) -! CHECK: ^bb5: -! CHECK: %[[VAL_27:.*]] = fir.load %[[VAL_0]] : !fir.ref -! CHECK: %[[VAL_28:.*]] = fir.convert %[[VAL_27]] : (i32) -> index -! CHECK: %[[VAL_29:.*]] = arith.addi %[[VAL_28]], %[[VAL_1]] : index -! CHECK: %[[VAL_30:.*]] = arith.cmpi sgt, %[[VAL_29]], %[[VAL_5]] : index -! CHECK: %[[VAL_31:.*]] = arith.select %[[VAL_30]], %[[VAL_29]], %[[VAL_5]] : index -! CHECK: %[[VAL_32:.*]] = fir.slice %[[VAL_2]], %[[VAL_28]], %[[VAL_3]], %[[VAL_3]], %[[VAL_2]], %[[VAL_3]] : (index, index, index, index, index, index) -> !fir.slice<2> -! CHECK: %[[VAL_33:.*]] = fir.allocmem !fir.array, %[[VAL_11]] -! CHECK: br ^bb6(%[[VAL_5]], %[[VAL_2]] : index, index) -! CHECK: ^bb6(%[[VAL_34:.*]]: index, %[[VAL_35:.*]]: index): -! CHECK: %[[VAL_36:.*]] = arith.cmpi sgt, %[[VAL_35]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_36]], ^bb7(%[[VAL_5]], %[[VAL_11]] : index, index), ^bb10 -! CHECK: ^bb7(%[[VAL_37:.*]]: index, %[[VAL_38:.*]]: index): -! CHECK: %[[VAL_39:.*]] = arith.cmpi sgt, %[[VAL_38]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_39]], ^bb8, ^bb9 -! CHECK: ^bb8: -! CHECK: %[[VAL_40:.*]] = arith.addi %[[VAL_37]], %[[VAL_3]] : index -! CHECK: %[[VAL_41:.*]] = arith.addi %[[VAL_34]], %[[VAL_3]] : index -! CHECK: %[[VAL_42:.*]] = fir.array_coor %[[VAL_12]](%[[VAL_13]]) %[[VAL_40]], %[[VAL_41]] : (!fir.ref>, !fir.shape<2>, index, index) -> !fir.ref -! CHECK: %[[VAL_43:.*]] = fir.array_coor %[[VAL_33]](%[[VAL_13]]) %[[VAL_40]], %[[VAL_41]] : (!fir.heap>, !fir.shape<2>, index, index) -> !fir.ref -! CHECK: %[[VAL_44:.*]] = fir.load %[[VAL_42]] : !fir.ref -! CHECK: fir.store %[[VAL_44]] to %[[VAL_43]] : !fir.ref -! CHECK: %[[VAL_45:.*]] = arith.subi %[[VAL_38]], %[[VAL_3]] : index -! CHECK: br ^bb7(%[[VAL_40]], %[[VAL_45]] : index, index) -! CHECK: ^bb9: -! CHECK: %[[VAL_46:.*]] = arith.addi %[[VAL_34]], %[[VAL_3]] : index -! CHECK: %[[VAL_47:.*]] = arith.subi %[[VAL_35]], %[[VAL_3]] : index -! CHECK: br ^bb6(%[[VAL_46]], %[[VAL_47]] : index, index) -! CHECK: ^bb10: -! CHECK: %[[VAL_48:.*]] = arith.subi %[[VAL_27]], %[[VAL_6]] : i32 -! CHECK: %[[VAL_49:.*]] = fir.convert %[[VAL_48]] : (i32) -> index -! CHECK: %[[VAL_50:.*]] = fir.slice %[[VAL_3]], %[[VAL_49]], %[[VAL_3]], %[[VAL_3]], %[[VAL_2]], %[[VAL_3]] : (index, index, index, index, index, index) -> !fir.slice<2> -! CHECK: br ^bb11(%[[VAL_5]], %[[VAL_2]] : index, index) -! CHECK: ^bb11(%[[VAL_51:.*]]: index, %[[VAL_52:.*]]: index): -! CHECK: %[[VAL_53:.*]] = arith.cmpi sgt, %[[VAL_52]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_53]], ^bb12(%[[VAL_5]], %[[VAL_31]] : index, index), ^bb15(%[[VAL_5]], %[[VAL_2]] : index, index) -! CHECK: ^bb12(%[[VAL_54:.*]]: index, %[[VAL_55:.*]]: index): -! CHECK: %[[VAL_56:.*]] = arith.cmpi sgt, %[[VAL_55]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_56]], ^bb13, ^bb14 -! CHECK: ^bb13: -! CHECK: %[[VAL_57:.*]] = arith.addi %[[VAL_54]], %[[VAL_3]] : index -! CHECK: %[[VAL_58:.*]] = arith.addi %[[VAL_51]], %[[VAL_3]] : index -! CHECK: %[[VAL_59:.*]] = fir.array_coor %[[VAL_12]](%[[VAL_13]]) {{\[}}%[[VAL_50]]] %[[VAL_57]], %[[VAL_58]] : (!fir.ref>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref -! CHECK: %[[VAL_60:.*]] = fir.load %[[VAL_59]] : !fir.ref -! CHECK: %[[VAL_61:.*]] = arith.addf %[[VAL_60]], %[[VAL_7]] {{.*}}: f32 -! CHECK: %[[VAL_62:.*]] = fir.array_coor %[[VAL_33]](%[[VAL_13]]) {{\[}}%[[VAL_32]]] %[[VAL_57]], %[[VAL_58]] : (!fir.heap>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref -! CHECK: fir.store %[[VAL_61]] to %[[VAL_62]] : !fir.ref -! CHECK: %[[VAL_63:.*]] = arith.subi %[[VAL_55]], %[[VAL_3]] : index -! CHECK: br ^bb12(%[[VAL_57]], %[[VAL_63]] : index, index) -! CHECK: ^bb14: -! CHECK: %[[VAL_64:.*]] = arith.addi %[[VAL_51]], %[[VAL_3]] : index -! CHECK: %[[VAL_65:.*]] = arith.subi %[[VAL_52]], %[[VAL_3]] : index -! CHECK: br ^bb11(%[[VAL_64]], %[[VAL_65]] : index, index) -! CHECK: ^bb15(%[[VAL_66:.*]]: index, %[[VAL_67:.*]]: index): -! CHECK: %[[VAL_68:.*]] = arith.cmpi sgt, %[[VAL_67]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_68]], ^bb16(%[[VAL_5]], %[[VAL_11]] : index, index), ^bb19 -! CHECK: ^bb16(%[[VAL_69:.*]]: index, %[[VAL_70:.*]]: index): -! CHECK: %[[VAL_71:.*]] = arith.cmpi sgt, %[[VAL_70]], %[[VAL_5]] : index -! CHECK: cond_br %[[VAL_71]], ^bb17, ^bb18 -! CHECK: ^bb17: -! CHECK: %[[VAL_72:.*]] = arith.addi %[[VAL_69]], %[[VAL_3]] : index -! CHECK: %[[VAL_73:.*]] = arith.addi %[[VAL_66]], %[[VAL_3]] : index -! CHECK: %[[VAL_74:.*]] = fir.array_coor %[[VAL_33]](%[[VAL_13]]) %[[VAL_72]], %[[VAL_73]] : (!fir.heap>, !fir.shape<2>, index, index) -> !fir.ref -! CHECK: %[[VAL_75:.*]] = fir.array_coor %[[VAL_12]](%[[VAL_13]]) %[[VAL_72]], %[[VAL_73]] : (!fir.ref>, !fir.shape<2>, index, index) -> !fir.ref -! CHECK: %[[VAL_76:.*]] = fir.load %[[VAL_74]] : !fir.ref -! CHECK: fir.store %[[VAL_76]] to %[[VAL_75]] : !fir.ref -! CHECK: %[[VAL_77:.*]] = arith.subi %[[VAL_70]], %[[VAL_3]] : index -! CHECK: br ^bb16(%[[VAL_72]], %[[VAL_77]] : index, index) -! CHECK: ^bb18: -! CHECK: %[[VAL_78:.*]] = arith.addi %[[VAL_66]], %[[VAL_3]] : index -! CHECK: %[[VAL_79:.*]] = arith.subi %[[VAL_67]], %[[VAL_3]] : index -! CHECK: br ^bb15(%[[VAL_78]], %[[VAL_79]] : index, index) -! CHECK: ^bb19: -! CHECK: fir.freemem %[[VAL_33]] : !fir.heap> -! CHECK: %[[VAL_82:.*]] = fir.call @_FortranAioBeginExternalListOutput(%[[VAL_8]], %{{.*}}, %{{.*}}) {{.*}}: (i32, !fir.ref, i32) -> !fir.ref -! CHECK: %[[VAL_83:.*]] = fir.slice %[[VAL_3]], %[[VAL_2]], %[[VAL_3]], %[[VAL_3]], %[[VAL_2]], %[[VAL_3]] : (index, index, index, index, index, index) -> !fir.slice<2> -! CHECK: %[[VAL_84:.*]] = fir.embox %[[VAL_12]](%[[VAL_13]]) {{\[}}%[[VAL_83]]] : (!fir.ref>, !fir.shape<2>, !fir.slice<2>) -> !fir.box> -! CHECK: %[[VAL_85:.*]] = fir.convert %[[VAL_84]] : (!fir.box>) -> !fir.box -! CHECK: %[[VAL_86:.*]] = fir.call @_FortranAioOutputDescriptor(%[[VAL_82]], %[[VAL_85]]) {{.*}}: (!fir.ref, !fir.box) -> i1 -! CHECK: %[[VAL_87:.*]] = fir.load %[[VAL_0]] : !fir.ref -! CHECK: %[[VAL_88:.*]] = arith.subi %[[VAL_87]], %[[VAL_6]] : i32 -! CHECK: %[[VAL_89:.*]] = fir.convert %[[VAL_88]] : (i32) -> index -! CHECK: %[[VAL_90:.*]] = fir.convert %[[VAL_87]] : (i32) -> index -! CHECK: %[[VAL_91:.*]] = fir.slice %[[VAL_89]], %[[VAL_90]], %[[VAL_3]], %[[VAL_3]], %[[VAL_2]], %[[VAL_3]] : (index, index, index, index, index, index) -> !fir.slice<2> -! CHECK: %[[VAL_92:.*]] = fir.embox %[[VAL_12]](%[[VAL_13]]) {{\[}}%[[VAL_91]]] : (!fir.ref>, !fir.shape<2>, !fir.slice<2>) -> !fir.box> -! CHECK: %[[VAL_93:.*]] = fir.convert %[[VAL_92]] : (!fir.box>) -> !fir.box -! CHECK: %[[VAL_94:.*]] = fir.call @_FortranAioOutputDescriptor(%[[VAL_82]], %[[VAL_93]]) {{.*}}: (!fir.ref, !fir.box) -> i1 -! CHECK: %[[VAL_95:.*]] = fir.call @_FortranAioEndIoStatement(%[[VAL_82]]) {{.*}}: (!fir.ref) -> i32 -! CHECK: return -! CHECK: } - +! CHECK-SAME: %arg0: !fir.ref {fir.bindc_name = "n"}) { +! CHECK: %[[C_2:[-0-9a-z_]+]] = arith.constant 2 : index +! CHECK: %[[C_m1:[-0-9a-z_]+]] = arith.constant -1 : index +! CHECK: %[[C_1:[-0-9a-z_]+]] = arith.constant 1 : index +! CHECK: %[[C_41_i32:[-0-9a-z_]+]] = arith.constant 41 : i32 +! CHECK: %[[C_m1_i32:[-0-9a-z_]+]] = arith.constant -1 : i32 +! CHECK: %[[C_st:[-0-9a-z_]+]] = arith.constant 7.000000e+00 : f32 +! CHECK: %[[C_1_i32:[-0-9a-z_]+]] = arith.constant 1 : i32 +! CHECK: %[[C_st_0:[-0-9a-z_]+]] = arith.constant -2.000000e+00 : f32 +! CHECK: %[[C_0:[-0-9a-z_]+]] = arith.constant 0 : index +! CHECK: %[[V_0:[0-9]+]] = fir.load %arg0 : !fir.ref +! CHECK: %[[V_1:[0-9]+]] = fir.convert %[[V_0:[0-9]+]] : (i32) -> index +! CHECK: %[[V_2:[0-9]+]] = arith.cmpi sgt, %[[V_1]], %[[C_0]] : index +! CHECK: %[[V_3:[0-9]+]] = arith.select %[[V_2]], %[[V_1]], %[[C_0]] : index +! CHECK: %[[V_4:[0-9]+]] = fir.alloca !fir.array, %[[V_3]] {bindc_name = "aa", uniq_name = "_QFss4Eaa"} +! CHECK: %[[V_5:[0-9]+]] = fir.shape %[[V_3]], %[[C_2]] : (index, index) -> !fir.shape<2> +! CHECK: cf.br ^bb1(%[[C_0]], %[[C_2]] : index, index) +! CHECK: ^bb1(%[[V_6:[0-9]+]]: index, %[[V_7:[0-9]+]]: index): // 2 preds: ^bb0, ^bb4 +! CHECK: %[[V_8:[0-9]+]] = arith.cmpi sgt, %[[V_7]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_8]], ^bb2(%[[C_0]], %[[V_3:[0-9]+]] : index, index), ^bb5 +! CHECK: ^bb2(%[[V_9:[0-9]+]]: index, %[[V_10:[0-9]+]]: index): // 2 preds: ^bb1, ^bb3 +! CHECK: %[[V_11:[0-9]+]] = arith.cmpi sgt, %[[V_10]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_11]], ^bb3, ^bb4 +! CHECK: ^bb3: // pred: ^bb2 +! CHECK: %[[V_12:[0-9]+]] = arith.addi %[[V_9]], %[[C_1]] : index +! CHECK: %[[V_13:[0-9]+]] = arith.addi %[[V_6]], %[[C_1]] : index +! CHECK: %[[V_14:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_12]], %[[V_13:[0-9]+]] : (!fir.ref>, !fir.shape<2>, index, index) -> !fir.ref +! CHECK: fir.store %[[C_st_0]] to %[[V_14:[0-9]+]] : !fir.ref +! CHECK: %[[V_15:[0-9]+]] = arith.subi %[[V_10]], %[[C_1]] : index +! CHECK: cf.br ^bb2(%[[V_12]], %[[V_15:[0-9]+]] : index, index) +! CHECK: ^bb4: // pred: ^bb2 +! CHECK: %[[V_16:[0-9]+]] = arith.addi %[[V_6]], %[[C_1]] : index +! CHECK: %[[V_17:[0-9]+]] = arith.subi %[[V_7]], %[[C_1]] : index +! CHECK: cf.br ^bb1(%[[V_16]], %[[V_17:[0-9]+]] : index, index) +! CHECK: ^bb5: // pred: ^bb1 +! CHECK: %[[V_18:[0-9]+]] = fir.load %arg0 : !fir.ref +! CHECK: %[[V_19:[0-9]+]] = fir.convert %[[V_18:[0-9]+]] : (i32) -> index +! CHECK: %[[V_20:[0-9]+]] = arith.addi %[[V_19]], %[[C_m1]] : index +! CHECK: %[[V_21:[0-9]+]] = arith.cmpi sgt, %[[V_20]], %[[C_0]] : index +! CHECK: %[[V_22:[0-9]+]] = arith.select %[[V_21]], %[[V_20]], %[[C_0]] : index +! 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> +! CHECK: %[[V_24:[0-9]+]] = fir.allocmem !fir.array, %[[V_3]] +! CHECK: cf.br ^bb6(%[[C_0]], %[[C_2]] : index, index) +! CHECK: ^bb6(%[[V_25:[0-9]+]]: index, %[[V_26:[0-9]+]]: index): // 2 preds: ^bb5, ^bb9 +! CHECK: %[[V_27:[0-9]+]] = arith.cmpi sgt, %[[V_26]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_27]], ^bb7(%[[C_0]], %[[V_3:[0-9]+]] : index, index), ^bb10 +! CHECK: ^bb7(%[[V_28:[0-9]+]]: index, %[[V_29:[0-9]+]]: index): // 2 preds: ^bb6, ^bb8 +! CHECK: %[[V_30:[0-9]+]] = arith.cmpi sgt, %[[V_29]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_30]], ^bb8, ^bb9 +! CHECK: ^bb8: // pred: ^bb7 +! CHECK: %[[V_31:[0-9]+]] = arith.addi %[[V_28]], %[[C_1]] : index +! CHECK: %[[V_32:[0-9]+]] = arith.addi %[[V_25]], %[[C_1]] : index +! CHECK: %[[V_33:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_31]], %[[V_32:[0-9]+]] : (!fir.ref>, !fir.shape<2>, index, index) -> !fir.ref +! CHECK: %[[V_34:[0-9]+]] = fir.array_coor %[[V_24]](%[[V_5]]) %[[V_31]], %[[V_32:[0-9]+]] : (!fir.heap>, !fir.shape<2>, index, index) -> !fir.ref +! CHECK: %[[V_35:[0-9]+]] = fir.load %[[V_33:[0-9]+]] : !fir.ref +! CHECK: fir.store %[[V_35]] to %[[V_34:[0-9]+]] : !fir.ref +! CHECK: %[[V_36:[0-9]+]] = arith.subi %[[V_29]], %[[C_1]] : index +! CHECK: cf.br ^bb7(%[[V_31]], %[[V_36:[0-9]+]] : index, index) +! CHECK: ^bb9: // pred: ^bb7 +! CHECK: %[[V_37:[0-9]+]] = arith.addi %[[V_25]], %[[C_1]] : index +! CHECK: %[[V_38:[0-9]+]] = arith.subi %[[V_26]], %[[C_1]] : index +! CHECK: cf.br ^bb6(%[[V_37]], %[[V_38:[0-9]+]] : index, index) +! CHECK: ^bb10: // pred: ^bb6 +! CHECK: %[[V_39:[0-9]+]] = arith.subi %[[V_18]], %[[C_1_i32]] : i32 +! CHECK: %[[V_40:[0-9]+]] = fir.convert %[[V_39:[0-9]+]] : (i32) -> index +! 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> +! CHECK: cf.br ^bb11(%[[C_0]], %[[C_2]] : index, index) +! CHECK: ^bb11(%[[V_42:[0-9]+]]: index, %[[V_43:[0-9]+]]: index): // 2 preds: ^bb10, ^bb14 +! CHECK: %[[V_44:[0-9]+]] = arith.cmpi sgt, %[[V_43]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_44]], ^bb12(%[[C_0]], %[[V_22:[0-9]+]] : index, index), ^bb15(%[[C_0]], %[[C_2]] : index, index) +! CHECK: ^bb12(%[[V_45:[0-9]+]]: index, %[[V_46:[0-9]+]]: index): // 2 preds: ^bb11, ^bb13 +! CHECK: %[[V_47:[0-9]+]] = arith.cmpi sgt, %[[V_46]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_47]], ^bb13, ^bb14 +! CHECK: ^bb13: // pred: ^bb12 +! CHECK: %[[V_48:[0-9]+]] = arith.addi %[[V_45]], %[[C_1]] : index +! CHECK: %[[V_49:[0-9]+]] = arith.addi %[[V_42]], %[[C_1]] : index +! CHECK: %[[V_50:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) [%[[V_41]]] %[[V_48]], %[[V_49:[0-9]+]] : (!fir.ref>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref +! CHECK: %[[V_51:[0-9]+]] = fir.load %[[V_50:[0-9]+]] : !fir.ref +! CHECK: %[[V_52:[0-9]+]] = arith.addf %[[V_51]], %[[C_st]] fastmath : f32 +! CHECK: %[[V_53:[0-9]+]] = fir.array_coor %[[V_24]](%[[V_5]]) [%[[V_23]]] %[[V_48]], %[[V_49:[0-9]+]] : (!fir.heap>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref +! CHECK: fir.store %[[V_52]] to %[[V_53:[0-9]+]] : !fir.ref +! CHECK: %[[V_54:[0-9]+]] = arith.subi %[[V_46]], %[[C_1]] : index +! CHECK: cf.br ^bb12(%[[V_48]], %[[V_54:[0-9]+]] : index, index) +! CHECK: ^bb14: // pred: ^bb12 +! CHECK: %[[V_55:[0-9]+]] = arith.addi %[[V_42]], %[[C_1]] : index +! CHECK: %[[V_56:[0-9]+]] = arith.subi %[[V_43]], %[[C_1]] : index +! CHECK: cf.br ^bb11(%[[V_55]], %[[V_56:[0-9]+]] : index, index) +! CHECK: ^bb15(%[[V_57:[0-9]+]]: index, %[[V_58:[0-9]+]]: index): // 2 preds: ^bb11, ^bb18 +! CHECK: %[[V_59:[0-9]+]] = arith.cmpi sgt, %[[V_58]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_59]], ^bb16(%[[C_0]], %[[V_3:[0-9]+]] : index, index), ^bb19 +! CHECK: ^bb16(%[[V_60:[0-9]+]]: index, %[[V_61:[0-9]+]]: index): // 2 preds: ^bb15, ^bb17 +! CHECK: %[[V_62:[0-9]+]] = arith.cmpi sgt, %[[V_61]], %[[C_0]] : index +! CHECK: cf.cond_br %[[V_62]], ^bb17, ^bb18 +! CHECK: ^bb17: // pred: ^bb16 +! CHECK: %[[V_63:[0-9]+]] = arith.addi %[[V_60]], %[[C_1]] : index +! CHECK: %[[V_64:[0-9]+]] = arith.addi %[[V_57]], %[[C_1]] : index +! CHECK: %[[V_65:[0-9]+]] = fir.array_coor %[[V_24]](%[[V_5]]) %[[V_63]], %[[V_64:[0-9]+]] : (!fir.heap>, !fir.shape<2>, index, index) -> !fir.ref +! CHECK: %[[V_66:[0-9]+]] = fir.array_coor %[[V_4]](%[[V_5]]) %[[V_63]], %[[V_64:[0-9]+]] : (!fir.ref>, !fir.shape<2>, index, index) -> !fir.ref +! CHECK: %[[V_67:[0-9]+]] = fir.load %[[V_65:[0-9]+]] : !fir.ref +! CHECK: fir.store %[[V_67]] to %[[V_66:[0-9]+]] : !fir.ref +! CHECK: %[[V_68:[0-9]+]] = arith.subi %[[V_61]], %[[C_1]] : index +! CHECK: cf.br ^bb16(%[[V_63]], %[[V_68:[0-9]+]] : index, index) +! CHECK: ^bb18: // pred: ^bb16 +! CHECK: %[[V_69:[0-9]+]] = arith.addi %[[V_57]], %[[C_1]] : index +! CHECK: %[[V_70:[0-9]+]] = arith.subi %[[V_58]], %[[C_1]] : index +! CHECK: cf.br ^bb15(%[[V_69]], %[[V_70:[0-9]+]] : index, index) +! CHECK: ^bb19: // pred: ^bb15 +! CHECK: fir.freemem %[[V_24:[0-9]+]] : !fir.heap> +! CHECK: %[[V_73:[0-9]+]] = fir.call @_FortranAioBeginExternalListOutput(%[[C_m1_i32]], %{{.*}}, %{{.*}}) {{.*}}: (i32, !fir.ref, i32) -> !fir.ref +! 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> +! CHECK: %[[V_75:[0-9]+]] = fir.embox %[[V_4]](%[[V_5]]) [%[[V_74]]] : (!fir.ref>, !fir.shape<2>, !fir.slice<2>) -> !fir.box> +! CHECK: %[[V_76:[0-9]+]] = fir.convert %[[V_75:[0-9]+]] : (!fir.box>) -> !fir.box +! CHECK: %[[V_77:[0-9]+]] = fir.call @_FortranAioOutputDescriptor(%[[V_73]], %[[V_76]]) fastmath : (!fir.ref, !fir.box) -> i1 +! CHECK: %[[V_78:[0-9]+]] = fir.load %arg0 : !fir.ref +! CHECK: %[[V_79:[0-9]+]] = arith.subi %[[V_78]], %[[C_1_i32]] : i32 +! CHECK: %[[V_80:[0-9]+]] = fir.convert %[[V_79:[0-9]+]] : (i32) -> index +! CHECK: %[[V_81:[0-9]+]] = fir.convert %[[V_78:[0-9]+]] : (i32) -> index +! 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> +! CHECK: %[[V_83:[0-9]+]] = fir.embox %[[V_4]](%[[V_5]]) [%[[V_82]]] : (!fir.ref>, !fir.shape<2>, !fir.slice<2>) -> !fir.box> +! CHECK: %[[V_84:[0-9]+]] = fir.convert %[[V_83:[0-9]+]] : (!fir.box>) -> !fir.box +! CHECK: %[[V_85:[0-9]+]] = fir.call @_FortranAioOutputDescriptor(%[[V_73]], %[[V_84]]) fastmath : (!fir.ref, !fir.box) -> i1 +! CHECK: %[[V_86:[0-9]+]] = fir.call @_FortranAioEndIoStatement(%[[V_73]]) fastmath : (!fir.ref) -> i32 +! CHECK: return +! CHECK: } ! CHECK-LABEL: func @_QPtt1 subroutine tt1 diff --git a/flang/test/Semantics/boz-literal-constants.f90 b/flang/test/Semantics/boz-literal-constants.f90 --- a/flang/test/Semantics/boz-literal-constants.f90 +++ b/flang/test/Semantics/boz-literal-constants.f90 @@ -51,6 +51,7 @@ res = CMPLX (realpart, img, 4) res = CMPLX (B"0101", B"1111", 4) + !WARNING: underflow on REAL(8) to REAL(4) conversion dbl = DBLE(B"1111") dbl = DBLE(realpart)