1 ! Test lowering of MATMUL intrinsic to HLFIR
2 ! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
4 subroutine matmul1(lhs
, rhs
, res
)
5 integer :: lhs(:,:), rhs(:,:), res(:,:)
8 ! CHECK-LABEL: func.func @_QPmatmul1
9 ! CHECK: %[[LHS:.*]]: !fir.box<!fir.array<?x?xi32>> {fir.bindc_name = "lhs"}
10 ! CHECK: %[[RHS:.*]]: !fir.box<!fir.array<?x?xi32>> {fir.bindc_name = "rhs"}
11 ! CHECK: %[[RES:.*]]: !fir.box<!fir.array<?x?xi32>> {fir.bindc_name = "res"}
12 ! CHECK-DAG: %[[LHS_VAR:.*]]:2 = hlfir.declare %[[LHS]]
13 ! CHECK-DAG: %[[RHS_VAR:.*]]:2 = hlfir.declare %[[RHS]]
14 ! CHECK-DAG: %[[RES_VAR:.*]]:2 = hlfir.declare %[[RES]]
15 ! CHECK-NEXT: %[[EXPR:.*]] = hlfir.matmul %[[LHS_VAR]]#0 %[[RHS_VAR]]#0 {fastmath = #arith.fastmath<contract>} : (!fir.box<!fir.array<?x?xi32>>, !fir.box<!fir.array<?x?xi32>>) -> !hlfir.expr<?x?xi32>
16 ! CHECK-NEXT: hlfir.assign %[[EXPR]] to %[[RES_VAR]]#0 : !hlfir.expr<?x?xi32>, !fir.box<!fir.array<?x?xi32>>
17 ! CHECK-NEXT: hlfir.destroy %[[EXPR]]