1 ; RUN: llc < %s -mtriple=ve -mattr=+vpu | FileCheck %s
3 ;;; Test vector population count intrinsic instructions
6 ;;; We test VPCNT*vl, VPCNT*vl_v, VPCNT*vml_v, PVPCNT*vl, PVPCNT*vl_v, PVPCNT*vml_v instructions.
8 ; Function Attrs: nounwind readnone
9 define fastcc <256 x double> @vpcnt_vvl(<256 x double> %0) {
10 ; CHECK-LABEL: vpcnt_vvl:
12 ; CHECK-NEXT: lea %s0, 256
14 ; CHECK-NEXT: vpcnt %v0, %v0
15 ; CHECK-NEXT: b.l.t (, %s10)
16 %2 = tail call fast <256 x double> @llvm.ve.vl.vpcnt.vvl(<256 x double> %0, i32 256)
20 ; Function Attrs: nounwind readnone
21 declare <256 x double> @llvm.ve.vl.vpcnt.vvl(<256 x double>, i32)
23 ; Function Attrs: nounwind readnone
24 define fastcc <256 x double> @vpcnt_vvvl(<256 x double> %0, <256 x double> %1) {
25 ; CHECK-LABEL: vpcnt_vvvl:
27 ; CHECK-NEXT: lea %s0, 128
29 ; CHECK-NEXT: vpcnt %v1, %v0
30 ; CHECK-NEXT: lea %s16, 256
31 ; CHECK-NEXT: lvl %s16
32 ; CHECK-NEXT: vor %v0, (0)1, %v1
33 ; CHECK-NEXT: b.l.t (, %s10)
34 %3 = tail call fast <256 x double> @llvm.ve.vl.vpcnt.vvvl(<256 x double> %0, <256 x double> %1, i32 128)
38 ; Function Attrs: nounwind readnone
39 declare <256 x double> @llvm.ve.vl.vpcnt.vvvl(<256 x double>, <256 x double>, i32)
41 ; Function Attrs: nounwind readnone
42 define fastcc <256 x double> @vpcnt_vvmvl(<256 x double> %0, <256 x i1> %1, <256 x double> %2) {
43 ; CHECK-LABEL: vpcnt_vvmvl:
45 ; CHECK-NEXT: lea %s0, 128
47 ; CHECK-NEXT: vpcnt %v1, %v0, %vm1
48 ; CHECK-NEXT: lea %s16, 256
49 ; CHECK-NEXT: lvl %s16
50 ; CHECK-NEXT: vor %v0, (0)1, %v1
51 ; CHECK-NEXT: b.l.t (, %s10)
52 %4 = tail call fast <256 x double> @llvm.ve.vl.vpcnt.vvmvl(<256 x double> %0, <256 x i1> %1, <256 x double> %2, i32 128)
56 ; Function Attrs: nounwind readnone
57 declare <256 x double> @llvm.ve.vl.vpcnt.vvmvl(<256 x double>, <256 x i1>, <256 x double>, i32)
59 ; Function Attrs: nounwind readnone
60 define fastcc <256 x double> @pvpcntlo_vvl(<256 x double> %0) {
61 ; CHECK-LABEL: pvpcntlo_vvl:
63 ; CHECK-NEXT: lea %s0, 256
65 ; CHECK-NEXT: pvpcnt.lo %v0, %v0
66 ; CHECK-NEXT: b.l.t (, %s10)
67 %2 = tail call fast <256 x double> @llvm.ve.vl.pvpcntlo.vvl(<256 x double> %0, i32 256)
71 ; Function Attrs: nounwind readnone
72 declare <256 x double> @llvm.ve.vl.pvpcntlo.vvl(<256 x double>, i32)
74 ; Function Attrs: nounwind readnone
75 define fastcc <256 x double> @pvpcntlo_vvvl(<256 x double> %0, <256 x double> %1) {
76 ; CHECK-LABEL: pvpcntlo_vvvl:
78 ; CHECK-NEXT: lea %s0, 128
80 ; CHECK-NEXT: pvpcnt.lo %v1, %v0
81 ; CHECK-NEXT: lea %s16, 256
82 ; CHECK-NEXT: lvl %s16
83 ; CHECK-NEXT: vor %v0, (0)1, %v1
84 ; CHECK-NEXT: b.l.t (, %s10)
85 %3 = tail call fast <256 x double> @llvm.ve.vl.pvpcntlo.vvvl(<256 x double> %0, <256 x double> %1, i32 128)
89 ; Function Attrs: nounwind readnone
90 declare <256 x double> @llvm.ve.vl.pvpcntlo.vvvl(<256 x double>, <256 x double>, i32)
92 ; Function Attrs: nounwind readnone
93 define fastcc <256 x double> @pvpcntlo_vvmvl(<256 x double> %0, <256 x i1> %1, <256 x double> %2) {
94 ; CHECK-LABEL: pvpcntlo_vvmvl:
96 ; CHECK-NEXT: lea %s0, 128
98 ; CHECK-NEXT: pvpcnt.lo %v1, %v0, %vm1
99 ; CHECK-NEXT: lea %s16, 256
100 ; CHECK-NEXT: lvl %s16
101 ; CHECK-NEXT: vor %v0, (0)1, %v1
102 ; CHECK-NEXT: b.l.t (, %s10)
103 %4 = tail call fast <256 x double> @llvm.ve.vl.pvpcntlo.vvmvl(<256 x double> %0, <256 x i1> %1, <256 x double> %2, i32 128)
104 ret <256 x double> %4
107 ; Function Attrs: nounwind readnone
108 declare <256 x double> @llvm.ve.vl.pvpcntlo.vvmvl(<256 x double>, <256 x i1>, <256 x double>, i32)
110 ; Function Attrs: nounwind readnone
111 define fastcc <256 x double> @pvpcntup_vvl(<256 x double> %0) {
112 ; CHECK-LABEL: pvpcntup_vvl:
114 ; CHECK-NEXT: lea %s0, 256
115 ; CHECK-NEXT: lvl %s0
116 ; CHECK-NEXT: pvpcnt.up %v0, %v0
117 ; CHECK-NEXT: b.l.t (, %s10)
118 %2 = tail call fast <256 x double> @llvm.ve.vl.pvpcntup.vvl(<256 x double> %0, i32 256)
119 ret <256 x double> %2
122 ; Function Attrs: nounwind readnone
123 declare <256 x double> @llvm.ve.vl.pvpcntup.vvl(<256 x double>, i32)
125 ; Function Attrs: nounwind readnone
126 define fastcc <256 x double> @pvpcntup_vvvl(<256 x double> %0, <256 x double> %1) {
127 ; CHECK-LABEL: pvpcntup_vvvl:
129 ; CHECK-NEXT: lea %s0, 128
130 ; CHECK-NEXT: lvl %s0
131 ; CHECK-NEXT: pvpcnt.up %v1, %v0
132 ; CHECK-NEXT: lea %s16, 256
133 ; CHECK-NEXT: lvl %s16
134 ; CHECK-NEXT: vor %v0, (0)1, %v1
135 ; CHECK-NEXT: b.l.t (, %s10)
136 %3 = tail call fast <256 x double> @llvm.ve.vl.pvpcntup.vvvl(<256 x double> %0, <256 x double> %1, i32 128)
137 ret <256 x double> %3
140 ; Function Attrs: nounwind readnone
141 declare <256 x double> @llvm.ve.vl.pvpcntup.vvvl(<256 x double>, <256 x double>, i32)
143 ; Function Attrs: nounwind readnone
144 define fastcc <256 x double> @pvpcntup_vvmvl(<256 x double> %0, <256 x i1> %1, <256 x double> %2) {
145 ; CHECK-LABEL: pvpcntup_vvmvl:
147 ; CHECK-NEXT: lea %s0, 128
148 ; CHECK-NEXT: lvl %s0
149 ; CHECK-NEXT: pvpcnt.up %v1, %v0, %vm1
150 ; CHECK-NEXT: lea %s16, 256
151 ; CHECK-NEXT: lvl %s16
152 ; CHECK-NEXT: vor %v0, (0)1, %v1
153 ; CHECK-NEXT: b.l.t (, %s10)
154 %4 = tail call fast <256 x double> @llvm.ve.vl.pvpcntup.vvmvl(<256 x double> %0, <256 x i1> %1, <256 x double> %2, i32 128)
155 ret <256 x double> %4
158 ; Function Attrs: nounwind readnone
159 declare <256 x double> @llvm.ve.vl.pvpcntup.vvmvl(<256 x double>, <256 x i1>, <256 x double>, i32)
161 ; Function Attrs: nounwind readnone
162 define fastcc <256 x double> @pvpcnt_vvl(<256 x double> %0) {
163 ; CHECK-LABEL: pvpcnt_vvl:
165 ; CHECK-NEXT: lea %s0, 256
166 ; CHECK-NEXT: lvl %s0
167 ; CHECK-NEXT: pvpcnt %v0, %v0
168 ; CHECK-NEXT: b.l.t (, %s10)
169 %2 = tail call fast <256 x double> @llvm.ve.vl.pvpcnt.vvl(<256 x double> %0, i32 256)
170 ret <256 x double> %2
173 ; Function Attrs: nounwind readnone
174 declare <256 x double> @llvm.ve.vl.pvpcnt.vvl(<256 x double>, i32)
176 ; Function Attrs: nounwind readnone
177 define fastcc <256 x double> @pvpcnt_vvvl(<256 x double> %0, <256 x double> %1) {
178 ; CHECK-LABEL: pvpcnt_vvvl:
180 ; CHECK-NEXT: lea %s0, 128
181 ; CHECK-NEXT: lvl %s0
182 ; CHECK-NEXT: pvpcnt %v1, %v0
183 ; CHECK-NEXT: lea %s16, 256
184 ; CHECK-NEXT: lvl %s16
185 ; CHECK-NEXT: vor %v0, (0)1, %v1
186 ; CHECK-NEXT: b.l.t (, %s10)
187 %3 = tail call fast <256 x double> @llvm.ve.vl.pvpcnt.vvvl(<256 x double> %0, <256 x double> %1, i32 128)
188 ret <256 x double> %3
191 ; Function Attrs: nounwind readnone
192 declare <256 x double> @llvm.ve.vl.pvpcnt.vvvl(<256 x double>, <256 x double>, i32)
194 ; Function Attrs: nounwind readnone
195 define fastcc <256 x double> @pvpcnt_vvMvl(<256 x double> %0, <512 x i1> %1, <256 x double> %2) {
196 ; CHECK-LABEL: pvpcnt_vvMvl:
198 ; CHECK-NEXT: lea %s0, 128
199 ; CHECK-NEXT: lvl %s0
200 ; CHECK-NEXT: pvpcnt %v1, %v0, %vm2
201 ; CHECK-NEXT: lea %s16, 256
202 ; CHECK-NEXT: lvl %s16
203 ; CHECK-NEXT: vor %v0, (0)1, %v1
204 ; CHECK-NEXT: b.l.t (, %s10)
205 %4 = tail call fast <256 x double> @llvm.ve.vl.pvpcnt.vvMvl(<256 x double> %0, <512 x i1> %1, <256 x double> %2, i32 128)
206 ret <256 x double> %4
209 ; Function Attrs: nounwind readnone
210 declare <256 x double> @llvm.ve.vl.pvpcnt.vvMvl(<256 x double>, <512 x i1>, <256 x double>, i32)