[RISCV] Add MIPS P8700 processor (#119882)
[llvm-project.git] / flang / test / Lower / Intrinsics / any.f90
blob1ea22d9706744f79b38805d26381ea2fc7cf3d89
1 ! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
3 ! CHECK-LABEL: any_test
4 ! CHECK-SAME: %[[arg0:.*]]: !fir.box<!fir.array<?x!fir.logical<4>>>{{.*}}) -> !fir.logical<4>
5 logical function any_test(mask)
6 logical :: mask(:)
7 ! CHECK: %[[c1:.*]] = arith.constant 1 : index
8 ! CHECK: %[[a1:.*]] = fir.convert %[[arg0]] : (!fir.box<!fir.array<?x!fir.logical<4>>>) -> !fir.box<none>
9 ! CHECK: %[[a2:.*]] = fir.convert %[[c1]] : (index) -> i32
10 any_test = any(mask)
11 ! CHECK: %[[a3:.*]] = fir.call @_FortranAAny(%[[a1]], %{{.*}}, %{{.*}}, %[[a2]]) {{.*}}: (!fir.box<none>, !fir.ref<i8>, i32, i32) -> i1
12 end function any_test
14 ! CHECK-LABEL: any_test2
15 ! CHECK-SAME: %[[arg0:.*]]: !fir.box<!fir.array<?x?x!fir.logical<4>>>
16 ! CHECK-SAME: %[[arg1:.*]]: !fir.ref<i32>
17 ! CHECK-SAME: %[[arg2:.*]]: !fir.box<!fir.array<?x!fir.logical<4>>>
18 subroutine any_test2(mask, d, rslt)
19 logical :: mask(:,:)
20 integer :: d
21 logical :: rslt(:)
22 ! CHECK-DAG: %[[a0:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x!fir.logical<4>>>>
23 ! CHECK-DAG: %[[a1:.*]] = fir.load %[[arg1:.*]] : !fir.ref<i32>
24 ! CHECK-DAG: %[[a6:.*]] = fir.convert %[[a0:.*]] : (!fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.logical<4>>>>>) -> !fir.ref<!fir.box<none>>
25 ! CHECK-DAG: %[[a7:.*]] = fir.convert %[[arg0:.*]]: (!fir.box<!fir.array<?x?x!fir.logical<4>>>) -> !fir.box<none>
26 rslt = any(mask, d)
27 ! CHECK: %[[r1:.*]] = fir.call @_FortranAAnyDim(%[[a6:.*]], %[[a7:.*]], %[[a1:.*]], %{{.*}}, %{{.*}}) {{.*}}: (!fir.ref<!fir.box<none>>, !fir.box<none>, i32, !fir.ref<i8>, i32) -> none
28 ! CHECK-DAG: %[[a10:.*]] = fir.load %[[a0:.*]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.logical<4>>>>>
29 ! CHECK-DAG: %[[a12:.*]] = fir.box_addr %[[a10:.*]] : (!fir.box<!fir.heap<!fir.array<?x!fir.logical<4>>>>) -> !fir.heap<!fir.array<?x!fir.logical<4>>>
30 ! CHECK-DAG fir.freemem %[[a12:.*]]
31 end subroutine