1 // RUN: fir-opt %s --abstract-result-on-func-opt | FileCheck %s
3 // Check that the attributes are shifted along with their corresponding arguments
5 // CHECK-LABEL: func.func @_QMi8Pintrinsic_pack0
6 // CHECK-SAME:(%arg0: !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, %arg1: !fir.box<!fir.array<?x?x?xi32>> {fir.bindc_name = "array"}, %arg2: !fir.ref<!fir.logical<4>> {fir.bindc_name = "mask"}, %arg3: !fir.box<!fir.array<?xi32>> {fir.bindc_name = "vector", fir.optional})
8 func.func @_QMi8Pintrinsic_pack0(%arg0: !fir.box<!fir.array<?x?x?xi32>> {fir.bindc_name = "array"}, %arg1: !fir.ref<!fir.logical<4>> {fir.bindc_name = "mask"}, %arg2: !fir.box<!fir.array<?xi32>> {fir.bindc_name = "vector", fir.optional}) -> !fir.box<!fir.heap<!fir.array<?xi32>>> {
9 %0 = fir.alloca !fir.box<!fir.heap<!fir.array<?xi32>>>
10 %1 = fir.alloca !fir.box<!fir.heap<!fir.array<?xi32>>> {bindc_name = "intrinsic_pack0", uniq_name = "_QMi8Fintrinsic_pack0Eintrinsic_pack0"}
11 %2 = fir.zero_bits !fir.heap<!fir.array<?xi32>>
12 %c0 = arith.constant 0 : index
13 %3 = fir.shape %c0 : (index) -> !fir.shape<1>
14 %4 = fir.embox %2(%3) : (!fir.heap<!fir.array<?xi32>>, !fir.shape<1>) -> !fir.box<!fir.heap<!fir.array<?xi32>>>
15 fir.store %4 to %1 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>
16 %5 = fir.embox %arg1 : (!fir.ref<!fir.logical<4>>) -> !fir.box<!fir.logical<4>>
17 %6 = fir.zero_bits !fir.heap<!fir.array<?xi32>>
18 %7 = fir.embox %6(%3) : (!fir.heap<!fir.array<?xi32>>, !fir.shape<1>) -> !fir.box<!fir.heap<!fir.array<?xi32>>>
19 fir.store %7 to %0 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>
20 %8 = fir.convert %0 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>) -> !fir.ref<!fir.box<none>>
21 %9 = fir.convert %arg0 : (!fir.box<!fir.array<?x?x?xi32>>) -> !fir.box<none>
22 %10 = fir.convert %5 : (!fir.box<!fir.logical<4>>) -> !fir.box<none>
23 %11 = fir.convert %arg2 : (!fir.box<!fir.array<?xi32>>) -> !fir.box<none>
24 %12 = fir.call @_FortranAPack(%8, %9, %10, %11) : (!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.box<none>, !fir.box<none>) -> none
25 %13 = fir.load %1 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>
26 return %13 : !fir.box<!fir.heap<!fir.array<?xi32>>>
28 func.func private @_FortranAPack(!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.box<none>, !fir.box<none>) -> none attributes {fir.runtime}
30 // CHECK-LABEL: func.func private @empty
31 // CHECK-SAME:(!fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, !fir.box<!fir.array<?x?x?xi32>> {fir.bindc_name = "array"}, !fir.ref<!fir.logical<4>> {fir.bindc_name = "mask"}, !fir.box<!fir.array<?xi32>> {fir.bindc_name = "vector", fir.optional})
32 func.func private @empty(%arg0: !fir.box<!fir.array<?x?x?xi32>> {fir.bindc_name = "array"}, %arg1: !fir.ref<!fir.logical<4>> {fir.bindc_name = "mask"}, %arg2: !fir.box<!fir.array<?xi32>> {fir.bindc_name = "vector", fir.optional}) -> !fir.box<!fir.heap<!fir.array<?xi32>>>