[Transforms] Silence a warning in SROA.cpp (NFC)
[llvm-project.git] / flang / test / Lower / Intrinsics / len_trim.f90
blobe3483331ab5ab335853936e5a40f930ee0e2a784
1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
3 ! CHECK-LABEL: len_trim_test
4 integer function len_trim_test(c)
5 character(*) :: c
6 ltrim = len_trim(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]]
17 ! CHECK: }
18 ! CHECK: %[[len:.*]] = arith.addi %[[iterateResult]]#1, %[[c1]]
19 ! CHECK: select %[[iterateResult]]#0, %[[c0]], %[[len]]
20 end function
22 ! CHECK-LABEL: lnblnk_test
23 integer function lnblnk_test(c)
24 character(*) :: c
25 ltrim = lnblnk(c)
26 ! CHECK-DAG: %[[c0:.*]] = arith.constant 0 : index
27 ! CHECK-DAG: %[[c1:.*]] = arith.constant 1 : index
28 ! CHECK-DAG: %[[cm1:.*]] = arith.constant -1 : index
29 ! CHECK-DAG: %[[lastChar:.*]] = arith.subi {{.*}}, %[[c1]]
30 ! CHECK: %[[iterateResult:.*]]:2 = fir.iterate_while (%[[index:.*]] = %[[lastChar]] to %[[c0]] step %[[cm1]]) and ({{.*}}) iter_args({{.*}}) {
31 ! CHECK: %[[addr:.*]] = fir.coordinate_of {{.*}}, %[[index]]
32 ! CHECK: %[[codeAddr:.*]] = fir.convert %[[addr]]
33 ! CHECK: %[[code:.*]] = fir.load %[[codeAddr]]
34 ! CHECK: %[[bool:.*]] = arith.cmpi eq
35 ! CHECK: fir.result %[[bool]], %[[index]]
36 ! CHECK: }
37 ! CHECK: %[[len:.*]] = arith.addi %[[iterateResult]]#1, %[[c1]]
38 ! CHECK: select %[[iterateResult]]#0, %[[c0]], %[[len]]
39 end function