[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Lower / Intrinsics / poppar.f90
blob7141829bb0e60a8d64e9b61704337a8085040695
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)
7 integer(1) :: a
8 integer :: b
10 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i8>
11 b = poppar(a)
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)
22 integer(2) :: a
23 integer :: b
25 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i16>
26 b = poppar(a)
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)
37 integer(4) :: a
38 integer :: b
40 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i32>
41 b = poppar(a)
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)
51 integer(8) :: a
52 integer :: b
54 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i64>
55 b = poppar(a)
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)
66 integer(16) :: a
67 integer :: b
69 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i128>
70 b = poppar(a)
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