1 ! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
2 ! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
4 ! CHECK-LABEL: popcnt1_test
5 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i8>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
6 subroutine popcnt1_test(a
, b
)
10 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i8>
12 ! CHECK: %[[COUNT:.*]] = math.ctpop %[[AVAL]] : i8
13 ! CHECK: %[[RESULT:.*]] = fir.convert %[[COUNT]] : (i8) -> i32
14 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
15 end subroutine popcnt1_test
17 ! CHECK-LABEL: popcnt2_test
18 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i16>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
19 subroutine popcnt2_test(a
, b
)
23 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i16>
25 ! CHECK: %[[COUNT:.*]] = math.ctpop %[[AVAL]] : i16
26 ! CHECK: %[[RESULT:.*]] = fir.convert %[[COUNT]] : (i16) -> i32
27 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
28 end subroutine popcnt2_test
30 ! CHECK-LABEL: popcnt4_test
31 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i32>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
32 subroutine popcnt4_test(a
, b
)
36 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i32>
38 ! CHECK: %[[RESULT:.*]] = math.ctpop %[[AVAL]] : i32
39 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
40 end subroutine popcnt4_test
42 ! CHECK-LABEL: popcnt8_test
43 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i64>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
44 subroutine popcnt8_test(a
, b
)
48 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i64>
50 ! CHECK: %[[COUNT:.*]] = math.ctpop %[[AVAL]] : i64
51 ! CHECK: %[[RESULT:.*]] = fir.convert %[[COUNT]] : (i64) -> i32
52 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
53 end subroutine popcnt8_test
55 ! CHECK-LABEL: popcnt16_test
56 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i128>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
57 subroutine popcnt16_test(a
, b
)
61 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i128>
63 ! CHECK: %[[COUNT:.*]] = math.ctpop %[[AVAL]] : i128
64 ! CHECK: %[[RESULT:.*]] = fir.convert %[[COUNT]] : (i128) -> i32
65 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
66 end subroutine popcnt16_test