67 lines · plain
1! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s2! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s3 4! CHECK-LABEL: popcnt1_test5! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i8>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}6subroutine popcnt1_test(a, b)7 integer(1) :: a8 integer :: b9 10 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i8>11 b = popcnt(a)12 ! CHECK: %[[COUNT:.*]] = math.ctpop %[[AVAL]] : i813 ! CHECK: %[[RESULT:.*]] = fir.convert %[[COUNT]] : (i8) -> i3214 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>15end subroutine popcnt1_test16 17! CHECK-LABEL: popcnt2_test18! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i16>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}19subroutine popcnt2_test(a, b)20 integer(2) :: a21 integer :: b22 23 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i16>24 b = popcnt(a)25 ! CHECK: %[[COUNT:.*]] = math.ctpop %[[AVAL]] : i1626 ! CHECK: %[[RESULT:.*]] = fir.convert %[[COUNT]] : (i16) -> i3227 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>28end subroutine popcnt2_test29 30! CHECK-LABEL: popcnt4_test31! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i32>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}32subroutine popcnt4_test(a, b)33 integer(4) :: a34 integer :: b35 36 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i32>37 b = popcnt(a)38 ! CHECK: %[[RESULT:.*]] = math.ctpop %[[AVAL]] : i3239 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>40end subroutine popcnt4_test41 42! CHECK-LABEL: popcnt8_test43! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i64>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}44subroutine popcnt8_test(a, b)45 integer(8) :: a46 integer :: b47 48 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i64>49 b = popcnt(a)50 ! CHECK: %[[COUNT:.*]] = math.ctpop %[[AVAL]] : i6451 ! CHECK: %[[RESULT:.*]] = fir.convert %[[COUNT]] : (i64) -> i3252 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>53end subroutine popcnt8_test54 55! CHECK-LABEL: popcnt16_test56! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i128>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}57subroutine popcnt16_test(a, b)58 integer(16) :: a59 integer :: b60 61 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i128>62 b = popcnt(a)63 ! CHECK: %[[COUNT:.*]] = math.ctpop %[[AVAL]] : i12864 ! CHECK: %[[RESULT:.*]] = fir.convert %[[COUNT]] : (i128) -> i3265 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>66end subroutine popcnt16_test67