1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
2 ! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s
4 ! CHECK-LABEL: poppar1_test
5 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i8>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
6 subroutine poppar1_test(a
, b
)
10 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i8>
12 ! CHECK: %[[COUNT:.*]] = math.ctpop %[[AVAL]] : i8
13 ! CHECK: %[[CONV:.*]] = fir.convert %[[COUNT]] : (i8) -> i32
14 ! CHECK: %[[C1:.*]] = arith.constant 1 : i32
15 ! CHECK: %[[RESULT:.*]] = arith.andi %[[CONV]], %[[C1]] : i32
16 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
17 end subroutine poppar1_test
19 ! CHECK-LABEL: poppar2_test
20 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i16>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
21 subroutine poppar2_test(a
, b
)
25 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i16>
27 ! CHECK: %[[COUNT:.*]] = math.ctpop %[[AVAL]] : i16
28 ! CHECK: %[[CONV:.*]] = fir.convert %[[COUNT]] : (i16) -> i32
29 ! CHECK: %[[C1:.*]] = arith.constant 1 : i32
30 ! CHECK: %[[RESULT:.*]] = arith.andi %[[CONV]], %[[C1]] : i32
31 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
32 end subroutine poppar2_test
34 ! CHECK-LABEL: poppar4_test
35 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i32>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
36 subroutine poppar4_test(a
, b
)
40 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i32>
42 ! CHECK: %[[COUNT:.*]] = math.ctpop %[[AVAL]] : i32
43 ! CHECK: %[[C1:.*]] = arith.constant 1 : i32
44 ! CHECK: %[[RESULT:.*]] = arith.andi %[[COUNT]], %[[C1]] : i32
45 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
46 end subroutine poppar4_test
48 ! CHECK-LABEL: poppar8_test
49 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i64>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
50 subroutine poppar8_test(a
, b
)
54 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i64>
56 ! CHECK: %[[COUNT:.*]] = math.ctpop %[[AVAL]] : i64
57 ! CHECK: %[[CONV:.*]] = fir.convert %[[COUNT]] : (i64) -> i32
58 ! CHECK: %[[C1:.*]] = arith.constant 1 : i32
59 ! CHECK: %[[RESULT:.*]] = arith.andi %[[CONV]], %[[C1]] : i32
60 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
61 end subroutine poppar8_test
63 ! CHECK-LABEL: poppar16_test
64 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i128>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
65 subroutine poppar16_test(a
, b
)
69 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i128>
71 ! CHECK: %[[COUNT:.*]] = math.ctpop %[[AVAL]] : i128
72 ! CHECK: %[[CONV:.*]] = fir.convert %[[COUNT]] : (i128) -> i32
73 ! CHECK: %[[C1:.*]] = arith.constant 1 : i32
74 ! CHECK: %[[RESULT:.*]] = arith.andi %[[CONV]], %[[C1]] : i32
75 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
76 end subroutine poppar16_test