1 ! RUN: bbc -emit-fir %s -opt-transpose=false -o - | FileCheck %s
2 ! RUN: %flang_fc1 -emit-fir -O0 %s -o - | FileCheck %s
4 ! CHECK-LABEL: func @_QPtranspose_test(
5 ! CHECK-SAME: %[[source:.*]]: !fir.ref<!fir.array<2x3xf32>>{{.*}}) {
6 subroutine transpose_test(mat
)
7 ! CHECK: %[[resultDescr:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x?xf32>>>
9 call bar_transpose_test(transpose(mat
))
10 ! CHECK: %[[sourceBox:.*]] = fir.embox %[[source]]({{.*}}) : (!fir.ref<!fir.array<2x3xf32>>, !fir.shape<2>) -> !fir.box<!fir.array<2x3xf32>>
11 ! CHECK: %[[zeroArray:.*]] = fir.zero_bits !fir.heap<!fir.array<?x?xf32>
12 ! CHECK: %[[c0:.*]] = arith.constant 0 : index
13 ! CHECK: %[[shapeResult:.*]] = fir.shape %[[c0]], %[[c0]] : (index, index) -> !fir.shape<2>
14 ! CHECK: %[[resultBox:.*]] = fir.embox %[[zeroArray]](%[[shapeResult]]) : (!fir.heap<!fir.array<?x?xf32>>, !fir.shape<2>) -> !fir.box<!fir.heap<!fir.array<?x?xf32>>>
15 ! CHECK: fir.store %[[resultBox]] to %[[resultDescr]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>
16 ! CHECK: %[[resultOpaque:.*]] = fir.convert %[[resultDescr]] : (!fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>) -> !fir.ref<!fir.box<none>>
17 ! CHECK: %[[sourceOpaque:.*]] = fir.convert %[[sourceBox]] : (!fir.box<!fir.array<2x3xf32>>) -> !fir.box<none>
18 ! CHECK: %{{.*}} = fir.call @_FortranATranspose(%[[resultOpaque]], %[[sourceOpaque]], %{{.*}}, %{{.*}}) {{.*}}: (!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.ref<i8>, i32) -> none
19 ! CHECK: %[[tmp1:.*]] = fir.load %[[resultDescr]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>
20 ! CHECK: %[[tmp2:.*]] = fir.box_addr %[[tmp1]] : (!fir.box<!fir.heap<!fir.array<?x?xf32>>>) -> !fir.heap<!fir.array<?x?xf32>>
21 ! CHECK: %[[tmp3:.*]] = fir.convert %[[tmp2]] : (!fir.heap<!fir.array<?x?xf32>>) -> !fir.ref<!fir.array<3x2xf32>>
22 ! CHECK: fir.call @_QPbar_transpose_test(%[[tmp3]]) {{.*}}: (!fir.ref<!fir.array<3x2xf32>>) -> ()
23 ! CHECK: fir.freemem %[[tmp2]] : !fir.heap<!fir.array<?x?xf32>