1! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s 2 3! Test character scalar concatenation lowering 4 5! CHECK-LABEL: concat_1 6subroutine concat_1(a, b) 7 ! CHECK-DAG: %[[a:.*]]:2 = fir.unboxchar %arg0 8 ! CHECK-DAG: %[[b:.*]]:2 = fir.unboxchar %arg1 9 character(*) :: a, b 10 11 ! CHECK: call @{{.*}}BeginExternalListOutput 12 print *, a // b 13 ! Concatenation 14 15 ! CHECK: %[[len:.*]] = arith.addi %[[a]]#1, %[[b]]#1 16 ! CHECK: %[[temp:.*]] = fir.alloca !fir.char<1,?>(%[[len]] : index) 17 18 ! CHECK-DAG: %[[c1:.*]] = arith.constant 1 19 ! CHECK-DAG: %[[a2:.*]] = fir.convert %[[a]]#1 20 ! CHECK: %[[count:.*]] = arith.muli %[[c1]], %[[a2]] 21 ! CHECK-DAG: constant false 22 ! CHECK-DAG: %[[to:.*]] = fir.convert %[[temp]] : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8> 23 ! CHECK-DAG: %[[from:.*]] = fir.convert %[[a]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8> 24 ! CHECK: fir.call @llvm.memmove.p0.p0.i64(%[[to]], %[[from]], %[[count]], %false) {{.*}}: (!fir.ref<i8>, !fir.ref<i8>, i64, i1) -> () 25 26 ! CHECK: %[[c1_0:.*]] = arith.constant 1 27 ! CHECK: %[[count2:.*]] = arith.subi %[[len]], %[[c1_0]] 28 ! CHECK: fir.do_loop %[[index2:.*]] = %[[a]]#1 to %[[count2]] step %[[c1_0]] { 29 ! CHECK: %[[b_index:.*]] = arith.subi %[[index2]], %[[a]]#1 30 ! CHECK: %[[b_cast:.*]] = fir.convert %[[b]]#0 31 ! CHECK: %[[b_addr:.*]] = fir.coordinate_of %[[b_cast]], %[[b_index]] 32 ! CHECK-DAG: %[[b_elt:.*]] = fir.load %[[b_addr]] 33 ! CHECK: %[[temp_cast2:.*]] = fir.convert %[[temp]] 34 ! CHECK: %[[temp_addr2:.*]] = fir.coordinate_of %[[temp_cast2]], %[[index2]] 35 ! CHECK: fir.store %[[b_elt]] to %[[temp_addr2]] 36 ! CHECK: } 37 38 ! IO runtime call 39 ! CHECK-DAG: %[[raddr:.*]] = fir.convert %[[temp]] 40 ! CHECK-DAG: %[[rlen:.*]] = fir.convert %[[len]] 41 ! CHECK: call @{{.*}}OutputAscii(%{{.*}}, %[[raddr]], %[[rlen]]) 42end subroutine 43