1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
3 ! CHECK-LABEL: len_trim_test
4 integer function len_trim_test(c
)
7 ! CHECK-DAG: %[[c0:.*]] = arith.constant 0 : index
8 ! CHECK-DAG: %[[c1:.*]] = arith.constant 1 : index
9 ! CHECK-DAG: %[[cm1:.*]] = arith.constant -1 : index
10 ! CHECK-DAG: %[[lastChar:.*]] = arith.subi {{.*}}, %[[c1]]
11 ! CHECK: %[[iterateResult:.*]]:2 = fir.iterate_while (%[[index:.*]] = %[[lastChar]] to %[[c0]] step %[[cm1]]) and ({{.*}}) iter_args({{.*}}) {
12 ! CHECK: %[[addr:.*]] = fir.coordinate_of {{.*}}, %[[index]]
13 ! CHECK: %[[codeAddr:.*]] = fir.convert %[[addr]]
14 ! CHECK: %[[code:.*]] = fir.load %[[codeAddr]]
15 ! CHECK: %[[bool:.*]] = arith.cmpi eq
16 ! CHECK: fir.result %[[bool]], %[[index]]
18 ! CHECK: %[[len:.*]] = arith.addi %[[iterateResult]]#1, %[[c1]]
19 ! CHECK: select %[[iterateResult]]#0, %[[c0]], %[[len]]