@@ -6,6 +6,17 @@ module reduce_mod
6
6
integer :: a
7
7
end type
8
8
9
+ abstract interface
10
+ pure function red_int1_interface (a , b )
11
+ integer (1 ), intent (in ) :: a, b
12
+ integer (1 ) :: red_int1_interface
13
+ end function
14
+ pure function red_int1_interface_value (a , b )
15
+ integer (1 ), value, intent (in ) :: a, b
16
+ integer (1 ) :: red_int1_interface_value
17
+ end function
18
+ end interface
19
+
9
20
contains
10
21
11
22
pure function red_int1 (a ,b )
@@ -20,9 +31,13 @@ pure function red_int1_value(a,b)
20
31
red_int1_value = a + b
21
32
end function
22
33
23
- subroutine integer1 (a , id )
34
+ subroutine integer1 (a , id , d1 , d2 )
24
35
integer (1 ), intent (in ) :: a(:)
25
36
integer (1 ) :: res, id
37
+ procedure (red_int1_interface), pointer :: fptr
38
+ procedure (red_int1_interface_value), pointer :: fptr_value
39
+ procedure (red_int1_interface) :: d1
40
+ procedure (red_int1_interface_value) :: d2
26
41
27
42
res = reduce(a, red_int1)
28
43
@@ -33,10 +48,19 @@ subroutine integer1(a, id)
33
48
res = reduce(a, red_int1, [.true. , .true. , .false. ])
34
49
35
50
res = reduce(a, red_int1_value)
51
+
52
+ fptr = > red_int1
53
+ res = reduce(a, fptr)
54
+
55
+ fptr_value = > red_int1_value
56
+ res = reduce(a, fptr_value)
57
+
58
+ ! res = reduce(a, d1)
59
+ ! res = reduce(a, d2)
36
60
end subroutine
37
61
38
62
! CHECK-LABEL: func.func @_QMreduce_modPinteger1(
39
- ! CHECK-SAME: %[[ARG0:.*]]: !fir.box<!fir.array<?xi8>> {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref<i8> {fir.bindc_name = "id"})
63
+ ! CHECK-SAME: %[[ARG0:.*]]: !fir.box<!fir.array<?xi8>> {fir.bindc_name = "a"}, %[[ARG1:.*]]: !fir.ref<i8> {fir.bindc_name = "id"}
40
64
! CHECK: %[[A:.*]]:2 = hlfir.declare %[[ARG0]] dummy_scope %{{.*}} {fortran_attrs = #fir.var_attrs<intent_in>, uniq_name = "_QMreduce_modFinteger1Ea"} : (!fir.box<!fir.array<?xi8>>, !fir.dscope) -> (!fir.box<!fir.array<?xi8>>, !fir.box<!fir.array<?xi8>>)
41
65
! CHECK: %[[ID:.*]]:2 = hlfir.declare %[[ARG1]] dummy_scope %{{.*}} {uniq_name = "_QMreduce_modFinteger1Eid"} : (!fir.ref<i8>, !fir.dscope) -> (!fir.ref<i8>, !fir.ref<i8>)
42
66
! CHECK: %[[ALLOC_RES:.*]] = fir.alloca i8 {bindc_name = "res", uniq_name = "_QMreduce_modFinteger1Eres"}
@@ -64,6 +88,10 @@ subroutine integer1(a, id)
64
88
! CHECK: %[[CONV_MASK:.*]] = fir.convert %[[BOXED_MASK]] : (!fir.box<!fir.array<3x!fir.logical<4>>>) -> !fir.box<none>
65
89
! CHECK: fir.call @_FortranAReduceInteger1Ref(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %[[CONV_MASK]], %{{.*}}, %false{{.*}})
66
90
! CHECK: fir.call @_FortranAReduceInteger1Value
91
+ ! CHECK: fir.call @_FortranAReduceInteger1Ref
92
+ ! CHECK: fir.call @_FortranAReduceInteger1Value
93
+ ! TODO fir.call @_FortranAReduceInteger1Ref
94
+ ! TODO fir.call @_FortranAReduceInteger1Value
67
95
68
96
pure function red_int2 (a ,b )
69
97
integer (2 ), intent (in ) :: a, b
0 commit comments