1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfh,+v,+m -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV32
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v,+m -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV64
6 ; RUN: llc -mtriple=riscv32 -mattr=+v,+zvbb,+m -target-abi=ilp32d \
7 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK-ZVBB
8 ; RUN: llc -mtriple=riscv64 -mattr=+v,+zvbb,+m -target-abi=lp64d \
9 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK-ZVBB
11 declare <vscale x 1 x i8> @llvm.vp.cttz.nxv1i8(<vscale x 1 x i8>, i1 immarg, <vscale x 1 x i1>, i32)
13 define <vscale x 1 x i8> @vp_cttz_nxv1i8(<vscale x 1 x i8> %va, <vscale x 1 x i1> %m, i32 zeroext %evl) {
14 ; CHECK-LABEL: vp_cttz_nxv1i8:
16 ; CHECK-NEXT: li a1, 1
17 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
18 ; CHECK-NEXT: vsub.vx v9, v8, a1, v0.t
19 ; CHECK-NEXT: vnot.v v8, v8, v0.t
20 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
21 ; CHECK-NEXT: vsrl.vi v9, v8, 1, v0.t
22 ; CHECK-NEXT: li a0, 85
23 ; CHECK-NEXT: vand.vx v9, v9, a0, v0.t
24 ; CHECK-NEXT: vsub.vv v8, v8, v9, v0.t
25 ; CHECK-NEXT: li a0, 51
26 ; CHECK-NEXT: vand.vx v9, v8, a0, v0.t
27 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
28 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
29 ; CHECK-NEXT: vadd.vv v8, v9, v8, v0.t
30 ; CHECK-NEXT: vsrl.vi v9, v8, 4, v0.t
31 ; CHECK-NEXT: vadd.vv v8, v8, v9, v0.t
32 ; CHECK-NEXT: vand.vi v8, v8, 15, v0.t
35 ; CHECK-ZVBB-LABEL: vp_cttz_nxv1i8:
36 ; CHECK-ZVBB: # %bb.0:
37 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
38 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
39 ; CHECK-ZVBB-NEXT: ret
40 %v = call <vscale x 1 x i8> @llvm.vp.cttz.nxv1i8(<vscale x 1 x i8> %va, i1 false, <vscale x 1 x i1> %m, i32 %evl)
41 ret <vscale x 1 x i8> %v
44 define <vscale x 1 x i8> @vp_cttz_nxv1i8_unmasked(<vscale x 1 x i8> %va, i32 zeroext %evl) {
45 ; CHECK-LABEL: vp_cttz_nxv1i8_unmasked:
47 ; CHECK-NEXT: li a1, 1
48 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
49 ; CHECK-NEXT: vsub.vx v9, v8, a1
50 ; CHECK-NEXT: vnot.v v8, v8
51 ; CHECK-NEXT: vand.vv v8, v8, v9
52 ; CHECK-NEXT: vsrl.vi v9, v8, 1
53 ; CHECK-NEXT: li a0, 85
54 ; CHECK-NEXT: vand.vx v9, v9, a0
55 ; CHECK-NEXT: vsub.vv v8, v8, v9
56 ; CHECK-NEXT: li a0, 51
57 ; CHECK-NEXT: vand.vx v9, v8, a0
58 ; CHECK-NEXT: vsrl.vi v8, v8, 2
59 ; CHECK-NEXT: vand.vx v8, v8, a0
60 ; CHECK-NEXT: vadd.vv v8, v9, v8
61 ; CHECK-NEXT: vsrl.vi v9, v8, 4
62 ; CHECK-NEXT: vadd.vv v8, v8, v9
63 ; CHECK-NEXT: vand.vi v8, v8, 15
66 ; CHECK-ZVBB-LABEL: vp_cttz_nxv1i8_unmasked:
67 ; CHECK-ZVBB: # %bb.0:
68 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
69 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
70 ; CHECK-ZVBB-NEXT: ret
71 %v = call <vscale x 1 x i8> @llvm.vp.cttz.nxv1i8(<vscale x 1 x i8> %va, i1 false, <vscale x 1 x i1> splat (i1 true), i32 %evl)
72 ret <vscale x 1 x i8> %v
75 declare <vscale x 2 x i8> @llvm.vp.cttz.nxv2i8(<vscale x 2 x i8>, i1 immarg, <vscale x 2 x i1>, i32)
77 define <vscale x 2 x i8> @vp_cttz_nxv2i8(<vscale x 2 x i8> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
78 ; CHECK-LABEL: vp_cttz_nxv2i8:
80 ; CHECK-NEXT: li a1, 1
81 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
82 ; CHECK-NEXT: vsub.vx v9, v8, a1, v0.t
83 ; CHECK-NEXT: vnot.v v8, v8, v0.t
84 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
85 ; CHECK-NEXT: vsrl.vi v9, v8, 1, v0.t
86 ; CHECK-NEXT: li a0, 85
87 ; CHECK-NEXT: vand.vx v9, v9, a0, v0.t
88 ; CHECK-NEXT: vsub.vv v8, v8, v9, v0.t
89 ; CHECK-NEXT: li a0, 51
90 ; CHECK-NEXT: vand.vx v9, v8, a0, v0.t
91 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
92 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
93 ; CHECK-NEXT: vadd.vv v8, v9, v8, v0.t
94 ; CHECK-NEXT: vsrl.vi v9, v8, 4, v0.t
95 ; CHECK-NEXT: vadd.vv v8, v8, v9, v0.t
96 ; CHECK-NEXT: vand.vi v8, v8, 15, v0.t
99 ; CHECK-ZVBB-LABEL: vp_cttz_nxv2i8:
100 ; CHECK-ZVBB: # %bb.0:
101 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
102 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
103 ; CHECK-ZVBB-NEXT: ret
104 %v = call <vscale x 2 x i8> @llvm.vp.cttz.nxv2i8(<vscale x 2 x i8> %va, i1 false, <vscale x 2 x i1> %m, i32 %evl)
105 ret <vscale x 2 x i8> %v
108 define <vscale x 2 x i8> @vp_cttz_nxv2i8_unmasked(<vscale x 2 x i8> %va, i32 zeroext %evl) {
109 ; CHECK-LABEL: vp_cttz_nxv2i8_unmasked:
111 ; CHECK-NEXT: li a1, 1
112 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
113 ; CHECK-NEXT: vsub.vx v9, v8, a1
114 ; CHECK-NEXT: vnot.v v8, v8
115 ; CHECK-NEXT: vand.vv v8, v8, v9
116 ; CHECK-NEXT: vsrl.vi v9, v8, 1
117 ; CHECK-NEXT: li a0, 85
118 ; CHECK-NEXT: vand.vx v9, v9, a0
119 ; CHECK-NEXT: vsub.vv v8, v8, v9
120 ; CHECK-NEXT: li a0, 51
121 ; CHECK-NEXT: vand.vx v9, v8, a0
122 ; CHECK-NEXT: vsrl.vi v8, v8, 2
123 ; CHECK-NEXT: vand.vx v8, v8, a0
124 ; CHECK-NEXT: vadd.vv v8, v9, v8
125 ; CHECK-NEXT: vsrl.vi v9, v8, 4
126 ; CHECK-NEXT: vadd.vv v8, v8, v9
127 ; CHECK-NEXT: vand.vi v8, v8, 15
130 ; CHECK-ZVBB-LABEL: vp_cttz_nxv2i8_unmasked:
131 ; CHECK-ZVBB: # %bb.0:
132 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
133 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
134 ; CHECK-ZVBB-NEXT: ret
135 %v = call <vscale x 2 x i8> @llvm.vp.cttz.nxv2i8(<vscale x 2 x i8> %va, i1 false, <vscale x 2 x i1> splat (i1 true), i32 %evl)
136 ret <vscale x 2 x i8> %v
139 declare <vscale x 4 x i8> @llvm.vp.cttz.nxv4i8(<vscale x 4 x i8>, i1 immarg, <vscale x 4 x i1>, i32)
141 define <vscale x 4 x i8> @vp_cttz_nxv4i8(<vscale x 4 x i8> %va, <vscale x 4 x i1> %m, i32 zeroext %evl) {
142 ; CHECK-LABEL: vp_cttz_nxv4i8:
144 ; CHECK-NEXT: li a1, 1
145 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
146 ; CHECK-NEXT: vsub.vx v9, v8, a1, v0.t
147 ; CHECK-NEXT: vnot.v v8, v8, v0.t
148 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
149 ; CHECK-NEXT: vsrl.vi v9, v8, 1, v0.t
150 ; CHECK-NEXT: li a0, 85
151 ; CHECK-NEXT: vand.vx v9, v9, a0, v0.t
152 ; CHECK-NEXT: vsub.vv v8, v8, v9, v0.t
153 ; CHECK-NEXT: li a0, 51
154 ; CHECK-NEXT: vand.vx v9, v8, a0, v0.t
155 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
156 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
157 ; CHECK-NEXT: vadd.vv v8, v9, v8, v0.t
158 ; CHECK-NEXT: vsrl.vi v9, v8, 4, v0.t
159 ; CHECK-NEXT: vadd.vv v8, v8, v9, v0.t
160 ; CHECK-NEXT: vand.vi v8, v8, 15, v0.t
163 ; CHECK-ZVBB-LABEL: vp_cttz_nxv4i8:
164 ; CHECK-ZVBB: # %bb.0:
165 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
166 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
167 ; CHECK-ZVBB-NEXT: ret
168 %v = call <vscale x 4 x i8> @llvm.vp.cttz.nxv4i8(<vscale x 4 x i8> %va, i1 false, <vscale x 4 x i1> %m, i32 %evl)
169 ret <vscale x 4 x i8> %v
172 define <vscale x 4 x i8> @vp_cttz_nxv4i8_unmasked(<vscale x 4 x i8> %va, i32 zeroext %evl) {
173 ; CHECK-LABEL: vp_cttz_nxv4i8_unmasked:
175 ; CHECK-NEXT: li a1, 1
176 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
177 ; CHECK-NEXT: vsub.vx v9, v8, a1
178 ; CHECK-NEXT: vnot.v v8, v8
179 ; CHECK-NEXT: vand.vv v8, v8, v9
180 ; CHECK-NEXT: vsrl.vi v9, v8, 1
181 ; CHECK-NEXT: li a0, 85
182 ; CHECK-NEXT: vand.vx v9, v9, a0
183 ; CHECK-NEXT: vsub.vv v8, v8, v9
184 ; CHECK-NEXT: li a0, 51
185 ; CHECK-NEXT: vand.vx v9, v8, a0
186 ; CHECK-NEXT: vsrl.vi v8, v8, 2
187 ; CHECK-NEXT: vand.vx v8, v8, a0
188 ; CHECK-NEXT: vadd.vv v8, v9, v8
189 ; CHECK-NEXT: vsrl.vi v9, v8, 4
190 ; CHECK-NEXT: vadd.vv v8, v8, v9
191 ; CHECK-NEXT: vand.vi v8, v8, 15
194 ; CHECK-ZVBB-LABEL: vp_cttz_nxv4i8_unmasked:
195 ; CHECK-ZVBB: # %bb.0:
196 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
197 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
198 ; CHECK-ZVBB-NEXT: ret
199 %v = call <vscale x 4 x i8> @llvm.vp.cttz.nxv4i8(<vscale x 4 x i8> %va, i1 false, <vscale x 4 x i1> splat (i1 true), i32 %evl)
200 ret <vscale x 4 x i8> %v
203 declare <vscale x 8 x i8> @llvm.vp.cttz.nxv8i8(<vscale x 8 x i8>, i1 immarg, <vscale x 8 x i1>, i32)
205 define <vscale x 8 x i8> @vp_cttz_nxv8i8(<vscale x 8 x i8> %va, <vscale x 8 x i1> %m, i32 zeroext %evl) {
206 ; CHECK-LABEL: vp_cttz_nxv8i8:
208 ; CHECK-NEXT: li a1, 1
209 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
210 ; CHECK-NEXT: vsub.vx v9, v8, a1, v0.t
211 ; CHECK-NEXT: vnot.v v8, v8, v0.t
212 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
213 ; CHECK-NEXT: vsrl.vi v9, v8, 1, v0.t
214 ; CHECK-NEXT: li a0, 85
215 ; CHECK-NEXT: vand.vx v9, v9, a0, v0.t
216 ; CHECK-NEXT: vsub.vv v8, v8, v9, v0.t
217 ; CHECK-NEXT: li a0, 51
218 ; CHECK-NEXT: vand.vx v9, v8, a0, v0.t
219 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
220 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
221 ; CHECK-NEXT: vadd.vv v8, v9, v8, v0.t
222 ; CHECK-NEXT: vsrl.vi v9, v8, 4, v0.t
223 ; CHECK-NEXT: vadd.vv v8, v8, v9, v0.t
224 ; CHECK-NEXT: vand.vi v8, v8, 15, v0.t
227 ; CHECK-ZVBB-LABEL: vp_cttz_nxv8i8:
228 ; CHECK-ZVBB: # %bb.0:
229 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m1, ta, ma
230 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
231 ; CHECK-ZVBB-NEXT: ret
232 %v = call <vscale x 8 x i8> @llvm.vp.cttz.nxv8i8(<vscale x 8 x i8> %va, i1 false, <vscale x 8 x i1> %m, i32 %evl)
233 ret <vscale x 8 x i8> %v
236 define <vscale x 8 x i8> @vp_cttz_nxv8i8_unmasked(<vscale x 8 x i8> %va, i32 zeroext %evl) {
237 ; CHECK-LABEL: vp_cttz_nxv8i8_unmasked:
239 ; CHECK-NEXT: li a1, 1
240 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
241 ; CHECK-NEXT: vsub.vx v9, v8, a1
242 ; CHECK-NEXT: vnot.v v8, v8
243 ; CHECK-NEXT: vand.vv v8, v8, v9
244 ; CHECK-NEXT: vsrl.vi v9, v8, 1
245 ; CHECK-NEXT: li a0, 85
246 ; CHECK-NEXT: vand.vx v9, v9, a0
247 ; CHECK-NEXT: vsub.vv v8, v8, v9
248 ; CHECK-NEXT: li a0, 51
249 ; CHECK-NEXT: vand.vx v9, v8, a0
250 ; CHECK-NEXT: vsrl.vi v8, v8, 2
251 ; CHECK-NEXT: vand.vx v8, v8, a0
252 ; CHECK-NEXT: vadd.vv v8, v9, v8
253 ; CHECK-NEXT: vsrl.vi v9, v8, 4
254 ; CHECK-NEXT: vadd.vv v8, v8, v9
255 ; CHECK-NEXT: vand.vi v8, v8, 15
258 ; CHECK-ZVBB-LABEL: vp_cttz_nxv8i8_unmasked:
259 ; CHECK-ZVBB: # %bb.0:
260 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m1, ta, ma
261 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
262 ; CHECK-ZVBB-NEXT: ret
263 %v = call <vscale x 8 x i8> @llvm.vp.cttz.nxv8i8(<vscale x 8 x i8> %va, i1 false, <vscale x 8 x i1> splat (i1 true), i32 %evl)
264 ret <vscale x 8 x i8> %v
267 declare <vscale x 16 x i8> @llvm.vp.cttz.nxv16i8(<vscale x 16 x i8>, i1 immarg, <vscale x 16 x i1>, i32)
269 define <vscale x 16 x i8> @vp_cttz_nxv16i8(<vscale x 16 x i8> %va, <vscale x 16 x i1> %m, i32 zeroext %evl) {
270 ; CHECK-LABEL: vp_cttz_nxv16i8:
272 ; CHECK-NEXT: li a1, 1
273 ; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, ma
274 ; CHECK-NEXT: vsub.vx v10, v8, a1, v0.t
275 ; CHECK-NEXT: vnot.v v8, v8, v0.t
276 ; CHECK-NEXT: vand.vv v8, v8, v10, v0.t
277 ; CHECK-NEXT: vsrl.vi v10, v8, 1, v0.t
278 ; CHECK-NEXT: li a0, 85
279 ; CHECK-NEXT: vand.vx v10, v10, a0, v0.t
280 ; CHECK-NEXT: vsub.vv v8, v8, v10, v0.t
281 ; CHECK-NEXT: li a0, 51
282 ; CHECK-NEXT: vand.vx v10, v8, a0, v0.t
283 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
284 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
285 ; CHECK-NEXT: vadd.vv v8, v10, v8, v0.t
286 ; CHECK-NEXT: vsrl.vi v10, v8, 4, v0.t
287 ; CHECK-NEXT: vadd.vv v8, v8, v10, v0.t
288 ; CHECK-NEXT: vand.vi v8, v8, 15, v0.t
291 ; CHECK-ZVBB-LABEL: vp_cttz_nxv16i8:
292 ; CHECK-ZVBB: # %bb.0:
293 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m2, ta, ma
294 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
295 ; CHECK-ZVBB-NEXT: ret
296 %v = call <vscale x 16 x i8> @llvm.vp.cttz.nxv16i8(<vscale x 16 x i8> %va, i1 false, <vscale x 16 x i1> %m, i32 %evl)
297 ret <vscale x 16 x i8> %v
300 define <vscale x 16 x i8> @vp_cttz_nxv16i8_unmasked(<vscale x 16 x i8> %va, i32 zeroext %evl) {
301 ; CHECK-LABEL: vp_cttz_nxv16i8_unmasked:
303 ; CHECK-NEXT: li a1, 1
304 ; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, ma
305 ; CHECK-NEXT: vsub.vx v10, v8, a1
306 ; CHECK-NEXT: vnot.v v8, v8
307 ; CHECK-NEXT: vand.vv v8, v8, v10
308 ; CHECK-NEXT: vsrl.vi v10, v8, 1
309 ; CHECK-NEXT: li a0, 85
310 ; CHECK-NEXT: vand.vx v10, v10, a0
311 ; CHECK-NEXT: vsub.vv v8, v8, v10
312 ; CHECK-NEXT: li a0, 51
313 ; CHECK-NEXT: vand.vx v10, v8, a0
314 ; CHECK-NEXT: vsrl.vi v8, v8, 2
315 ; CHECK-NEXT: vand.vx v8, v8, a0
316 ; CHECK-NEXT: vadd.vv v8, v10, v8
317 ; CHECK-NEXT: vsrl.vi v10, v8, 4
318 ; CHECK-NEXT: vadd.vv v8, v8, v10
319 ; CHECK-NEXT: vand.vi v8, v8, 15
322 ; CHECK-ZVBB-LABEL: vp_cttz_nxv16i8_unmasked:
323 ; CHECK-ZVBB: # %bb.0:
324 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m2, ta, ma
325 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
326 ; CHECK-ZVBB-NEXT: ret
327 %v = call <vscale x 16 x i8> @llvm.vp.cttz.nxv16i8(<vscale x 16 x i8> %va, i1 false, <vscale x 16 x i1> splat (i1 true), i32 %evl)
328 ret <vscale x 16 x i8> %v
331 declare <vscale x 32 x i8> @llvm.vp.cttz.nxv32i8(<vscale x 32 x i8>, i1 immarg, <vscale x 32 x i1>, i32)
333 define <vscale x 32 x i8> @vp_cttz_nxv32i8(<vscale x 32 x i8> %va, <vscale x 32 x i1> %m, i32 zeroext %evl) {
334 ; CHECK-LABEL: vp_cttz_nxv32i8:
336 ; CHECK-NEXT: li a1, 1
337 ; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, ma
338 ; CHECK-NEXT: vsub.vx v12, v8, a1, v0.t
339 ; CHECK-NEXT: vnot.v v8, v8, v0.t
340 ; CHECK-NEXT: vand.vv v8, v8, v12, v0.t
341 ; CHECK-NEXT: vsrl.vi v12, v8, 1, v0.t
342 ; CHECK-NEXT: li a0, 85
343 ; CHECK-NEXT: vand.vx v12, v12, a0, v0.t
344 ; CHECK-NEXT: vsub.vv v8, v8, v12, v0.t
345 ; CHECK-NEXT: li a0, 51
346 ; CHECK-NEXT: vand.vx v12, v8, a0, v0.t
347 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
348 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
349 ; CHECK-NEXT: vadd.vv v8, v12, v8, v0.t
350 ; CHECK-NEXT: vsrl.vi v12, v8, 4, v0.t
351 ; CHECK-NEXT: vadd.vv v8, v8, v12, v0.t
352 ; CHECK-NEXT: vand.vi v8, v8, 15, v0.t
355 ; CHECK-ZVBB-LABEL: vp_cttz_nxv32i8:
356 ; CHECK-ZVBB: # %bb.0:
357 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m4, ta, ma
358 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
359 ; CHECK-ZVBB-NEXT: ret
360 %v = call <vscale x 32 x i8> @llvm.vp.cttz.nxv32i8(<vscale x 32 x i8> %va, i1 false, <vscale x 32 x i1> %m, i32 %evl)
361 ret <vscale x 32 x i8> %v
364 define <vscale x 32 x i8> @vp_cttz_nxv32i8_unmasked(<vscale x 32 x i8> %va, i32 zeroext %evl) {
365 ; CHECK-LABEL: vp_cttz_nxv32i8_unmasked:
367 ; CHECK-NEXT: li a1, 1
368 ; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, ma
369 ; CHECK-NEXT: vsub.vx v12, v8, a1
370 ; CHECK-NEXT: vnot.v v8, v8
371 ; CHECK-NEXT: vand.vv v8, v8, v12
372 ; CHECK-NEXT: vsrl.vi v12, v8, 1
373 ; CHECK-NEXT: li a0, 85
374 ; CHECK-NEXT: vand.vx v12, v12, a0
375 ; CHECK-NEXT: vsub.vv v8, v8, v12
376 ; CHECK-NEXT: li a0, 51
377 ; CHECK-NEXT: vand.vx v12, v8, a0
378 ; CHECK-NEXT: vsrl.vi v8, v8, 2
379 ; CHECK-NEXT: vand.vx v8, v8, a0
380 ; CHECK-NEXT: vadd.vv v8, v12, v8
381 ; CHECK-NEXT: vsrl.vi v12, v8, 4
382 ; CHECK-NEXT: vadd.vv v8, v8, v12
383 ; CHECK-NEXT: vand.vi v8, v8, 15
386 ; CHECK-ZVBB-LABEL: vp_cttz_nxv32i8_unmasked:
387 ; CHECK-ZVBB: # %bb.0:
388 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m4, ta, ma
389 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
390 ; CHECK-ZVBB-NEXT: ret
391 %v = call <vscale x 32 x i8> @llvm.vp.cttz.nxv32i8(<vscale x 32 x i8> %va, i1 false, <vscale x 32 x i1> splat (i1 true), i32 %evl)
392 ret <vscale x 32 x i8> %v
395 declare <vscale x 64 x i8> @llvm.vp.cttz.nxv64i8(<vscale x 64 x i8>, i1 immarg, <vscale x 64 x i1>, i32)
397 define <vscale x 64 x i8> @vp_cttz_nxv64i8(<vscale x 64 x i8> %va, <vscale x 64 x i1> %m, i32 zeroext %evl) {
398 ; CHECK-LABEL: vp_cttz_nxv64i8:
400 ; CHECK-NEXT: li a1, 1
401 ; CHECK-NEXT: vsetvli zero, a0, e8, m8, ta, ma
402 ; CHECK-NEXT: vsub.vx v16, v8, a1, v0.t
403 ; CHECK-NEXT: vnot.v v8, v8, v0.t
404 ; CHECK-NEXT: vand.vv v8, v8, v16, v0.t
405 ; CHECK-NEXT: vsrl.vi v16, v8, 1, v0.t
406 ; CHECK-NEXT: li a0, 85
407 ; CHECK-NEXT: vand.vx v16, v16, a0, v0.t
408 ; CHECK-NEXT: vsub.vv v8, v8, v16, v0.t
409 ; CHECK-NEXT: li a0, 51
410 ; CHECK-NEXT: vand.vx v16, v8, a0, v0.t
411 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
412 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
413 ; CHECK-NEXT: vadd.vv v8, v16, v8, v0.t
414 ; CHECK-NEXT: vsrl.vi v16, v8, 4, v0.t
415 ; CHECK-NEXT: vadd.vv v8, v8, v16, v0.t
416 ; CHECK-NEXT: vand.vi v8, v8, 15, v0.t
419 ; CHECK-ZVBB-LABEL: vp_cttz_nxv64i8:
420 ; CHECK-ZVBB: # %bb.0:
421 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m8, ta, ma
422 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
423 ; CHECK-ZVBB-NEXT: ret
424 %v = call <vscale x 64 x i8> @llvm.vp.cttz.nxv64i8(<vscale x 64 x i8> %va, i1 false, <vscale x 64 x i1> %m, i32 %evl)
425 ret <vscale x 64 x i8> %v
428 define <vscale x 64 x i8> @vp_cttz_nxv64i8_unmasked(<vscale x 64 x i8> %va, i32 zeroext %evl) {
429 ; CHECK-LABEL: vp_cttz_nxv64i8_unmasked:
431 ; CHECK-NEXT: li a1, 1
432 ; CHECK-NEXT: vsetvli zero, a0, e8, m8, ta, ma
433 ; CHECK-NEXT: vsub.vx v16, v8, a1
434 ; CHECK-NEXT: vnot.v v8, v8
435 ; CHECK-NEXT: vand.vv v8, v8, v16
436 ; CHECK-NEXT: vsrl.vi v16, v8, 1
437 ; CHECK-NEXT: li a0, 85
438 ; CHECK-NEXT: vand.vx v16, v16, a0
439 ; CHECK-NEXT: vsub.vv v8, v8, v16
440 ; CHECK-NEXT: li a0, 51
441 ; CHECK-NEXT: vand.vx v16, v8, a0
442 ; CHECK-NEXT: vsrl.vi v8, v8, 2
443 ; CHECK-NEXT: vand.vx v8, v8, a0
444 ; CHECK-NEXT: vadd.vv v8, v16, v8
445 ; CHECK-NEXT: vsrl.vi v16, v8, 4
446 ; CHECK-NEXT: vadd.vv v8, v8, v16
447 ; CHECK-NEXT: vand.vi v8, v8, 15
450 ; CHECK-ZVBB-LABEL: vp_cttz_nxv64i8_unmasked:
451 ; CHECK-ZVBB: # %bb.0:
452 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m8, ta, ma
453 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
454 ; CHECK-ZVBB-NEXT: ret
455 %v = call <vscale x 64 x i8> @llvm.vp.cttz.nxv64i8(<vscale x 64 x i8> %va, i1 false, <vscale x 64 x i1> splat (i1 true), i32 %evl)
456 ret <vscale x 64 x i8> %v
459 declare <vscale x 1 x i16> @llvm.vp.cttz.nxv1i16(<vscale x 1 x i16>, i1 immarg, <vscale x 1 x i1>, i32)
461 define <vscale x 1 x i16> @vp_cttz_nxv1i16(<vscale x 1 x i16> %va, <vscale x 1 x i1> %m, i32 zeroext %evl) {
462 ; CHECK-LABEL: vp_cttz_nxv1i16:
464 ; CHECK-NEXT: li a1, 1
465 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
466 ; CHECK-NEXT: vsub.vx v9, v8, a1, v0.t
467 ; CHECK-NEXT: vnot.v v8, v8, v0.t
468 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
469 ; CHECK-NEXT: vsrl.vi v9, v8, 1, v0.t
470 ; CHECK-NEXT: lui a0, 5
471 ; CHECK-NEXT: addi a0, a0, 1365
472 ; CHECK-NEXT: vand.vx v9, v9, a0, v0.t
473 ; CHECK-NEXT: vsub.vv v8, v8, v9, v0.t
474 ; CHECK-NEXT: lui a0, 3
475 ; CHECK-NEXT: addi a0, a0, 819
476 ; CHECK-NEXT: vand.vx v9, v8, a0, v0.t
477 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
478 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
479 ; CHECK-NEXT: vadd.vv v8, v9, v8, v0.t
480 ; CHECK-NEXT: vsrl.vi v9, v8, 4, v0.t
481 ; CHECK-NEXT: vadd.vv v8, v8, v9, v0.t
482 ; CHECK-NEXT: lui a0, 1
483 ; CHECK-NEXT: addi a0, a0, -241
484 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
485 ; CHECK-NEXT: li a0, 257
486 ; CHECK-NEXT: vmul.vx v8, v8, a0, v0.t
487 ; CHECK-NEXT: vsrl.vi v8, v8, 8, v0.t
490 ; CHECK-ZVBB-LABEL: vp_cttz_nxv1i16:
491 ; CHECK-ZVBB: # %bb.0:
492 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
493 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
494 ; CHECK-ZVBB-NEXT: ret
495 %v = call <vscale x 1 x i16> @llvm.vp.cttz.nxv1i16(<vscale x 1 x i16> %va, i1 false, <vscale x 1 x i1> %m, i32 %evl)
496 ret <vscale x 1 x i16> %v
499 define <vscale x 1 x i16> @vp_cttz_nxv1i16_unmasked(<vscale x 1 x i16> %va, i32 zeroext %evl) {
500 ; CHECK-LABEL: vp_cttz_nxv1i16_unmasked:
502 ; CHECK-NEXT: li a1, 1
503 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
504 ; CHECK-NEXT: vsub.vx v9, v8, a1
505 ; CHECK-NEXT: vnot.v v8, v8
506 ; CHECK-NEXT: vand.vv v8, v8, v9
507 ; CHECK-NEXT: vsrl.vi v9, v8, 1
508 ; CHECK-NEXT: lui a0, 5
509 ; CHECK-NEXT: addi a0, a0, 1365
510 ; CHECK-NEXT: vand.vx v9, v9, a0
511 ; CHECK-NEXT: vsub.vv v8, v8, v9
512 ; CHECK-NEXT: lui a0, 3
513 ; CHECK-NEXT: addi a0, a0, 819
514 ; CHECK-NEXT: vand.vx v9, v8, a0
515 ; CHECK-NEXT: vsrl.vi v8, v8, 2
516 ; CHECK-NEXT: vand.vx v8, v8, a0
517 ; CHECK-NEXT: vadd.vv v8, v9, v8
518 ; CHECK-NEXT: vsrl.vi v9, v8, 4
519 ; CHECK-NEXT: vadd.vv v8, v8, v9
520 ; CHECK-NEXT: lui a0, 1
521 ; CHECK-NEXT: addi a0, a0, -241
522 ; CHECK-NEXT: vand.vx v8, v8, a0
523 ; CHECK-NEXT: li a0, 257
524 ; CHECK-NEXT: vmul.vx v8, v8, a0
525 ; CHECK-NEXT: vsrl.vi v8, v8, 8
528 ; CHECK-ZVBB-LABEL: vp_cttz_nxv1i16_unmasked:
529 ; CHECK-ZVBB: # %bb.0:
530 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
531 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
532 ; CHECK-ZVBB-NEXT: ret
533 %v = call <vscale x 1 x i16> @llvm.vp.cttz.nxv1i16(<vscale x 1 x i16> %va, i1 false, <vscale x 1 x i1> splat (i1 true), i32 %evl)
534 ret <vscale x 1 x i16> %v
537 declare <vscale x 2 x i16> @llvm.vp.cttz.nxv2i16(<vscale x 2 x i16>, i1 immarg, <vscale x 2 x i1>, i32)
539 define <vscale x 2 x i16> @vp_cttz_nxv2i16(<vscale x 2 x i16> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
540 ; CHECK-LABEL: vp_cttz_nxv2i16:
542 ; CHECK-NEXT: li a1, 1
543 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
544 ; CHECK-NEXT: vsub.vx v9, v8, a1, v0.t
545 ; CHECK-NEXT: vnot.v v8, v8, v0.t
546 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
547 ; CHECK-NEXT: vsrl.vi v9, v8, 1, v0.t
548 ; CHECK-NEXT: lui a0, 5
549 ; CHECK-NEXT: addi a0, a0, 1365
550 ; CHECK-NEXT: vand.vx v9, v9, a0, v0.t
551 ; CHECK-NEXT: vsub.vv v8, v8, v9, v0.t
552 ; CHECK-NEXT: lui a0, 3
553 ; CHECK-NEXT: addi a0, a0, 819
554 ; CHECK-NEXT: vand.vx v9, v8, a0, v0.t
555 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
556 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
557 ; CHECK-NEXT: vadd.vv v8, v9, v8, v0.t
558 ; CHECK-NEXT: vsrl.vi v9, v8, 4, v0.t
559 ; CHECK-NEXT: vadd.vv v8, v8, v9, v0.t
560 ; CHECK-NEXT: lui a0, 1
561 ; CHECK-NEXT: addi a0, a0, -241
562 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
563 ; CHECK-NEXT: li a0, 257
564 ; CHECK-NEXT: vmul.vx v8, v8, a0, v0.t
565 ; CHECK-NEXT: vsrl.vi v8, v8, 8, v0.t
568 ; CHECK-ZVBB-LABEL: vp_cttz_nxv2i16:
569 ; CHECK-ZVBB: # %bb.0:
570 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
571 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
572 ; CHECK-ZVBB-NEXT: ret
573 %v = call <vscale x 2 x i16> @llvm.vp.cttz.nxv2i16(<vscale x 2 x i16> %va, i1 false, <vscale x 2 x i1> %m, i32 %evl)
574 ret <vscale x 2 x i16> %v
577 define <vscale x 2 x i16> @vp_cttz_nxv2i16_unmasked(<vscale x 2 x i16> %va, i32 zeroext %evl) {
578 ; CHECK-LABEL: vp_cttz_nxv2i16_unmasked:
580 ; CHECK-NEXT: li a1, 1
581 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
582 ; CHECK-NEXT: vsub.vx v9, v8, a1
583 ; CHECK-NEXT: vnot.v v8, v8
584 ; CHECK-NEXT: vand.vv v8, v8, v9
585 ; CHECK-NEXT: vsrl.vi v9, v8, 1
586 ; CHECK-NEXT: lui a0, 5
587 ; CHECK-NEXT: addi a0, a0, 1365
588 ; CHECK-NEXT: vand.vx v9, v9, a0
589 ; CHECK-NEXT: vsub.vv v8, v8, v9
590 ; CHECK-NEXT: lui a0, 3
591 ; CHECK-NEXT: addi a0, a0, 819
592 ; CHECK-NEXT: vand.vx v9, v8, a0
593 ; CHECK-NEXT: vsrl.vi v8, v8, 2
594 ; CHECK-NEXT: vand.vx v8, v8, a0
595 ; CHECK-NEXT: vadd.vv v8, v9, v8
596 ; CHECK-NEXT: vsrl.vi v9, v8, 4
597 ; CHECK-NEXT: vadd.vv v8, v8, v9
598 ; CHECK-NEXT: lui a0, 1
599 ; CHECK-NEXT: addi a0, a0, -241
600 ; CHECK-NEXT: vand.vx v8, v8, a0
601 ; CHECK-NEXT: li a0, 257
602 ; CHECK-NEXT: vmul.vx v8, v8, a0
603 ; CHECK-NEXT: vsrl.vi v8, v8, 8
606 ; CHECK-ZVBB-LABEL: vp_cttz_nxv2i16_unmasked:
607 ; CHECK-ZVBB: # %bb.0:
608 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
609 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
610 ; CHECK-ZVBB-NEXT: ret
611 %v = call <vscale x 2 x i16> @llvm.vp.cttz.nxv2i16(<vscale x 2 x i16> %va, i1 false, <vscale x 2 x i1> splat (i1 true), i32 %evl)
612 ret <vscale x 2 x i16> %v
615 declare <vscale x 4 x i16> @llvm.vp.cttz.nxv4i16(<vscale x 4 x i16>, i1 immarg, <vscale x 4 x i1>, i32)
617 define <vscale x 4 x i16> @vp_cttz_nxv4i16(<vscale x 4 x i16> %va, <vscale x 4 x i1> %m, i32 zeroext %evl) {
618 ; CHECK-LABEL: vp_cttz_nxv4i16:
620 ; CHECK-NEXT: li a1, 1
621 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
622 ; CHECK-NEXT: vsub.vx v9, v8, a1, v0.t
623 ; CHECK-NEXT: vnot.v v8, v8, v0.t
624 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
625 ; CHECK-NEXT: vsrl.vi v9, v8, 1, v0.t
626 ; CHECK-NEXT: lui a0, 5
627 ; CHECK-NEXT: addi a0, a0, 1365
628 ; CHECK-NEXT: vand.vx v9, v9, a0, v0.t
629 ; CHECK-NEXT: vsub.vv v8, v8, v9, v0.t
630 ; CHECK-NEXT: lui a0, 3
631 ; CHECK-NEXT: addi a0, a0, 819
632 ; CHECK-NEXT: vand.vx v9, v8, a0, v0.t
633 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
634 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
635 ; CHECK-NEXT: vadd.vv v8, v9, v8, v0.t
636 ; CHECK-NEXT: vsrl.vi v9, v8, 4, v0.t
637 ; CHECK-NEXT: vadd.vv v8, v8, v9, v0.t
638 ; CHECK-NEXT: lui a0, 1
639 ; CHECK-NEXT: addi a0, a0, -241
640 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
641 ; CHECK-NEXT: li a0, 257
642 ; CHECK-NEXT: vmul.vx v8, v8, a0, v0.t
643 ; CHECK-NEXT: vsrl.vi v8, v8, 8, v0.t
646 ; CHECK-ZVBB-LABEL: vp_cttz_nxv4i16:
647 ; CHECK-ZVBB: # %bb.0:
648 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m1, ta, ma
649 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
650 ; CHECK-ZVBB-NEXT: ret
651 %v = call <vscale x 4 x i16> @llvm.vp.cttz.nxv4i16(<vscale x 4 x i16> %va, i1 false, <vscale x 4 x i1> %m, i32 %evl)
652 ret <vscale x 4 x i16> %v
655 define <vscale x 4 x i16> @vp_cttz_nxv4i16_unmasked(<vscale x 4 x i16> %va, i32 zeroext %evl) {
656 ; CHECK-LABEL: vp_cttz_nxv4i16_unmasked:
658 ; CHECK-NEXT: li a1, 1
659 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
660 ; CHECK-NEXT: vsub.vx v9, v8, a1
661 ; CHECK-NEXT: vnot.v v8, v8
662 ; CHECK-NEXT: vand.vv v8, v8, v9
663 ; CHECK-NEXT: vsrl.vi v9, v8, 1
664 ; CHECK-NEXT: lui a0, 5
665 ; CHECK-NEXT: addi a0, a0, 1365
666 ; CHECK-NEXT: vand.vx v9, v9, a0
667 ; CHECK-NEXT: vsub.vv v8, v8, v9
668 ; CHECK-NEXT: lui a0, 3
669 ; CHECK-NEXT: addi a0, a0, 819
670 ; CHECK-NEXT: vand.vx v9, v8, a0
671 ; CHECK-NEXT: vsrl.vi v8, v8, 2
672 ; CHECK-NEXT: vand.vx v8, v8, a0
673 ; CHECK-NEXT: vadd.vv v8, v9, v8
674 ; CHECK-NEXT: vsrl.vi v9, v8, 4
675 ; CHECK-NEXT: vadd.vv v8, v8, v9
676 ; CHECK-NEXT: lui a0, 1
677 ; CHECK-NEXT: addi a0, a0, -241
678 ; CHECK-NEXT: vand.vx v8, v8, a0
679 ; CHECK-NEXT: li a0, 257
680 ; CHECK-NEXT: vmul.vx v8, v8, a0
681 ; CHECK-NEXT: vsrl.vi v8, v8, 8
684 ; CHECK-ZVBB-LABEL: vp_cttz_nxv4i16_unmasked:
685 ; CHECK-ZVBB: # %bb.0:
686 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m1, ta, ma
687 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
688 ; CHECK-ZVBB-NEXT: ret
689 %v = call <vscale x 4 x i16> @llvm.vp.cttz.nxv4i16(<vscale x 4 x i16> %va, i1 false, <vscale x 4 x i1> splat (i1 true), i32 %evl)
690 ret <vscale x 4 x i16> %v
693 declare <vscale x 8 x i16> @llvm.vp.cttz.nxv8i16(<vscale x 8 x i16>, i1 immarg, <vscale x 8 x i1>, i32)
695 define <vscale x 8 x i16> @vp_cttz_nxv8i16(<vscale x 8 x i16> %va, <vscale x 8 x i1> %m, i32 zeroext %evl) {
696 ; CHECK-LABEL: vp_cttz_nxv8i16:
698 ; CHECK-NEXT: li a1, 1
699 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
700 ; CHECK-NEXT: vsub.vx v10, v8, a1, v0.t
701 ; CHECK-NEXT: vnot.v v8, v8, v0.t
702 ; CHECK-NEXT: vand.vv v8, v8, v10, v0.t
703 ; CHECK-NEXT: vsrl.vi v10, v8, 1, v0.t
704 ; CHECK-NEXT: lui a0, 5
705 ; CHECK-NEXT: addi a0, a0, 1365
706 ; CHECK-NEXT: vand.vx v10, v10, a0, v0.t
707 ; CHECK-NEXT: vsub.vv v8, v8, v10, v0.t
708 ; CHECK-NEXT: lui a0, 3
709 ; CHECK-NEXT: addi a0, a0, 819
710 ; CHECK-NEXT: vand.vx v10, v8, a0, v0.t
711 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
712 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
713 ; CHECK-NEXT: vadd.vv v8, v10, v8, v0.t
714 ; CHECK-NEXT: vsrl.vi v10, v8, 4, v0.t
715 ; CHECK-NEXT: vadd.vv v8, v8, v10, v0.t
716 ; CHECK-NEXT: lui a0, 1
717 ; CHECK-NEXT: addi a0, a0, -241
718 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
719 ; CHECK-NEXT: li a0, 257
720 ; CHECK-NEXT: vmul.vx v8, v8, a0, v0.t
721 ; CHECK-NEXT: vsrl.vi v8, v8, 8, v0.t
724 ; CHECK-ZVBB-LABEL: vp_cttz_nxv8i16:
725 ; CHECK-ZVBB: # %bb.0:
726 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m2, ta, ma
727 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
728 ; CHECK-ZVBB-NEXT: ret
729 %v = call <vscale x 8 x i16> @llvm.vp.cttz.nxv8i16(<vscale x 8 x i16> %va, i1 false, <vscale x 8 x i1> %m, i32 %evl)
730 ret <vscale x 8 x i16> %v
733 define <vscale x 8 x i16> @vp_cttz_nxv8i16_unmasked(<vscale x 8 x i16> %va, i32 zeroext %evl) {
734 ; CHECK-LABEL: vp_cttz_nxv8i16_unmasked:
736 ; CHECK-NEXT: li a1, 1
737 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
738 ; CHECK-NEXT: vsub.vx v10, v8, a1
739 ; CHECK-NEXT: vnot.v v8, v8
740 ; CHECK-NEXT: vand.vv v8, v8, v10
741 ; CHECK-NEXT: vsrl.vi v10, v8, 1
742 ; CHECK-NEXT: lui a0, 5
743 ; CHECK-NEXT: addi a0, a0, 1365
744 ; CHECK-NEXT: vand.vx v10, v10, a0
745 ; CHECK-NEXT: vsub.vv v8, v8, v10
746 ; CHECK-NEXT: lui a0, 3
747 ; CHECK-NEXT: addi a0, a0, 819
748 ; CHECK-NEXT: vand.vx v10, v8, a0
749 ; CHECK-NEXT: vsrl.vi v8, v8, 2
750 ; CHECK-NEXT: vand.vx v8, v8, a0
751 ; CHECK-NEXT: vadd.vv v8, v10, v8
752 ; CHECK-NEXT: vsrl.vi v10, v8, 4
753 ; CHECK-NEXT: vadd.vv v8, v8, v10
754 ; CHECK-NEXT: lui a0, 1
755 ; CHECK-NEXT: addi a0, a0, -241
756 ; CHECK-NEXT: vand.vx v8, v8, a0
757 ; CHECK-NEXT: li a0, 257
758 ; CHECK-NEXT: vmul.vx v8, v8, a0
759 ; CHECK-NEXT: vsrl.vi v8, v8, 8
762 ; CHECK-ZVBB-LABEL: vp_cttz_nxv8i16_unmasked:
763 ; CHECK-ZVBB: # %bb.0:
764 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m2, ta, ma
765 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
766 ; CHECK-ZVBB-NEXT: ret
767 %v = call <vscale x 8 x i16> @llvm.vp.cttz.nxv8i16(<vscale x 8 x i16> %va, i1 false, <vscale x 8 x i1> splat (i1 true), i32 %evl)
768 ret <vscale x 8 x i16> %v
771 declare <vscale x 16 x i16> @llvm.vp.cttz.nxv16i16(<vscale x 16 x i16>, i1 immarg, <vscale x 16 x i1>, i32)
773 define <vscale x 16 x i16> @vp_cttz_nxv16i16(<vscale x 16 x i16> %va, <vscale x 16 x i1> %m, i32 zeroext %evl) {
774 ; CHECK-LABEL: vp_cttz_nxv16i16:
776 ; CHECK-NEXT: li a1, 1
777 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
778 ; CHECK-NEXT: vsub.vx v12, v8, a1, v0.t
779 ; CHECK-NEXT: vnot.v v8, v8, v0.t
780 ; CHECK-NEXT: vand.vv v8, v8, v12, v0.t
781 ; CHECK-NEXT: vsrl.vi v12, v8, 1, v0.t
782 ; CHECK-NEXT: lui a0, 5
783 ; CHECK-NEXT: addi a0, a0, 1365
784 ; CHECK-NEXT: vand.vx v12, v12, a0, v0.t
785 ; CHECK-NEXT: vsub.vv v8, v8, v12, v0.t
786 ; CHECK-NEXT: lui a0, 3
787 ; CHECK-NEXT: addi a0, a0, 819
788 ; CHECK-NEXT: vand.vx v12, v8, a0, v0.t
789 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
790 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
791 ; CHECK-NEXT: vadd.vv v8, v12, v8, v0.t
792 ; CHECK-NEXT: vsrl.vi v12, v8, 4, v0.t
793 ; CHECK-NEXT: vadd.vv v8, v8, v12, v0.t
794 ; CHECK-NEXT: lui a0, 1
795 ; CHECK-NEXT: addi a0, a0, -241
796 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
797 ; CHECK-NEXT: li a0, 257
798 ; CHECK-NEXT: vmul.vx v8, v8, a0, v0.t
799 ; CHECK-NEXT: vsrl.vi v8, v8, 8, v0.t
802 ; CHECK-ZVBB-LABEL: vp_cttz_nxv16i16:
803 ; CHECK-ZVBB: # %bb.0:
804 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m4, ta, ma
805 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
806 ; CHECK-ZVBB-NEXT: ret
807 %v = call <vscale x 16 x i16> @llvm.vp.cttz.nxv16i16(<vscale x 16 x i16> %va, i1 false, <vscale x 16 x i1> %m, i32 %evl)
808 ret <vscale x 16 x i16> %v
811 define <vscale x 16 x i16> @vp_cttz_nxv16i16_unmasked(<vscale x 16 x i16> %va, i32 zeroext %evl) {
812 ; CHECK-LABEL: vp_cttz_nxv16i16_unmasked:
814 ; CHECK-NEXT: li a1, 1
815 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
816 ; CHECK-NEXT: vsub.vx v12, v8, a1
817 ; CHECK-NEXT: vnot.v v8, v8
818 ; CHECK-NEXT: vand.vv v8, v8, v12
819 ; CHECK-NEXT: vsrl.vi v12, v8, 1
820 ; CHECK-NEXT: lui a0, 5
821 ; CHECK-NEXT: addi a0, a0, 1365
822 ; CHECK-NEXT: vand.vx v12, v12, a0
823 ; CHECK-NEXT: vsub.vv v8, v8, v12
824 ; CHECK-NEXT: lui a0, 3
825 ; CHECK-NEXT: addi a0, a0, 819
826 ; CHECK-NEXT: vand.vx v12, v8, a0
827 ; CHECK-NEXT: vsrl.vi v8, v8, 2
828 ; CHECK-NEXT: vand.vx v8, v8, a0
829 ; CHECK-NEXT: vadd.vv v8, v12, v8
830 ; CHECK-NEXT: vsrl.vi v12, v8, 4
831 ; CHECK-NEXT: vadd.vv v8, v8, v12
832 ; CHECK-NEXT: lui a0, 1
833 ; CHECK-NEXT: addi a0, a0, -241
834 ; CHECK-NEXT: vand.vx v8, v8, a0
835 ; CHECK-NEXT: li a0, 257
836 ; CHECK-NEXT: vmul.vx v8, v8, a0
837 ; CHECK-NEXT: vsrl.vi v8, v8, 8
840 ; CHECK-ZVBB-LABEL: vp_cttz_nxv16i16_unmasked:
841 ; CHECK-ZVBB: # %bb.0:
842 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m4, ta, ma
843 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
844 ; CHECK-ZVBB-NEXT: ret
845 %v = call <vscale x 16 x i16> @llvm.vp.cttz.nxv16i16(<vscale x 16 x i16> %va, i1 false, <vscale x 16 x i1> splat (i1 true), i32 %evl)
846 ret <vscale x 16 x i16> %v
849 declare <vscale x 32 x i16> @llvm.vp.cttz.nxv32i16(<vscale x 32 x i16>, i1 immarg, <vscale x 32 x i1>, i32)
851 define <vscale x 32 x i16> @vp_cttz_nxv32i16(<vscale x 32 x i16> %va, <vscale x 32 x i1> %m, i32 zeroext %evl) {
852 ; CHECK-LABEL: vp_cttz_nxv32i16:
854 ; CHECK-NEXT: li a1, 1
855 ; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, ma
856 ; CHECK-NEXT: vsub.vx v16, v8, a1, v0.t
857 ; CHECK-NEXT: vnot.v v8, v8, v0.t
858 ; CHECK-NEXT: vand.vv v8, v8, v16, v0.t
859 ; CHECK-NEXT: vsrl.vi v16, v8, 1, v0.t
860 ; CHECK-NEXT: lui a0, 5
861 ; CHECK-NEXT: addi a0, a0, 1365
862 ; CHECK-NEXT: vand.vx v16, v16, a0, v0.t
863 ; CHECK-NEXT: vsub.vv v8, v8, v16, v0.t
864 ; CHECK-NEXT: lui a0, 3
865 ; CHECK-NEXT: addi a0, a0, 819
866 ; CHECK-NEXT: vand.vx v16, v8, a0, v0.t
867 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
868 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
869 ; CHECK-NEXT: vadd.vv v8, v16, v8, v0.t
870 ; CHECK-NEXT: vsrl.vi v16, v8, 4, v0.t
871 ; CHECK-NEXT: vadd.vv v8, v8, v16, v0.t
872 ; CHECK-NEXT: lui a0, 1
873 ; CHECK-NEXT: addi a0, a0, -241
874 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
875 ; CHECK-NEXT: li a0, 257
876 ; CHECK-NEXT: vmul.vx v8, v8, a0, v0.t
877 ; CHECK-NEXT: vsrl.vi v8, v8, 8, v0.t
880 ; CHECK-ZVBB-LABEL: vp_cttz_nxv32i16:
881 ; CHECK-ZVBB: # %bb.0:
882 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m8, ta, ma
883 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
884 ; CHECK-ZVBB-NEXT: ret
885 %v = call <vscale x 32 x i16> @llvm.vp.cttz.nxv32i16(<vscale x 32 x i16> %va, i1 false, <vscale x 32 x i1> %m, i32 %evl)
886 ret <vscale x 32 x i16> %v
889 define <vscale x 32 x i16> @vp_cttz_nxv32i16_unmasked(<vscale x 32 x i16> %va, i32 zeroext %evl) {
890 ; CHECK-LABEL: vp_cttz_nxv32i16_unmasked:
892 ; CHECK-NEXT: li a1, 1
893 ; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, ma
894 ; CHECK-NEXT: vsub.vx v16, v8, a1
895 ; CHECK-NEXT: vnot.v v8, v8
896 ; CHECK-NEXT: vand.vv v8, v8, v16
897 ; CHECK-NEXT: vsrl.vi v16, v8, 1
898 ; CHECK-NEXT: lui a0, 5
899 ; CHECK-NEXT: addi a0, a0, 1365
900 ; CHECK-NEXT: vand.vx v16, v16, a0
901 ; CHECK-NEXT: vsub.vv v8, v8, v16
902 ; CHECK-NEXT: lui a0, 3
903 ; CHECK-NEXT: addi a0, a0, 819
904 ; CHECK-NEXT: vand.vx v16, v8, a0
905 ; CHECK-NEXT: vsrl.vi v8, v8, 2
906 ; CHECK-NEXT: vand.vx v8, v8, a0
907 ; CHECK-NEXT: vadd.vv v8, v16, v8
908 ; CHECK-NEXT: vsrl.vi v16, v8, 4
909 ; CHECK-NEXT: vadd.vv v8, v8, v16
910 ; CHECK-NEXT: lui a0, 1
911 ; CHECK-NEXT: addi a0, a0, -241
912 ; CHECK-NEXT: vand.vx v8, v8, a0
913 ; CHECK-NEXT: li a0, 257
914 ; CHECK-NEXT: vmul.vx v8, v8, a0
915 ; CHECK-NEXT: vsrl.vi v8, v8, 8
918 ; CHECK-ZVBB-LABEL: vp_cttz_nxv32i16_unmasked:
919 ; CHECK-ZVBB: # %bb.0:
920 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m8, ta, ma
921 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
922 ; CHECK-ZVBB-NEXT: ret
923 %v = call <vscale x 32 x i16> @llvm.vp.cttz.nxv32i16(<vscale x 32 x i16> %va, i1 false, <vscale x 32 x i1> splat (i1 true), i32 %evl)
924 ret <vscale x 32 x i16> %v
927 declare <vscale x 1 x i32> @llvm.vp.cttz.nxv1i32(<vscale x 1 x i32>, i1 immarg, <vscale x 1 x i1>, i32)
929 define <vscale x 1 x i32> @vp_cttz_nxv1i32(<vscale x 1 x i32> %va, <vscale x 1 x i1> %m, i32 zeroext %evl) {
930 ; CHECK-LABEL: vp_cttz_nxv1i32:
932 ; CHECK-NEXT: li a1, 1
933 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
934 ; CHECK-NEXT: vsub.vx v9, v8, a1, v0.t
935 ; CHECK-NEXT: vnot.v v8, v8, v0.t
936 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
937 ; CHECK-NEXT: vsrl.vi v9, v8, 1, v0.t
938 ; CHECK-NEXT: lui a0, 349525
939 ; CHECK-NEXT: addi a0, a0, 1365
940 ; CHECK-NEXT: vand.vx v9, v9, a0, v0.t
941 ; CHECK-NEXT: vsub.vv v8, v8, v9, v0.t
942 ; CHECK-NEXT: lui a0, 209715
943 ; CHECK-NEXT: addi a0, a0, 819
944 ; CHECK-NEXT: vand.vx v9, v8, a0, v0.t
945 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
946 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
947 ; CHECK-NEXT: vadd.vv v8, v9, v8, v0.t
948 ; CHECK-NEXT: vsrl.vi v9, v8, 4, v0.t
949 ; CHECK-NEXT: vadd.vv v8, v8, v9, v0.t
950 ; CHECK-NEXT: lui a0, 61681
951 ; CHECK-NEXT: addi a0, a0, -241
952 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
953 ; CHECK-NEXT: lui a0, 4112
954 ; CHECK-NEXT: addi a0, a0, 257
955 ; CHECK-NEXT: vmul.vx v8, v8, a0, v0.t
956 ; CHECK-NEXT: vsrl.vi v8, v8, 24, v0.t
959 ; CHECK-ZVBB-LABEL: vp_cttz_nxv1i32:
960 ; CHECK-ZVBB: # %bb.0:
961 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
962 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
963 ; CHECK-ZVBB-NEXT: ret
964 %v = call <vscale x 1 x i32> @llvm.vp.cttz.nxv1i32(<vscale x 1 x i32> %va, i1 false, <vscale x 1 x i1> %m, i32 %evl)
965 ret <vscale x 1 x i32> %v
968 define <vscale x 1 x i32> @vp_cttz_nxv1i32_unmasked(<vscale x 1 x i32> %va, i32 zeroext %evl) {
969 ; CHECK-LABEL: vp_cttz_nxv1i32_unmasked:
971 ; CHECK-NEXT: li a1, 1
972 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
973 ; CHECK-NEXT: vsub.vx v9, v8, a1
974 ; CHECK-NEXT: vnot.v v8, v8
975 ; CHECK-NEXT: vand.vv v8, v8, v9
976 ; CHECK-NEXT: vsrl.vi v9, v8, 1
977 ; CHECK-NEXT: lui a0, 349525
978 ; CHECK-NEXT: addi a0, a0, 1365
979 ; CHECK-NEXT: vand.vx v9, v9, a0
980 ; CHECK-NEXT: vsub.vv v8, v8, v9
981 ; CHECK-NEXT: lui a0, 209715
982 ; CHECK-NEXT: addi a0, a0, 819
983 ; CHECK-NEXT: vand.vx v9, v8, a0
984 ; CHECK-NEXT: vsrl.vi v8, v8, 2
985 ; CHECK-NEXT: vand.vx v8, v8, a0
986 ; CHECK-NEXT: vadd.vv v8, v9, v8
987 ; CHECK-NEXT: vsrl.vi v9, v8, 4
988 ; CHECK-NEXT: vadd.vv v8, v8, v9
989 ; CHECK-NEXT: lui a0, 61681
990 ; CHECK-NEXT: addi a0, a0, -241
991 ; CHECK-NEXT: vand.vx v8, v8, a0
992 ; CHECK-NEXT: lui a0, 4112
993 ; CHECK-NEXT: addi a0, a0, 257
994 ; CHECK-NEXT: vmul.vx v8, v8, a0
995 ; CHECK-NEXT: vsrl.vi v8, v8, 24
998 ; CHECK-ZVBB-LABEL: vp_cttz_nxv1i32_unmasked:
999 ; CHECK-ZVBB: # %bb.0:
1000 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
1001 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
1002 ; CHECK-ZVBB-NEXT: ret
1003 %v = call <vscale x 1 x i32> @llvm.vp.cttz.nxv1i32(<vscale x 1 x i32> %va, i1 false, <vscale x 1 x i1> splat (i1 true), i32 %evl)
1004 ret <vscale x 1 x i32> %v
1007 declare <vscale x 2 x i32> @llvm.vp.cttz.nxv2i32(<vscale x 2 x i32>, i1 immarg, <vscale x 2 x i1>, i32)
1009 define <vscale x 2 x i32> @vp_cttz_nxv2i32(<vscale x 2 x i32> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
1010 ; CHECK-LABEL: vp_cttz_nxv2i32:
1012 ; CHECK-NEXT: li a1, 1
1013 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
1014 ; CHECK-NEXT: vsub.vx v9, v8, a1, v0.t
1015 ; CHECK-NEXT: vnot.v v8, v8, v0.t
1016 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
1017 ; CHECK-NEXT: vsrl.vi v9, v8, 1, v0.t
1018 ; CHECK-NEXT: lui a0, 349525
1019 ; CHECK-NEXT: addi a0, a0, 1365
1020 ; CHECK-NEXT: vand.vx v9, v9, a0, v0.t
1021 ; CHECK-NEXT: vsub.vv v8, v8, v9, v0.t
1022 ; CHECK-NEXT: lui a0, 209715
1023 ; CHECK-NEXT: addi a0, a0, 819
1024 ; CHECK-NEXT: vand.vx v9, v8, a0, v0.t
1025 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
1026 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
1027 ; CHECK-NEXT: vadd.vv v8, v9, v8, v0.t
1028 ; CHECK-NEXT: vsrl.vi v9, v8, 4, v0.t
1029 ; CHECK-NEXT: vadd.vv v8, v8, v9, v0.t
1030 ; CHECK-NEXT: lui a0, 61681
1031 ; CHECK-NEXT: addi a0, a0, -241
1032 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
1033 ; CHECK-NEXT: lui a0, 4112
1034 ; CHECK-NEXT: addi a0, a0, 257
1035 ; CHECK-NEXT: vmul.vx v8, v8, a0, v0.t
1036 ; CHECK-NEXT: vsrl.vi v8, v8, 24, v0.t
1039 ; CHECK-ZVBB-LABEL: vp_cttz_nxv2i32:
1040 ; CHECK-ZVBB: # %bb.0:
1041 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m1, ta, ma
1042 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
1043 ; CHECK-ZVBB-NEXT: ret
1044 %v = call <vscale x 2 x i32> @llvm.vp.cttz.nxv2i32(<vscale x 2 x i32> %va, i1 false, <vscale x 2 x i1> %m, i32 %evl)
1045 ret <vscale x 2 x i32> %v
1048 define <vscale x 2 x i32> @vp_cttz_nxv2i32_unmasked(<vscale x 2 x i32> %va, i32 zeroext %evl) {
1049 ; CHECK-LABEL: vp_cttz_nxv2i32_unmasked:
1051 ; CHECK-NEXT: li a1, 1
1052 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
1053 ; CHECK-NEXT: vsub.vx v9, v8, a1
1054 ; CHECK-NEXT: vnot.v v8, v8
1055 ; CHECK-NEXT: vand.vv v8, v8, v9
1056 ; CHECK-NEXT: vsrl.vi v9, v8, 1
1057 ; CHECK-NEXT: lui a0, 349525
1058 ; CHECK-NEXT: addi a0, a0, 1365
1059 ; CHECK-NEXT: vand.vx v9, v9, a0
1060 ; CHECK-NEXT: vsub.vv v8, v8, v9
1061 ; CHECK-NEXT: lui a0, 209715
1062 ; CHECK-NEXT: addi a0, a0, 819
1063 ; CHECK-NEXT: vand.vx v9, v8, a0
1064 ; CHECK-NEXT: vsrl.vi v8, v8, 2
1065 ; CHECK-NEXT: vand.vx v8, v8, a0
1066 ; CHECK-NEXT: vadd.vv v8, v9, v8
1067 ; CHECK-NEXT: vsrl.vi v9, v8, 4
1068 ; CHECK-NEXT: vadd.vv v8, v8, v9
1069 ; CHECK-NEXT: lui a0, 61681
1070 ; CHECK-NEXT: addi a0, a0, -241
1071 ; CHECK-NEXT: vand.vx v8, v8, a0
1072 ; CHECK-NEXT: lui a0, 4112
1073 ; CHECK-NEXT: addi a0, a0, 257
1074 ; CHECK-NEXT: vmul.vx v8, v8, a0
1075 ; CHECK-NEXT: vsrl.vi v8, v8, 24
1078 ; CHECK-ZVBB-LABEL: vp_cttz_nxv2i32_unmasked:
1079 ; CHECK-ZVBB: # %bb.0:
1080 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m1, ta, ma
1081 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
1082 ; CHECK-ZVBB-NEXT: ret
1083 %v = call <vscale x 2 x i32> @llvm.vp.cttz.nxv2i32(<vscale x 2 x i32> %va, i1 false, <vscale x 2 x i1> splat (i1 true), i32 %evl)
1084 ret <vscale x 2 x i32> %v
1087 declare <vscale x 4 x i32> @llvm.vp.cttz.nxv4i32(<vscale x 4 x i32>, i1 immarg, <vscale x 4 x i1>, i32)
1089 define <vscale x 4 x i32> @vp_cttz_nxv4i32(<vscale x 4 x i32> %va, <vscale x 4 x i1> %m, i32 zeroext %evl) {
1090 ; CHECK-LABEL: vp_cttz_nxv4i32:
1092 ; CHECK-NEXT: li a1, 1
1093 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
1094 ; CHECK-NEXT: vsub.vx v10, v8, a1, v0.t
1095 ; CHECK-NEXT: vnot.v v8, v8, v0.t
1096 ; CHECK-NEXT: vand.vv v8, v8, v10, v0.t
1097 ; CHECK-NEXT: vsrl.vi v10, v8, 1, v0.t
1098 ; CHECK-NEXT: lui a0, 349525
1099 ; CHECK-NEXT: addi a0, a0, 1365
1100 ; CHECK-NEXT: vand.vx v10, v10, a0, v0.t
1101 ; CHECK-NEXT: vsub.vv v8, v8, v10, v0.t
1102 ; CHECK-NEXT: lui a0, 209715
1103 ; CHECK-NEXT: addi a0, a0, 819
1104 ; CHECK-NEXT: vand.vx v10, v8, a0, v0.t
1105 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
1106 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
1107 ; CHECK-NEXT: vadd.vv v8, v10, v8, v0.t
1108 ; CHECK-NEXT: vsrl.vi v10, v8, 4, v0.t
1109 ; CHECK-NEXT: vadd.vv v8, v8, v10, v0.t
1110 ; CHECK-NEXT: lui a0, 61681
1111 ; CHECK-NEXT: addi a0, a0, -241
1112 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
1113 ; CHECK-NEXT: lui a0, 4112
1114 ; CHECK-NEXT: addi a0, a0, 257
1115 ; CHECK-NEXT: vmul.vx v8, v8, a0, v0.t
1116 ; CHECK-NEXT: vsrl.vi v8, v8, 24, v0.t
1119 ; CHECK-ZVBB-LABEL: vp_cttz_nxv4i32:
1120 ; CHECK-ZVBB: # %bb.0:
1121 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m2, ta, ma
1122 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
1123 ; CHECK-ZVBB-NEXT: ret
1124 %v = call <vscale x 4 x i32> @llvm.vp.cttz.nxv4i32(<vscale x 4 x i32> %va, i1 false, <vscale x 4 x i1> %m, i32 %evl)
1125 ret <vscale x 4 x i32> %v
1128 define <vscale x 4 x i32> @vp_cttz_nxv4i32_unmasked(<vscale x 4 x i32> %va, i32 zeroext %evl) {
1129 ; CHECK-LABEL: vp_cttz_nxv4i32_unmasked:
1131 ; CHECK-NEXT: li a1, 1
1132 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
1133 ; CHECK-NEXT: vsub.vx v10, v8, a1
1134 ; CHECK-NEXT: vnot.v v8, v8
1135 ; CHECK-NEXT: vand.vv v8, v8, v10
1136 ; CHECK-NEXT: vsrl.vi v10, v8, 1
1137 ; CHECK-NEXT: lui a0, 349525
1138 ; CHECK-NEXT: addi a0, a0, 1365
1139 ; CHECK-NEXT: vand.vx v10, v10, a0
1140 ; CHECK-NEXT: vsub.vv v8, v8, v10
1141 ; CHECK-NEXT: lui a0, 209715
1142 ; CHECK-NEXT: addi a0, a0, 819
1143 ; CHECK-NEXT: vand.vx v10, v8, a0
1144 ; CHECK-NEXT: vsrl.vi v8, v8, 2
1145 ; CHECK-NEXT: vand.vx v8, v8, a0
1146 ; CHECK-NEXT: vadd.vv v8, v10, v8
1147 ; CHECK-NEXT: vsrl.vi v10, v8, 4
1148 ; CHECK-NEXT: vadd.vv v8, v8, v10
1149 ; CHECK-NEXT: lui a0, 61681
1150 ; CHECK-NEXT: addi a0, a0, -241
1151 ; CHECK-NEXT: vand.vx v8, v8, a0
1152 ; CHECK-NEXT: lui a0, 4112
1153 ; CHECK-NEXT: addi a0, a0, 257
1154 ; CHECK-NEXT: vmul.vx v8, v8, a0
1155 ; CHECK-NEXT: vsrl.vi v8, v8, 24
1158 ; CHECK-ZVBB-LABEL: vp_cttz_nxv4i32_unmasked:
1159 ; CHECK-ZVBB: # %bb.0:
1160 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m2, ta, ma
1161 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
1162 ; CHECK-ZVBB-NEXT: ret
1163 %v = call <vscale x 4 x i32> @llvm.vp.cttz.nxv4i32(<vscale x 4 x i32> %va, i1 false, <vscale x 4 x i1> splat (i1 true), i32 %evl)
1164 ret <vscale x 4 x i32> %v
1167 declare <vscale x 8 x i32> @llvm.vp.cttz.nxv8i32(<vscale x 8 x i32>, i1 immarg, <vscale x 8 x i1>, i32)
1169 define <vscale x 8 x i32> @vp_cttz_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i1> %m, i32 zeroext %evl) {
1170 ; CHECK-LABEL: vp_cttz_nxv8i32:
1172 ; CHECK-NEXT: li a1, 1
1173 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
1174 ; CHECK-NEXT: vsub.vx v12, v8, a1, v0.t
1175 ; CHECK-NEXT: vnot.v v8, v8, v0.t
1176 ; CHECK-NEXT: vand.vv v8, v8, v12, v0.t
1177 ; CHECK-NEXT: vsrl.vi v12, v8, 1, v0.t
1178 ; CHECK-NEXT: lui a0, 349525
1179 ; CHECK-NEXT: addi a0, a0, 1365
1180 ; CHECK-NEXT: vand.vx v12, v12, a0, v0.t
1181 ; CHECK-NEXT: vsub.vv v8, v8, v12, v0.t
1182 ; CHECK-NEXT: lui a0, 209715
1183 ; CHECK-NEXT: addi a0, a0, 819
1184 ; CHECK-NEXT: vand.vx v12, v8, a0, v0.t
1185 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
1186 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
1187 ; CHECK-NEXT: vadd.vv v8, v12, v8, v0.t
1188 ; CHECK-NEXT: vsrl.vi v12, v8, 4, v0.t
1189 ; CHECK-NEXT: vadd.vv v8, v8, v12, v0.t
1190 ; CHECK-NEXT: lui a0, 61681
1191 ; CHECK-NEXT: addi a0, a0, -241
1192 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
1193 ; CHECK-NEXT: lui a0, 4112
1194 ; CHECK-NEXT: addi a0, a0, 257
1195 ; CHECK-NEXT: vmul.vx v8, v8, a0, v0.t
1196 ; CHECK-NEXT: vsrl.vi v8, v8, 24, v0.t
1199 ; CHECK-ZVBB-LABEL: vp_cttz_nxv8i32:
1200 ; CHECK-ZVBB: # %bb.0:
1201 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m4, ta, ma
1202 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
1203 ; CHECK-ZVBB-NEXT: ret
1204 %v = call <vscale x 8 x i32> @llvm.vp.cttz.nxv8i32(<vscale x 8 x i32> %va, i1 false, <vscale x 8 x i1> %m, i32 %evl)
1205 ret <vscale x 8 x i32> %v
1208 define <vscale x 8 x i32> @vp_cttz_nxv8i32_unmasked(<vscale x 8 x i32> %va, i32 zeroext %evl) {
1209 ; CHECK-LABEL: vp_cttz_nxv8i32_unmasked:
1211 ; CHECK-NEXT: li a1, 1
1212 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
1213 ; CHECK-NEXT: vsub.vx v12, v8, a1
1214 ; CHECK-NEXT: vnot.v v8, v8
1215 ; CHECK-NEXT: vand.vv v8, v8, v12
1216 ; CHECK-NEXT: vsrl.vi v12, v8, 1
1217 ; CHECK-NEXT: lui a0, 349525
1218 ; CHECK-NEXT: addi a0, a0, 1365
1219 ; CHECK-NEXT: vand.vx v12, v12, a0
1220 ; CHECK-NEXT: vsub.vv v8, v8, v12
1221 ; CHECK-NEXT: lui a0, 209715
1222 ; CHECK-NEXT: addi a0, a0, 819
1223 ; CHECK-NEXT: vand.vx v12, v8, a0
1224 ; CHECK-NEXT: vsrl.vi v8, v8, 2
1225 ; CHECK-NEXT: vand.vx v8, v8, a0
1226 ; CHECK-NEXT: vadd.vv v8, v12, v8
1227 ; CHECK-NEXT: vsrl.vi v12, v8, 4
1228 ; CHECK-NEXT: vadd.vv v8, v8, v12
1229 ; CHECK-NEXT: lui a0, 61681
1230 ; CHECK-NEXT: addi a0, a0, -241
1231 ; CHECK-NEXT: vand.vx v8, v8, a0
1232 ; CHECK-NEXT: lui a0, 4112
1233 ; CHECK-NEXT: addi a0, a0, 257
1234 ; CHECK-NEXT: vmul.vx v8, v8, a0
1235 ; CHECK-NEXT: vsrl.vi v8, v8, 24
1238 ; CHECK-ZVBB-LABEL: vp_cttz_nxv8i32_unmasked:
1239 ; CHECK-ZVBB: # %bb.0:
1240 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m4, ta, ma
1241 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
1242 ; CHECK-ZVBB-NEXT: ret
1243 %v = call <vscale x 8 x i32> @llvm.vp.cttz.nxv8i32(<vscale x 8 x i32> %va, i1 false, <vscale x 8 x i1> splat (i1 true), i32 %evl)
1244 ret <vscale x 8 x i32> %v
1247 declare <vscale x 16 x i32> @llvm.vp.cttz.nxv16i32(<vscale x 16 x i32>, i1 immarg, <vscale x 16 x i1>, i32)
1249 define <vscale x 16 x i32> @vp_cttz_nxv16i32(<vscale x 16 x i32> %va, <vscale x 16 x i1> %m, i32 zeroext %evl) {
1250 ; CHECK-LABEL: vp_cttz_nxv16i32:
1252 ; CHECK-NEXT: li a1, 1
1253 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
1254 ; CHECK-NEXT: vsub.vx v16, v8, a1, v0.t
1255 ; CHECK-NEXT: vnot.v v8, v8, v0.t
1256 ; CHECK-NEXT: vand.vv v8, v8, v16, v0.t
1257 ; CHECK-NEXT: vsrl.vi v16, v8, 1, v0.t
1258 ; CHECK-NEXT: lui a0, 349525
1259 ; CHECK-NEXT: addi a0, a0, 1365
1260 ; CHECK-NEXT: vand.vx v16, v16, a0, v0.t
1261 ; CHECK-NEXT: vsub.vv v8, v8, v16, v0.t
1262 ; CHECK-NEXT: lui a0, 209715
1263 ; CHECK-NEXT: addi a0, a0, 819
1264 ; CHECK-NEXT: vand.vx v16, v8, a0, v0.t
1265 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
1266 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
1267 ; CHECK-NEXT: vadd.vv v8, v16, v8, v0.t
1268 ; CHECK-NEXT: vsrl.vi v16, v8, 4, v0.t
1269 ; CHECK-NEXT: vadd.vv v8, v8, v16, v0.t
1270 ; CHECK-NEXT: lui a0, 61681
1271 ; CHECK-NEXT: addi a0, a0, -241
1272 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
1273 ; CHECK-NEXT: lui a0, 4112
1274 ; CHECK-NEXT: addi a0, a0, 257
1275 ; CHECK-NEXT: vmul.vx v8, v8, a0, v0.t
1276 ; CHECK-NEXT: vsrl.vi v8, v8, 24, v0.t
1279 ; CHECK-ZVBB-LABEL: vp_cttz_nxv16i32:
1280 ; CHECK-ZVBB: # %bb.0:
1281 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m8, ta, ma
1282 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
1283 ; CHECK-ZVBB-NEXT: ret
1284 %v = call <vscale x 16 x i32> @llvm.vp.cttz.nxv16i32(<vscale x 16 x i32> %va, i1 false, <vscale x 16 x i1> %m, i32 %evl)
1285 ret <vscale x 16 x i32> %v
1288 define <vscale x 16 x i32> @vp_cttz_nxv16i32_unmasked(<vscale x 16 x i32> %va, i32 zeroext %evl) {
1289 ; CHECK-LABEL: vp_cttz_nxv16i32_unmasked:
1291 ; CHECK-NEXT: li a1, 1
1292 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
1293 ; CHECK-NEXT: vsub.vx v16, v8, a1
1294 ; CHECK-NEXT: vnot.v v8, v8
1295 ; CHECK-NEXT: vand.vv v8, v8, v16
1296 ; CHECK-NEXT: vsrl.vi v16, v8, 1
1297 ; CHECK-NEXT: lui a0, 349525
1298 ; CHECK-NEXT: addi a0, a0, 1365
1299 ; CHECK-NEXT: vand.vx v16, v16, a0
1300 ; CHECK-NEXT: vsub.vv v8, v8, v16
1301 ; CHECK-NEXT: lui a0, 209715
1302 ; CHECK-NEXT: addi a0, a0, 819
1303 ; CHECK-NEXT: vand.vx v16, v8, a0
1304 ; CHECK-NEXT: vsrl.vi v8, v8, 2
1305 ; CHECK-NEXT: vand.vx v8, v8, a0
1306 ; CHECK-NEXT: vadd.vv v8, v16, v8
1307 ; CHECK-NEXT: vsrl.vi v16, v8, 4
1308 ; CHECK-NEXT: vadd.vv v8, v8, v16
1309 ; CHECK-NEXT: lui a0, 61681
1310 ; CHECK-NEXT: addi a0, a0, -241
1311 ; CHECK-NEXT: vand.vx v8, v8, a0
1312 ; CHECK-NEXT: lui a0, 4112
1313 ; CHECK-NEXT: addi a0, a0, 257
1314 ; CHECK-NEXT: vmul.vx v8, v8, a0
1315 ; CHECK-NEXT: vsrl.vi v8, v8, 24
1318 ; CHECK-ZVBB-LABEL: vp_cttz_nxv16i32_unmasked:
1319 ; CHECK-ZVBB: # %bb.0:
1320 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m8, ta, ma
1321 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
1322 ; CHECK-ZVBB-NEXT: ret
1323 %v = call <vscale x 16 x i32> @llvm.vp.cttz.nxv16i32(<vscale x 16 x i32> %va, i1 false, <vscale x 16 x i1> splat (i1 true), i32 %evl)
1324 ret <vscale x 16 x i32> %v
1327 declare <vscale x 1 x i64> @llvm.vp.cttz.nxv1i64(<vscale x 1 x i64>, i1 immarg, <vscale x 1 x i1>, i32)
1329 define <vscale x 1 x i64> @vp_cttz_nxv1i64(<vscale x 1 x i64> %va, <vscale x 1 x i1> %m, i32 zeroext %evl) {
1330 ; RV32-LABEL: vp_cttz_nxv1i64:
1332 ; RV32-NEXT: li a1, 1
1333 ; RV32-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1334 ; RV32-NEXT: vsub.vx v9, v8, a1, v0.t
1335 ; RV32-NEXT: vnot.v v8, v8, v0.t
1336 ; RV32-NEXT: vand.vv v8, v8, v9, v0.t
1337 ; RV32-NEXT: vsrl.vi v9, v8, 1, v0.t
1338 ; RV32-NEXT: lui a1, 349525
1339 ; RV32-NEXT: addi a1, a1, 1365
1340 ; RV32-NEXT: vsetvli a2, zero, e32, m1, ta, ma
1341 ; RV32-NEXT: vmv.v.x v10, a1
1342 ; RV32-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1343 ; RV32-NEXT: vand.vv v9, v9, v10, v0.t
1344 ; RV32-NEXT: vsub.vv v8, v8, v9, v0.t
1345 ; RV32-NEXT: lui a1, 209715
1346 ; RV32-NEXT: addi a1, a1, 819
1347 ; RV32-NEXT: vsetvli a2, zero, e32, m1, ta, ma
1348 ; RV32-NEXT: vmv.v.x v9, a1
1349 ; RV32-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1350 ; RV32-NEXT: vand.vv v10, v8, v9, v0.t
1351 ; RV32-NEXT: vsrl.vi v8, v8, 2, v0.t
1352 ; RV32-NEXT: vand.vv v8, v8, v9, v0.t
1353 ; RV32-NEXT: vadd.vv v8, v10, v8, v0.t
1354 ; RV32-NEXT: vsrl.vi v9, v8, 4, v0.t
1355 ; RV32-NEXT: vadd.vv v8, v8, v9, v0.t
1356 ; RV32-NEXT: lui a1, 61681
1357 ; RV32-NEXT: addi a1, a1, -241
1358 ; RV32-NEXT: vsetvli a2, zero, e32, m1, ta, ma
1359 ; RV32-NEXT: vmv.v.x v9, a1
1360 ; RV32-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1361 ; RV32-NEXT: vand.vv v8, v8, v9, v0.t
1362 ; RV32-NEXT: lui a1, 4112
1363 ; RV32-NEXT: addi a1, a1, 257
1364 ; RV32-NEXT: vsetvli a2, zero, e32, m1, ta, ma
1365 ; RV32-NEXT: vmv.v.x v9, a1
1366 ; RV32-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1367 ; RV32-NEXT: vmul.vv v8, v8, v9, v0.t
1368 ; RV32-NEXT: li a0, 56
1369 ; RV32-NEXT: vsrl.vx v8, v8, a0, v0.t
1372 ; RV64-LABEL: vp_cttz_nxv1i64:
1374 ; RV64-NEXT: li a1, 1
1375 ; RV64-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1376 ; RV64-NEXT: vsub.vx v9, v8, a1, v0.t
1377 ; RV64-NEXT: vnot.v v8, v8, v0.t
1378 ; RV64-NEXT: vand.vv v8, v8, v9, v0.t
1379 ; RV64-NEXT: vsrl.vi v9, v8, 1, v0.t
1380 ; RV64-NEXT: lui a0, 349525
1381 ; RV64-NEXT: addiw a0, a0, 1365
1382 ; RV64-NEXT: slli a1, a0, 32
1383 ; RV64-NEXT: add a0, a0, a1
1384 ; RV64-NEXT: vand.vx v9, v9, a0, v0.t
1385 ; RV64-NEXT: vsub.vv v8, v8, v9, v0.t
1386 ; RV64-NEXT: lui a0, 209715
1387 ; RV64-NEXT: addiw a0, a0, 819
1388 ; RV64-NEXT: slli a1, a0, 32
1389 ; RV64-NEXT: add a0, a0, a1
1390 ; RV64-NEXT: vand.vx v9, v8, a0, v0.t
1391 ; RV64-NEXT: vsrl.vi v8, v8, 2, v0.t
1392 ; RV64-NEXT: vand.vx v8, v8, a0, v0.t
1393 ; RV64-NEXT: vadd.vv v8, v9, v8, v0.t
1394 ; RV64-NEXT: vsrl.vi v9, v8, 4, v0.t
1395 ; RV64-NEXT: vadd.vv v8, v8, v9, v0.t
1396 ; RV64-NEXT: lui a0, 61681
1397 ; RV64-NEXT: addiw a0, a0, -241
1398 ; RV64-NEXT: slli a1, a0, 32
1399 ; RV64-NEXT: add a0, a0, a1
1400 ; RV64-NEXT: vand.vx v8, v8, a0, v0.t
1401 ; RV64-NEXT: lui a0, 4112
1402 ; RV64-NEXT: addiw a0, a0, 257
1403 ; RV64-NEXT: slli a1, a0, 32
1404 ; RV64-NEXT: add a0, a0, a1
1405 ; RV64-NEXT: vmul.vx v8, v8, a0, v0.t
1406 ; RV64-NEXT: li a0, 56
1407 ; RV64-NEXT: vsrl.vx v8, v8, a0, v0.t
1410 ; CHECK-ZVBB-LABEL: vp_cttz_nxv1i64:
1411 ; CHECK-ZVBB: # %bb.0:
1412 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1413 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
1414 ; CHECK-ZVBB-NEXT: ret
1415 %v = call <vscale x 1 x i64> @llvm.vp.cttz.nxv1i64(<vscale x 1 x i64> %va, i1 false, <vscale x 1 x i1> %m, i32 %evl)
1416 ret <vscale x 1 x i64> %v
1419 define <vscale x 1 x i64> @vp_cttz_nxv1i64_unmasked(<vscale x 1 x i64> %va, i32 zeroext %evl) {
1420 ; RV32-LABEL: vp_cttz_nxv1i64_unmasked:
1422 ; RV32-NEXT: li a1, 1
1423 ; RV32-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1424 ; RV32-NEXT: vsub.vx v9, v8, a1
1425 ; RV32-NEXT: vnot.v v8, v8
1426 ; RV32-NEXT: vand.vv v8, v8, v9
1427 ; RV32-NEXT: vsrl.vi v9, v8, 1
1428 ; RV32-NEXT: lui a1, 349525
1429 ; RV32-NEXT: addi a1, a1, 1365
1430 ; RV32-NEXT: vsetvli a2, zero, e32, m1, ta, ma
1431 ; RV32-NEXT: vmv.v.x v10, a1
1432 ; RV32-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1433 ; RV32-NEXT: vand.vv v9, v9, v10
1434 ; RV32-NEXT: vsub.vv v8, v8, v9
1435 ; RV32-NEXT: lui a1, 209715
1436 ; RV32-NEXT: addi a1, a1, 819
1437 ; RV32-NEXT: vsetvli a2, zero, e32, m1, ta, ma
1438 ; RV32-NEXT: vmv.v.x v9, a1
1439 ; RV32-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1440 ; RV32-NEXT: vand.vv v10, v8, v9
1441 ; RV32-NEXT: vsrl.vi v8, v8, 2
1442 ; RV32-NEXT: vand.vv v8, v8, v9
1443 ; RV32-NEXT: vadd.vv v8, v10, v8
1444 ; RV32-NEXT: vsrl.vi v9, v8, 4
1445 ; RV32-NEXT: vadd.vv v8, v8, v9
1446 ; RV32-NEXT: lui a1, 61681
1447 ; RV32-NEXT: addi a1, a1, -241
1448 ; RV32-NEXT: vsetvli a2, zero, e32, m1, ta, ma
1449 ; RV32-NEXT: vmv.v.x v9, a1
1450 ; RV32-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1451 ; RV32-NEXT: vand.vv v8, v8, v9
1452 ; RV32-NEXT: lui a1, 4112
1453 ; RV32-NEXT: addi a1, a1, 257
1454 ; RV32-NEXT: vsetvli a2, zero, e32, m1, ta, ma
1455 ; RV32-NEXT: vmv.v.x v9, a1
1456 ; RV32-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1457 ; RV32-NEXT: vmul.vv v8, v8, v9
1458 ; RV32-NEXT: li a0, 56
1459 ; RV32-NEXT: vsrl.vx v8, v8, a0
1462 ; RV64-LABEL: vp_cttz_nxv1i64_unmasked:
1464 ; RV64-NEXT: li a1, 1
1465 ; RV64-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1466 ; RV64-NEXT: vsub.vx v9, v8, a1
1467 ; RV64-NEXT: vnot.v v8, v8
1468 ; RV64-NEXT: vand.vv v8, v8, v9
1469 ; RV64-NEXT: vsrl.vi v9, v8, 1
1470 ; RV64-NEXT: lui a0, 349525
1471 ; RV64-NEXT: addiw a0, a0, 1365
1472 ; RV64-NEXT: slli a1, a0, 32
1473 ; RV64-NEXT: add a0, a0, a1
1474 ; RV64-NEXT: vand.vx v9, v9, a0
1475 ; RV64-NEXT: vsub.vv v8, v8, v9
1476 ; RV64-NEXT: lui a0, 209715
1477 ; RV64-NEXT: addiw a0, a0, 819
1478 ; RV64-NEXT: slli a1, a0, 32
1479 ; RV64-NEXT: add a0, a0, a1
1480 ; RV64-NEXT: vand.vx v9, v8, a0
1481 ; RV64-NEXT: vsrl.vi v8, v8, 2
1482 ; RV64-NEXT: vand.vx v8, v8, a0
1483 ; RV64-NEXT: vadd.vv v8, v9, v8
1484 ; RV64-NEXT: vsrl.vi v9, v8, 4
1485 ; RV64-NEXT: vadd.vv v8, v8, v9
1486 ; RV64-NEXT: lui a0, 61681
1487 ; RV64-NEXT: addiw a0, a0, -241
1488 ; RV64-NEXT: slli a1, a0, 32
1489 ; RV64-NEXT: add a0, a0, a1
1490 ; RV64-NEXT: vand.vx v8, v8, a0
1491 ; RV64-NEXT: lui a0, 4112
1492 ; RV64-NEXT: addiw a0, a0, 257
1493 ; RV64-NEXT: slli a1, a0, 32
1494 ; RV64-NEXT: add a0, a0, a1
1495 ; RV64-NEXT: vmul.vx v8, v8, a0
1496 ; RV64-NEXT: li a0, 56
1497 ; RV64-NEXT: vsrl.vx v8, v8, a0
1500 ; CHECK-ZVBB-LABEL: vp_cttz_nxv1i64_unmasked:
1501 ; CHECK-ZVBB: # %bb.0:
1502 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1503 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
1504 ; CHECK-ZVBB-NEXT: ret
1505 %v = call <vscale x 1 x i64> @llvm.vp.cttz.nxv1i64(<vscale x 1 x i64> %va, i1 false, <vscale x 1 x i1> splat (i1 true), i32 %evl)
1506 ret <vscale x 1 x i64> %v
1509 declare <vscale x 2 x i64> @llvm.vp.cttz.nxv2i64(<vscale x 2 x i64>, i1 immarg, <vscale x 2 x i1>, i32)
1511 define <vscale x 2 x i64> @vp_cttz_nxv2i64(<vscale x 2 x i64> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
1512 ; RV32-LABEL: vp_cttz_nxv2i64:
1514 ; RV32-NEXT: li a1, 1
1515 ; RV32-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1516 ; RV32-NEXT: vsub.vx v10, v8, a1, v0.t
1517 ; RV32-NEXT: vnot.v v8, v8, v0.t
1518 ; RV32-NEXT: vand.vv v8, v8, v10, v0.t
1519 ; RV32-NEXT: vsrl.vi v10, v8, 1, v0.t
1520 ; RV32-NEXT: lui a1, 349525
1521 ; RV32-NEXT: addi a1, a1, 1365
1522 ; RV32-NEXT: vsetvli a2, zero, e32, m2, ta, ma
1523 ; RV32-NEXT: vmv.v.x v12, a1
1524 ; RV32-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1525 ; RV32-NEXT: vand.vv v10, v10, v12, v0.t
1526 ; RV32-NEXT: vsub.vv v8, v8, v10, v0.t
1527 ; RV32-NEXT: lui a1, 209715
1528 ; RV32-NEXT: addi a1, a1, 819
1529 ; RV32-NEXT: vsetvli a2, zero, e32, m2, ta, ma
1530 ; RV32-NEXT: vmv.v.x v10, a1
1531 ; RV32-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1532 ; RV32-NEXT: vand.vv v12, v8, v10, v0.t
1533 ; RV32-NEXT: vsrl.vi v8, v8, 2, v0.t
1534 ; RV32-NEXT: vand.vv v8, v8, v10, v0.t
1535 ; RV32-NEXT: vadd.vv v8, v12, v8, v0.t
1536 ; RV32-NEXT: vsrl.vi v10, v8, 4, v0.t
1537 ; RV32-NEXT: vadd.vv v8, v8, v10, v0.t
1538 ; RV32-NEXT: lui a1, 61681
1539 ; RV32-NEXT: addi a1, a1, -241
1540 ; RV32-NEXT: vsetvli a2, zero, e32, m2, ta, ma
1541 ; RV32-NEXT: vmv.v.x v10, a1
1542 ; RV32-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1543 ; RV32-NEXT: vand.vv v8, v8, v10, v0.t
1544 ; RV32-NEXT: lui a1, 4112
1545 ; RV32-NEXT: addi a1, a1, 257
1546 ; RV32-NEXT: vsetvli a2, zero, e32, m2, ta, ma
1547 ; RV32-NEXT: vmv.v.x v10, a1
1548 ; RV32-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1549 ; RV32-NEXT: vmul.vv v8, v8, v10, v0.t
1550 ; RV32-NEXT: li a0, 56
1551 ; RV32-NEXT: vsrl.vx v8, v8, a0, v0.t
1554 ; RV64-LABEL: vp_cttz_nxv2i64:
1556 ; RV64-NEXT: li a1, 1
1557 ; RV64-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1558 ; RV64-NEXT: vsub.vx v10, v8, a1, v0.t
1559 ; RV64-NEXT: vnot.v v8, v8, v0.t
1560 ; RV64-NEXT: vand.vv v8, v8, v10, v0.t
1561 ; RV64-NEXT: vsrl.vi v10, v8, 1, v0.t
1562 ; RV64-NEXT: lui a0, 349525
1563 ; RV64-NEXT: addiw a0, a0, 1365
1564 ; RV64-NEXT: slli a1, a0, 32
1565 ; RV64-NEXT: add a0, a0, a1
1566 ; RV64-NEXT: vand.vx v10, v10, a0, v0.t
1567 ; RV64-NEXT: vsub.vv v8, v8, v10, v0.t
1568 ; RV64-NEXT: lui a0, 209715
1569 ; RV64-NEXT: addiw a0, a0, 819
1570 ; RV64-NEXT: slli a1, a0, 32
1571 ; RV64-NEXT: add a0, a0, a1
1572 ; RV64-NEXT: vand.vx v10, v8, a0, v0.t
1573 ; RV64-NEXT: vsrl.vi v8, v8, 2, v0.t
1574 ; RV64-NEXT: vand.vx v8, v8, a0, v0.t
1575 ; RV64-NEXT: vadd.vv v8, v10, v8, v0.t
1576 ; RV64-NEXT: vsrl.vi v10, v8, 4, v0.t
1577 ; RV64-NEXT: vadd.vv v8, v8, v10, v0.t
1578 ; RV64-NEXT: lui a0, 61681
1579 ; RV64-NEXT: addiw a0, a0, -241
1580 ; RV64-NEXT: slli a1, a0, 32
1581 ; RV64-NEXT: add a0, a0, a1
1582 ; RV64-NEXT: vand.vx v8, v8, a0, v0.t
1583 ; RV64-NEXT: lui a0, 4112
1584 ; RV64-NEXT: addiw a0, a0, 257
1585 ; RV64-NEXT: slli a1, a0, 32
1586 ; RV64-NEXT: add a0, a0, a1
1587 ; RV64-NEXT: vmul.vx v8, v8, a0, v0.t
1588 ; RV64-NEXT: li a0, 56
1589 ; RV64-NEXT: vsrl.vx v8, v8, a0, v0.t
1592 ; CHECK-ZVBB-LABEL: vp_cttz_nxv2i64:
1593 ; CHECK-ZVBB: # %bb.0:
1594 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1595 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
1596 ; CHECK-ZVBB-NEXT: ret
1597 %v = call <vscale x 2 x i64> @llvm.vp.cttz.nxv2i64(<vscale x 2 x i64> %va, i1 false, <vscale x 2 x i1> %m, i32 %evl)
1598 ret <vscale x 2 x i64> %v
1601 define <vscale x 2 x i64> @vp_cttz_nxv2i64_unmasked(<vscale x 2 x i64> %va, i32 zeroext %evl) {
1602 ; RV32-LABEL: vp_cttz_nxv2i64_unmasked:
1604 ; RV32-NEXT: li a1, 1
1605 ; RV32-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1606 ; RV32-NEXT: vsub.vx v10, v8, a1
1607 ; RV32-NEXT: vnot.v v8, v8
1608 ; RV32-NEXT: vand.vv v8, v8, v10
1609 ; RV32-NEXT: vsrl.vi v10, v8, 1
1610 ; RV32-NEXT: lui a1, 349525
1611 ; RV32-NEXT: addi a1, a1, 1365
1612 ; RV32-NEXT: vsetvli a2, zero, e32, m2, ta, ma
1613 ; RV32-NEXT: vmv.v.x v12, a1
1614 ; RV32-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1615 ; RV32-NEXT: vand.vv v10, v10, v12
1616 ; RV32-NEXT: vsub.vv v8, v8, v10
1617 ; RV32-NEXT: lui a1, 209715
1618 ; RV32-NEXT: addi a1, a1, 819
1619 ; RV32-NEXT: vsetvli a2, zero, e32, m2, ta, ma
1620 ; RV32-NEXT: vmv.v.x v10, a1
1621 ; RV32-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1622 ; RV32-NEXT: vand.vv v12, v8, v10
1623 ; RV32-NEXT: vsrl.vi v8, v8, 2
1624 ; RV32-NEXT: vand.vv v8, v8, v10
1625 ; RV32-NEXT: vadd.vv v8, v12, v8
1626 ; RV32-NEXT: vsrl.vi v10, v8, 4
1627 ; RV32-NEXT: vadd.vv v8, v8, v10
1628 ; RV32-NEXT: lui a1, 61681
1629 ; RV32-NEXT: addi a1, a1, -241
1630 ; RV32-NEXT: vsetvli a2, zero, e32, m2, ta, ma
1631 ; RV32-NEXT: vmv.v.x v10, a1
1632 ; RV32-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1633 ; RV32-NEXT: vand.vv v8, v8, v10
1634 ; RV32-NEXT: lui a1, 4112
1635 ; RV32-NEXT: addi a1, a1, 257
1636 ; RV32-NEXT: vsetvli a2, zero, e32, m2, ta, ma
1637 ; RV32-NEXT: vmv.v.x v10, a1
1638 ; RV32-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1639 ; RV32-NEXT: vmul.vv v8, v8, v10
1640 ; RV32-NEXT: li a0, 56
1641 ; RV32-NEXT: vsrl.vx v8, v8, a0
1644 ; RV64-LABEL: vp_cttz_nxv2i64_unmasked:
1646 ; RV64-NEXT: li a1, 1
1647 ; RV64-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1648 ; RV64-NEXT: vsub.vx v10, v8, a1
1649 ; RV64-NEXT: vnot.v v8, v8
1650 ; RV64-NEXT: vand.vv v8, v8, v10
1651 ; RV64-NEXT: vsrl.vi v10, v8, 1
1652 ; RV64-NEXT: lui a0, 349525
1653 ; RV64-NEXT: addiw a0, a0, 1365
1654 ; RV64-NEXT: slli a1, a0, 32
1655 ; RV64-NEXT: add a0, a0, a1
1656 ; RV64-NEXT: vand.vx v10, v10, a0
1657 ; RV64-NEXT: vsub.vv v8, v8, v10
1658 ; RV64-NEXT: lui a0, 209715
1659 ; RV64-NEXT: addiw a0, a0, 819
1660 ; RV64-NEXT: slli a1, a0, 32
1661 ; RV64-NEXT: add a0, a0, a1
1662 ; RV64-NEXT: vand.vx v10, v8, a0
1663 ; RV64-NEXT: vsrl.vi v8, v8, 2
1664 ; RV64-NEXT: vand.vx v8, v8, a0
1665 ; RV64-NEXT: vadd.vv v8, v10, v8
1666 ; RV64-NEXT: vsrl.vi v10, v8, 4
1667 ; RV64-NEXT: vadd.vv v8, v8, v10
1668 ; RV64-NEXT: lui a0, 61681
1669 ; RV64-NEXT: addiw a0, a0, -241
1670 ; RV64-NEXT: slli a1, a0, 32
1671 ; RV64-NEXT: add a0, a0, a1
1672 ; RV64-NEXT: vand.vx v8, v8, a0
1673 ; RV64-NEXT: lui a0, 4112
1674 ; RV64-NEXT: addiw a0, a0, 257
1675 ; RV64-NEXT: slli a1, a0, 32
1676 ; RV64-NEXT: add a0, a0, a1
1677 ; RV64-NEXT: vmul.vx v8, v8, a0
1678 ; RV64-NEXT: li a0, 56
1679 ; RV64-NEXT: vsrl.vx v8, v8, a0
1682 ; CHECK-ZVBB-LABEL: vp_cttz_nxv2i64_unmasked:
1683 ; CHECK-ZVBB: # %bb.0:
1684 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1685 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
1686 ; CHECK-ZVBB-NEXT: ret
1687 %v = call <vscale x 2 x i64> @llvm.vp.cttz.nxv2i64(<vscale x 2 x i64> %va, i1 false, <vscale x 2 x i1> splat (i1 true), i32 %evl)
1688 ret <vscale x 2 x i64> %v
1691 declare <vscale x 4 x i64> @llvm.vp.cttz.nxv4i64(<vscale x 4 x i64>, i1 immarg, <vscale x 4 x i1>, i32)
1693 define <vscale x 4 x i64> @vp_cttz_nxv4i64(<vscale x 4 x i64> %va, <vscale x 4 x i1> %m, i32 zeroext %evl) {
1694 ; RV32-LABEL: vp_cttz_nxv4i64:
1696 ; RV32-NEXT: li a1, 1
1697 ; RV32-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1698 ; RV32-NEXT: vsub.vx v12, v8, a1, v0.t
1699 ; RV32-NEXT: vnot.v v8, v8, v0.t
1700 ; RV32-NEXT: vand.vv v8, v8, v12, v0.t
1701 ; RV32-NEXT: vsrl.vi v12, v8, 1, v0.t
1702 ; RV32-NEXT: lui a1, 349525
1703 ; RV32-NEXT: addi a1, a1, 1365
1704 ; RV32-NEXT: vsetvli a2, zero, e32, m4, ta, ma
1705 ; RV32-NEXT: vmv.v.x v16, a1
1706 ; RV32-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1707 ; RV32-NEXT: vand.vv v12, v12, v16, v0.t
1708 ; RV32-NEXT: vsub.vv v8, v8, v12, v0.t
1709 ; RV32-NEXT: lui a1, 209715
1710 ; RV32-NEXT: addi a1, a1, 819
1711 ; RV32-NEXT: vsetvli a2, zero, e32, m4, ta, ma
1712 ; RV32-NEXT: vmv.v.x v12, a1
1713 ; RV32-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1714 ; RV32-NEXT: vand.vv v16, v8, v12, v0.t
1715 ; RV32-NEXT: vsrl.vi v8, v8, 2, v0.t
1716 ; RV32-NEXT: vand.vv v8, v8, v12, v0.t
1717 ; RV32-NEXT: vadd.vv v8, v16, v8, v0.t
1718 ; RV32-NEXT: vsrl.vi v12, v8, 4, v0.t
1719 ; RV32-NEXT: vadd.vv v8, v8, v12, v0.t
1720 ; RV32-NEXT: lui a1, 61681
1721 ; RV32-NEXT: addi a1, a1, -241
1722 ; RV32-NEXT: vsetvli a2, zero, e32, m4, ta, ma
1723 ; RV32-NEXT: vmv.v.x v12, a1
1724 ; RV32-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1725 ; RV32-NEXT: vand.vv v8, v8, v12, v0.t
1726 ; RV32-NEXT: lui a1, 4112
1727 ; RV32-NEXT: addi a1, a1, 257
1728 ; RV32-NEXT: vsetvli a2, zero, e32, m4, ta, ma
1729 ; RV32-NEXT: vmv.v.x v12, a1
1730 ; RV32-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1731 ; RV32-NEXT: vmul.vv v8, v8, v12, v0.t
1732 ; RV32-NEXT: li a0, 56
1733 ; RV32-NEXT: vsrl.vx v8, v8, a0, v0.t
1736 ; RV64-LABEL: vp_cttz_nxv4i64:
1738 ; RV64-NEXT: li a1, 1
1739 ; RV64-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1740 ; RV64-NEXT: vsub.vx v12, v8, a1, v0.t
1741 ; RV64-NEXT: vnot.v v8, v8, v0.t
1742 ; RV64-NEXT: vand.vv v8, v8, v12, v0.t
1743 ; RV64-NEXT: vsrl.vi v12, v8, 1, v0.t
1744 ; RV64-NEXT: lui a0, 349525
1745 ; RV64-NEXT: addiw a0, a0, 1365
1746 ; RV64-NEXT: slli a1, a0, 32
1747 ; RV64-NEXT: add a0, a0, a1
1748 ; RV64-NEXT: vand.vx v12, v12, a0, v0.t
1749 ; RV64-NEXT: vsub.vv v8, v8, v12, v0.t
1750 ; RV64-NEXT: lui a0, 209715
1751 ; RV64-NEXT: addiw a0, a0, 819
1752 ; RV64-NEXT: slli a1, a0, 32
1753 ; RV64-NEXT: add a0, a0, a1
1754 ; RV64-NEXT: vand.vx v12, v8, a0, v0.t
1755 ; RV64-NEXT: vsrl.vi v8, v8, 2, v0.t
1756 ; RV64-NEXT: vand.vx v8, v8, a0, v0.t
1757 ; RV64-NEXT: vadd.vv v8, v12, v8, v0.t
1758 ; RV64-NEXT: vsrl.vi v12, v8, 4, v0.t
1759 ; RV64-NEXT: vadd.vv v8, v8, v12, v0.t
1760 ; RV64-NEXT: lui a0, 61681
1761 ; RV64-NEXT: addiw a0, a0, -241
1762 ; RV64-NEXT: slli a1, a0, 32
1763 ; RV64-NEXT: add a0, a0, a1
1764 ; RV64-NEXT: vand.vx v8, v8, a0, v0.t
1765 ; RV64-NEXT: lui a0, 4112
1766 ; RV64-NEXT: addiw a0, a0, 257
1767 ; RV64-NEXT: slli a1, a0, 32
1768 ; RV64-NEXT: add a0, a0, a1
1769 ; RV64-NEXT: vmul.vx v8, v8, a0, v0.t
1770 ; RV64-NEXT: li a0, 56
1771 ; RV64-NEXT: vsrl.vx v8, v8, a0, v0.t
1774 ; CHECK-ZVBB-LABEL: vp_cttz_nxv4i64:
1775 ; CHECK-ZVBB: # %bb.0:
1776 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1777 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
1778 ; CHECK-ZVBB-NEXT: ret
1779 %v = call <vscale x 4 x i64> @llvm.vp.cttz.nxv4i64(<vscale x 4 x i64> %va, i1 false, <vscale x 4 x i1> %m, i32 %evl)
1780 ret <vscale x 4 x i64> %v
1783 define <vscale x 4 x i64> @vp_cttz_nxv4i64_unmasked(<vscale x 4 x i64> %va, i32 zeroext %evl) {
1784 ; RV32-LABEL: vp_cttz_nxv4i64_unmasked:
1786 ; RV32-NEXT: li a1, 1
1787 ; RV32-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1788 ; RV32-NEXT: vsub.vx v12, v8, a1
1789 ; RV32-NEXT: vnot.v v8, v8
1790 ; RV32-NEXT: vand.vv v8, v8, v12
1791 ; RV32-NEXT: vsrl.vi v12, v8, 1
1792 ; RV32-NEXT: lui a1, 349525
1793 ; RV32-NEXT: addi a1, a1, 1365
1794 ; RV32-NEXT: vsetvli a2, zero, e32, m4, ta, ma
1795 ; RV32-NEXT: vmv.v.x v16, a1
1796 ; RV32-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1797 ; RV32-NEXT: vand.vv v12, v12, v16
1798 ; RV32-NEXT: vsub.vv v8, v8, v12
1799 ; RV32-NEXT: lui a1, 209715
1800 ; RV32-NEXT: addi a1, a1, 819
1801 ; RV32-NEXT: vsetvli a2, zero, e32, m4, ta, ma
1802 ; RV32-NEXT: vmv.v.x v12, a1
1803 ; RV32-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1804 ; RV32-NEXT: vand.vv v16, v8, v12
1805 ; RV32-NEXT: vsrl.vi v8, v8, 2
1806 ; RV32-NEXT: vand.vv v8, v8, v12
1807 ; RV32-NEXT: vadd.vv v8, v16, v8
1808 ; RV32-NEXT: vsrl.vi v12, v8, 4
1809 ; RV32-NEXT: vadd.vv v8, v8, v12
1810 ; RV32-NEXT: lui a1, 61681
1811 ; RV32-NEXT: addi a1, a1, -241
1812 ; RV32-NEXT: vsetvli a2, zero, e32, m4, ta, ma
1813 ; RV32-NEXT: vmv.v.x v12, a1
1814 ; RV32-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1815 ; RV32-NEXT: vand.vv v8, v8, v12
1816 ; RV32-NEXT: lui a1, 4112
1817 ; RV32-NEXT: addi a1, a1, 257
1818 ; RV32-NEXT: vsetvli a2, zero, e32, m4, ta, ma
1819 ; RV32-NEXT: vmv.v.x v12, a1
1820 ; RV32-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1821 ; RV32-NEXT: vmul.vv v8, v8, v12
1822 ; RV32-NEXT: li a0, 56
1823 ; RV32-NEXT: vsrl.vx v8, v8, a0
1826 ; RV64-LABEL: vp_cttz_nxv4i64_unmasked:
1828 ; RV64-NEXT: li a1, 1
1829 ; RV64-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1830 ; RV64-NEXT: vsub.vx v12, v8, a1
1831 ; RV64-NEXT: vnot.v v8, v8
1832 ; RV64-NEXT: vand.vv v8, v8, v12
1833 ; RV64-NEXT: vsrl.vi v12, v8, 1
1834 ; RV64-NEXT: lui a0, 349525
1835 ; RV64-NEXT: addiw a0, a0, 1365
1836 ; RV64-NEXT: slli a1, a0, 32
1837 ; RV64-NEXT: add a0, a0, a1
1838 ; RV64-NEXT: vand.vx v12, v12, a0
1839 ; RV64-NEXT: vsub.vv v8, v8, v12
1840 ; RV64-NEXT: lui a0, 209715
1841 ; RV64-NEXT: addiw a0, a0, 819
1842 ; RV64-NEXT: slli a1, a0, 32
1843 ; RV64-NEXT: add a0, a0, a1
1844 ; RV64-NEXT: vand.vx v12, v8, a0
1845 ; RV64-NEXT: vsrl.vi v8, v8, 2
1846 ; RV64-NEXT: vand.vx v8, v8, a0
1847 ; RV64-NEXT: vadd.vv v8, v12, v8
1848 ; RV64-NEXT: vsrl.vi v12, v8, 4
1849 ; RV64-NEXT: vadd.vv v8, v8, v12
1850 ; RV64-NEXT: lui a0, 61681
1851 ; RV64-NEXT: addiw a0, a0, -241
1852 ; RV64-NEXT: slli a1, a0, 32
1853 ; RV64-NEXT: add a0, a0, a1
1854 ; RV64-NEXT: vand.vx v8, v8, a0
1855 ; RV64-NEXT: lui a0, 4112
1856 ; RV64-NEXT: addiw a0, a0, 257
1857 ; RV64-NEXT: slli a1, a0, 32
1858 ; RV64-NEXT: add a0, a0, a1
1859 ; RV64-NEXT: vmul.vx v8, v8, a0
1860 ; RV64-NEXT: li a0, 56
1861 ; RV64-NEXT: vsrl.vx v8, v8, a0
1864 ; CHECK-ZVBB-LABEL: vp_cttz_nxv4i64_unmasked:
1865 ; CHECK-ZVBB: # %bb.0:
1866 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1867 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
1868 ; CHECK-ZVBB-NEXT: ret
1869 %v = call <vscale x 4 x i64> @llvm.vp.cttz.nxv4i64(<vscale x 4 x i64> %va, i1 false, <vscale x 4 x i1> splat (i1 true), i32 %evl)
1870 ret <vscale x 4 x i64> %v
1873 declare <vscale x 7 x i64> @llvm.vp.cttz.nxv7i64(<vscale x 7 x i64>, i1 immarg, <vscale x 7 x i1>, i32)
1875 define <vscale x 7 x i64> @vp_cttz_nxv7i64(<vscale x 7 x i64> %va, <vscale x 7 x i1> %m, i32 zeroext %evl) {
1876 ; RV32-LABEL: vp_cttz_nxv7i64:
1878 ; RV32-NEXT: li a1, 1
1879 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1880 ; RV32-NEXT: vsub.vx v16, v8, a1, v0.t
1881 ; RV32-NEXT: vnot.v v8, v8, v0.t
1882 ; RV32-NEXT: vand.vv v8, v8, v16, v0.t
1883 ; RV32-NEXT: vsrl.vi v16, v8, 1, v0.t
1884 ; RV32-NEXT: lui a1, 349525
1885 ; RV32-NEXT: addi a1, a1, 1365
1886 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
1887 ; RV32-NEXT: vmv.v.x v24, a1
1888 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1889 ; RV32-NEXT: vand.vv v16, v16, v24, v0.t
1890 ; RV32-NEXT: vsub.vv v8, v8, v16, v0.t
1891 ; RV32-NEXT: lui a1, 209715
1892 ; RV32-NEXT: addi a1, a1, 819
1893 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
1894 ; RV32-NEXT: vmv.v.x v16, a1
1895 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1896 ; RV32-NEXT: vand.vv v24, v8, v16, v0.t
1897 ; RV32-NEXT: vsrl.vi v8, v8, 2, v0.t
1898 ; RV32-NEXT: vand.vv v8, v8, v16, v0.t
1899 ; RV32-NEXT: vadd.vv v8, v24, v8, v0.t
1900 ; RV32-NEXT: vsrl.vi v16, v8, 4, v0.t
1901 ; RV32-NEXT: vadd.vv v8, v8, v16, v0.t
1902 ; RV32-NEXT: lui a1, 61681
1903 ; RV32-NEXT: addi a1, a1, -241
1904 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
1905 ; RV32-NEXT: vmv.v.x v16, a1
1906 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1907 ; RV32-NEXT: vand.vv v8, v8, v16, v0.t
1908 ; RV32-NEXT: lui a1, 4112
1909 ; RV32-NEXT: addi a1, a1, 257
1910 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
1911 ; RV32-NEXT: vmv.v.x v16, a1
1912 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1913 ; RV32-NEXT: vmul.vv v8, v8, v16, v0.t
1914 ; RV32-NEXT: li a0, 56
1915 ; RV32-NEXT: vsrl.vx v8, v8, a0, v0.t
1918 ; RV64-LABEL: vp_cttz_nxv7i64:
1920 ; RV64-NEXT: li a1, 1
1921 ; RV64-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1922 ; RV64-NEXT: vsub.vx v16, v8, a1, v0.t
1923 ; RV64-NEXT: vnot.v v8, v8, v0.t
1924 ; RV64-NEXT: vand.vv v8, v8, v16, v0.t
1925 ; RV64-NEXT: vsrl.vi v16, v8, 1, v0.t
1926 ; RV64-NEXT: lui a0, 349525
1927 ; RV64-NEXT: addiw a0, a0, 1365
1928 ; RV64-NEXT: slli a1, a0, 32
1929 ; RV64-NEXT: add a0, a0, a1
1930 ; RV64-NEXT: vand.vx v16, v16, a0, v0.t
1931 ; RV64-NEXT: vsub.vv v8, v8, v16, v0.t
1932 ; RV64-NEXT: lui a0, 209715
1933 ; RV64-NEXT: addiw a0, a0, 819
1934 ; RV64-NEXT: slli a1, a0, 32
1935 ; RV64-NEXT: add a0, a0, a1
1936 ; RV64-NEXT: vand.vx v16, v8, a0, v0.t
1937 ; RV64-NEXT: vsrl.vi v8, v8, 2, v0.t
1938 ; RV64-NEXT: vand.vx v8, v8, a0, v0.t
1939 ; RV64-NEXT: vadd.vv v8, v16, v8, v0.t
1940 ; RV64-NEXT: vsrl.vi v16, v8, 4, v0.t
1941 ; RV64-NEXT: vadd.vv v8, v8, v16, v0.t
1942 ; RV64-NEXT: lui a0, 61681
1943 ; RV64-NEXT: addiw a0, a0, -241
1944 ; RV64-NEXT: slli a1, a0, 32
1945 ; RV64-NEXT: add a0, a0, a1
1946 ; RV64-NEXT: vand.vx v8, v8, a0, v0.t
1947 ; RV64-NEXT: lui a0, 4112
1948 ; RV64-NEXT: addiw a0, a0, 257
1949 ; RV64-NEXT: slli a1, a0, 32
1950 ; RV64-NEXT: add a0, a0, a1
1951 ; RV64-NEXT: vmul.vx v8, v8, a0, v0.t
1952 ; RV64-NEXT: li a0, 56
1953 ; RV64-NEXT: vsrl.vx v8, v8, a0, v0.t
1956 ; CHECK-ZVBB-LABEL: vp_cttz_nxv7i64:
1957 ; CHECK-ZVBB: # %bb.0:
1958 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1959 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
1960 ; CHECK-ZVBB-NEXT: ret
1961 %v = call <vscale x 7 x i64> @llvm.vp.cttz.nxv7i64(<vscale x 7 x i64> %va, i1 false, <vscale x 7 x i1> %m, i32 %evl)
1962 ret <vscale x 7 x i64> %v
1965 define <vscale x 7 x i64> @vp_cttz_nxv7i64_unmasked(<vscale x 7 x i64> %va, i32 zeroext %evl) {
1966 ; RV32-LABEL: vp_cttz_nxv7i64_unmasked:
1968 ; RV32-NEXT: li a1, 1
1969 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1970 ; RV32-NEXT: vsub.vx v16, v8, a1
1971 ; RV32-NEXT: vnot.v v8, v8
1972 ; RV32-NEXT: vand.vv v8, v8, v16
1973 ; RV32-NEXT: vsrl.vi v16, v8, 1
1974 ; RV32-NEXT: lui a1, 349525
1975 ; RV32-NEXT: addi a1, a1, 1365
1976 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
1977 ; RV32-NEXT: vmv.v.x v24, a1
1978 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1979 ; RV32-NEXT: vand.vv v16, v16, v24
1980 ; RV32-NEXT: vsub.vv v8, v8, v16
1981 ; RV32-NEXT: lui a1, 209715
1982 ; RV32-NEXT: addi a1, a1, 819
1983 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
1984 ; RV32-NEXT: vmv.v.x v16, a1
1985 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1986 ; RV32-NEXT: vand.vv v24, v8, v16
1987 ; RV32-NEXT: vsrl.vi v8, v8, 2
1988 ; RV32-NEXT: vand.vv v8, v8, v16
1989 ; RV32-NEXT: vadd.vv v8, v24, v8
1990 ; RV32-NEXT: vsrl.vi v16, v8, 4
1991 ; RV32-NEXT: vadd.vv v8, v8, v16
1992 ; RV32-NEXT: lui a1, 61681
1993 ; RV32-NEXT: addi a1, a1, -241
1994 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
1995 ; RV32-NEXT: vmv.v.x v16, a1
1996 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1997 ; RV32-NEXT: vand.vv v8, v8, v16
1998 ; RV32-NEXT: lui a1, 4112
1999 ; RV32-NEXT: addi a1, a1, 257
2000 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
2001 ; RV32-NEXT: vmv.v.x v16, a1
2002 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2003 ; RV32-NEXT: vmul.vv v8, v8, v16
2004 ; RV32-NEXT: li a0, 56
2005 ; RV32-NEXT: vsrl.vx v8, v8, a0
2008 ; RV64-LABEL: vp_cttz_nxv7i64_unmasked:
2010 ; RV64-NEXT: li a1, 1
2011 ; RV64-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2012 ; RV64-NEXT: vsub.vx v16, v8, a1
2013 ; RV64-NEXT: vnot.v v8, v8
2014 ; RV64-NEXT: vand.vv v8, v8, v16
2015 ; RV64-NEXT: vsrl.vi v16, v8, 1
2016 ; RV64-NEXT: lui a0, 349525
2017 ; RV64-NEXT: addiw a0, a0, 1365
2018 ; RV64-NEXT: slli a1, a0, 32
2019 ; RV64-NEXT: add a0, a0, a1
2020 ; RV64-NEXT: vand.vx v16, v16, a0
2021 ; RV64-NEXT: vsub.vv v8, v8, v16
2022 ; RV64-NEXT: lui a0, 209715
2023 ; RV64-NEXT: addiw a0, a0, 819
2024 ; RV64-NEXT: slli a1, a0, 32
2025 ; RV64-NEXT: add a0, a0, a1
2026 ; RV64-NEXT: vand.vx v16, v8, a0
2027 ; RV64-NEXT: vsrl.vi v8, v8, 2
2028 ; RV64-NEXT: vand.vx v8, v8, a0
2029 ; RV64-NEXT: vadd.vv v8, v16, v8
2030 ; RV64-NEXT: vsrl.vi v16, v8, 4
2031 ; RV64-NEXT: vadd.vv v8, v8, v16
2032 ; RV64-NEXT: lui a0, 61681
2033 ; RV64-NEXT: addiw a0, a0, -241
2034 ; RV64-NEXT: slli a1, a0, 32
2035 ; RV64-NEXT: add a0, a0, a1
2036 ; RV64-NEXT: vand.vx v8, v8, a0
2037 ; RV64-NEXT: lui a0, 4112
2038 ; RV64-NEXT: addiw a0, a0, 257
2039 ; RV64-NEXT: slli a1, a0, 32
2040 ; RV64-NEXT: add a0, a0, a1
2041 ; RV64-NEXT: vmul.vx v8, v8, a0
2042 ; RV64-NEXT: li a0, 56
2043 ; RV64-NEXT: vsrl.vx v8, v8, a0
2046 ; CHECK-ZVBB-LABEL: vp_cttz_nxv7i64_unmasked:
2047 ; CHECK-ZVBB: # %bb.0:
2048 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2049 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
2050 ; CHECK-ZVBB-NEXT: ret
2051 %v = call <vscale x 7 x i64> @llvm.vp.cttz.nxv7i64(<vscale x 7 x i64> %va, i1 false, <vscale x 7 x i1> splat (i1 true), i32 %evl)
2052 ret <vscale x 7 x i64> %v
2055 declare <vscale x 8 x i64> @llvm.vp.cttz.nxv8i64(<vscale x 8 x i64>, i1 immarg, <vscale x 8 x i1>, i32)
2057 define <vscale x 8 x i64> @vp_cttz_nxv8i64(<vscale x 8 x i64> %va, <vscale x 8 x i1> %m, i32 zeroext %evl) {
2058 ; RV32-LABEL: vp_cttz_nxv8i64:
2060 ; RV32-NEXT: li a1, 1
2061 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2062 ; RV32-NEXT: vsub.vx v16, v8, a1, v0.t
2063 ; RV32-NEXT: vnot.v v8, v8, v0.t
2064 ; RV32-NEXT: vand.vv v8, v8, v16, v0.t
2065 ; RV32-NEXT: vsrl.vi v16, v8, 1, v0.t
2066 ; RV32-NEXT: lui a1, 349525
2067 ; RV32-NEXT: addi a1, a1, 1365
2068 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
2069 ; RV32-NEXT: vmv.v.x v24, a1
2070 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2071 ; RV32-NEXT: vand.vv v16, v16, v24, v0.t
2072 ; RV32-NEXT: vsub.vv v8, v8, v16, v0.t
2073 ; RV32-NEXT: lui a1, 209715
2074 ; RV32-NEXT: addi a1, a1, 819
2075 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
2076 ; RV32-NEXT: vmv.v.x v16, a1
2077 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2078 ; RV32-NEXT: vand.vv v24, v8, v16, v0.t
2079 ; RV32-NEXT: vsrl.vi v8, v8, 2, v0.t
2080 ; RV32-NEXT: vand.vv v8, v8, v16, v0.t
2081 ; RV32-NEXT: vadd.vv v8, v24, v8, v0.t
2082 ; RV32-NEXT: vsrl.vi v16, v8, 4, v0.t
2083 ; RV32-NEXT: vadd.vv v8, v8, v16, v0.t
2084 ; RV32-NEXT: lui a1, 61681
2085 ; RV32-NEXT: addi a1, a1, -241
2086 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
2087 ; RV32-NEXT: vmv.v.x v16, a1
2088 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2089 ; RV32-NEXT: vand.vv v8, v8, v16, v0.t
2090 ; RV32-NEXT: lui a1, 4112
2091 ; RV32-NEXT: addi a1, a1, 257
2092 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
2093 ; RV32-NEXT: vmv.v.x v16, a1
2094 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2095 ; RV32-NEXT: vmul.vv v8, v8, v16, v0.t
2096 ; RV32-NEXT: li a0, 56
2097 ; RV32-NEXT: vsrl.vx v8, v8, a0, v0.t
2100 ; RV64-LABEL: vp_cttz_nxv8i64:
2102 ; RV64-NEXT: li a1, 1
2103 ; RV64-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2104 ; RV64-NEXT: vsub.vx v16, v8, a1, v0.t
2105 ; RV64-NEXT: vnot.v v8, v8, v0.t
2106 ; RV64-NEXT: vand.vv v8, v8, v16, v0.t
2107 ; RV64-NEXT: vsrl.vi v16, v8, 1, v0.t
2108 ; RV64-NEXT: lui a0, 349525
2109 ; RV64-NEXT: addiw a0, a0, 1365
2110 ; RV64-NEXT: slli a1, a0, 32
2111 ; RV64-NEXT: add a0, a0, a1
2112 ; RV64-NEXT: vand.vx v16, v16, a0, v0.t
2113 ; RV64-NEXT: vsub.vv v8, v8, v16, v0.t
2114 ; RV64-NEXT: lui a0, 209715
2115 ; RV64-NEXT: addiw a0, a0, 819
2116 ; RV64-NEXT: slli a1, a0, 32
2117 ; RV64-NEXT: add a0, a0, a1
2118 ; RV64-NEXT: vand.vx v16, v8, a0, v0.t
2119 ; RV64-NEXT: vsrl.vi v8, v8, 2, v0.t
2120 ; RV64-NEXT: vand.vx v8, v8, a0, v0.t
2121 ; RV64-NEXT: vadd.vv v8, v16, v8, v0.t
2122 ; RV64-NEXT: vsrl.vi v16, v8, 4, v0.t
2123 ; RV64-NEXT: vadd.vv v8, v8, v16, v0.t
2124 ; RV64-NEXT: lui a0, 61681
2125 ; RV64-NEXT: addiw a0, a0, -241
2126 ; RV64-NEXT: slli a1, a0, 32
2127 ; RV64-NEXT: add a0, a0, a1
2128 ; RV64-NEXT: vand.vx v8, v8, a0, v0.t
2129 ; RV64-NEXT: lui a0, 4112
2130 ; RV64-NEXT: addiw a0, a0, 257
2131 ; RV64-NEXT: slli a1, a0, 32
2132 ; RV64-NEXT: add a0, a0, a1
2133 ; RV64-NEXT: vmul.vx v8, v8, a0, v0.t
2134 ; RV64-NEXT: li a0, 56
2135 ; RV64-NEXT: vsrl.vx v8, v8, a0, v0.t
2138 ; CHECK-ZVBB-LABEL: vp_cttz_nxv8i64:
2139 ; CHECK-ZVBB: # %bb.0:
2140 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2141 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
2142 ; CHECK-ZVBB-NEXT: ret
2143 %v = call <vscale x 8 x i64> @llvm.vp.cttz.nxv8i64(<vscale x 8 x i64> %va, i1 false, <vscale x 8 x i1> %m, i32 %evl)
2144 ret <vscale x 8 x i64> %v
2147 define <vscale x 8 x i64> @vp_cttz_nxv8i64_unmasked(<vscale x 8 x i64> %va, i32 zeroext %evl) {
2148 ; RV32-LABEL: vp_cttz_nxv8i64_unmasked:
2150 ; RV32-NEXT: li a1, 1
2151 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2152 ; RV32-NEXT: vsub.vx v16, v8, a1
2153 ; RV32-NEXT: vnot.v v8, v8
2154 ; RV32-NEXT: vand.vv v8, v8, v16
2155 ; RV32-NEXT: vsrl.vi v16, v8, 1
2156 ; RV32-NEXT: lui a1, 349525
2157 ; RV32-NEXT: addi a1, a1, 1365
2158 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
2159 ; RV32-NEXT: vmv.v.x v24, a1
2160 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2161 ; RV32-NEXT: vand.vv v16, v16, v24
2162 ; RV32-NEXT: vsub.vv v8, v8, v16
2163 ; RV32-NEXT: lui a1, 209715
2164 ; RV32-NEXT: addi a1, a1, 819
2165 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
2166 ; RV32-NEXT: vmv.v.x v16, a1
2167 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2168 ; RV32-NEXT: vand.vv v24, v8, v16
2169 ; RV32-NEXT: vsrl.vi v8, v8, 2
2170 ; RV32-NEXT: vand.vv v8, v8, v16
2171 ; RV32-NEXT: vadd.vv v8, v24, v8
2172 ; RV32-NEXT: vsrl.vi v16, v8, 4
2173 ; RV32-NEXT: vadd.vv v8, v8, v16
2174 ; RV32-NEXT: lui a1, 61681
2175 ; RV32-NEXT: addi a1, a1, -241
2176 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
2177 ; RV32-NEXT: vmv.v.x v16, a1
2178 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2179 ; RV32-NEXT: vand.vv v8, v8, v16
2180 ; RV32-NEXT: lui a1, 4112
2181 ; RV32-NEXT: addi a1, a1, 257
2182 ; RV32-NEXT: vsetvli a2, zero, e32, m8, ta, ma
2183 ; RV32-NEXT: vmv.v.x v16, a1
2184 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2185 ; RV32-NEXT: vmul.vv v8, v8, v16
2186 ; RV32-NEXT: li a0, 56
2187 ; RV32-NEXT: vsrl.vx v8, v8, a0
2190 ; RV64-LABEL: vp_cttz_nxv8i64_unmasked:
2192 ; RV64-NEXT: li a1, 1
2193 ; RV64-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2194 ; RV64-NEXT: vsub.vx v16, v8, a1
2195 ; RV64-NEXT: vnot.v v8, v8
2196 ; RV64-NEXT: vand.vv v8, v8, v16
2197 ; RV64-NEXT: vsrl.vi v16, v8, 1
2198 ; RV64-NEXT: lui a0, 349525
2199 ; RV64-NEXT: addiw a0, a0, 1365
2200 ; RV64-NEXT: slli a1, a0, 32
2201 ; RV64-NEXT: add a0, a0, a1
2202 ; RV64-NEXT: vand.vx v16, v16, a0
2203 ; RV64-NEXT: vsub.vv v8, v8, v16
2204 ; RV64-NEXT: lui a0, 209715
2205 ; RV64-NEXT: addiw a0, a0, 819
2206 ; RV64-NEXT: slli a1, a0, 32
2207 ; RV64-NEXT: add a0, a0, a1
2208 ; RV64-NEXT: vand.vx v16, v8, a0
2209 ; RV64-NEXT: vsrl.vi v8, v8, 2
2210 ; RV64-NEXT: vand.vx v8, v8, a0
2211 ; RV64-NEXT: vadd.vv v8, v16, v8
2212 ; RV64-NEXT: vsrl.vi v16, v8, 4
2213 ; RV64-NEXT: vadd.vv v8, v8, v16
2214 ; RV64-NEXT: lui a0, 61681
2215 ; RV64-NEXT: addiw a0, a0, -241
2216 ; RV64-NEXT: slli a1, a0, 32
2217 ; RV64-NEXT: add a0, a0, a1
2218 ; RV64-NEXT: vand.vx v8, v8, a0
2219 ; RV64-NEXT: lui a0, 4112
2220 ; RV64-NEXT: addiw a0, a0, 257
2221 ; RV64-NEXT: slli a1, a0, 32
2222 ; RV64-NEXT: add a0, a0, a1
2223 ; RV64-NEXT: vmul.vx v8, v8, a0
2224 ; RV64-NEXT: li a0, 56
2225 ; RV64-NEXT: vsrl.vx v8, v8, a0
2228 ; CHECK-ZVBB-LABEL: vp_cttz_nxv8i64_unmasked:
2229 ; CHECK-ZVBB: # %bb.0:
2230 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2231 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
2232 ; CHECK-ZVBB-NEXT: ret
2233 %v = call <vscale x 8 x i64> @llvm.vp.cttz.nxv8i64(<vscale x 8 x i64> %va, i1 false, <vscale x 8 x i1> splat (i1 true), i32 %evl)
2234 ret <vscale x 8 x i64> %v
2237 declare <vscale x 16 x i64> @llvm.vp.cttz.nxv16i64(<vscale x 16 x i64>, i1 immarg, <vscale x 16 x i1>, i32)
2239 define <vscale x 16 x i64> @vp_cttz_nxv16i64(<vscale x 16 x i64> %va, <vscale x 16 x i1> %m, i32 zeroext %evl) {
2240 ; RV32-LABEL: vp_cttz_nxv16i64:
2242 ; RV32-NEXT: addi sp, sp, -16
2243 ; RV32-NEXT: .cfi_def_cfa_offset 16
2244 ; RV32-NEXT: csrr a1, vlenb
2245 ; RV32-NEXT: li a2, 56
2246 ; RV32-NEXT: mul a1, a1, a2
2247 ; RV32-NEXT: sub sp, sp, a1
2248 ; RV32-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x38, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 56 * vlenb
2249 ; RV32-NEXT: vmv1r.v v24, v0
2250 ; RV32-NEXT: csrr a1, vlenb
2251 ; RV32-NEXT: slli a1, a1, 5
2252 ; RV32-NEXT: add a1, sp, a1
2253 ; RV32-NEXT: addi a1, a1, 16
2254 ; RV32-NEXT: vs8r.v v8, (a1) # Unknown-size Folded Spill
2255 ; RV32-NEXT: csrr a1, vlenb
2256 ; RV32-NEXT: srli a2, a1, 3
2257 ; RV32-NEXT: vsetvli a3, zero, e8, mf4, ta, ma
2258 ; RV32-NEXT: vslidedown.vx v0, v0, a2
2259 ; RV32-NEXT: sub a2, a0, a1
2260 ; RV32-NEXT: sltu a3, a0, a2
2261 ; RV32-NEXT: addi a3, a3, -1
2262 ; RV32-NEXT: and a3, a3, a2
2263 ; RV32-NEXT: li a2, 1
2264 ; RV32-NEXT: vsetvli zero, a3, e64, m8, ta, ma
2265 ; RV32-NEXT: vsub.vx v8, v16, a2, v0.t
2266 ; RV32-NEXT: vnot.v v16, v16, v0.t
2267 ; RV32-NEXT: vand.vv v8, v16, v8, v0.t
2268 ; RV32-NEXT: csrr a4, vlenb
2269 ; RV32-NEXT: li a5, 40
2270 ; RV32-NEXT: mul a4, a4, a5
2271 ; RV32-NEXT: add a4, sp, a4
2272 ; RV32-NEXT: addi a4, a4, 16
2273 ; RV32-NEXT: vs8r.v v8, (a4) # Unknown-size Folded Spill
2274 ; RV32-NEXT: vsrl.vi v8, v8, 1, v0.t
2275 ; RV32-NEXT: csrr a4, vlenb
2276 ; RV32-NEXT: li a5, 48
2277 ; RV32-NEXT: mul a4, a4, a5
2278 ; RV32-NEXT: add a4, sp, a4
2279 ; RV32-NEXT: addi a4, a4, 16
2280 ; RV32-NEXT: vs8r.v v8, (a4) # Unknown-size Folded Spill
2281 ; RV32-NEXT: lui a4, 349525
2282 ; RV32-NEXT: addi a4, a4, 1365
2283 ; RV32-NEXT: vsetvli a5, zero, e32, m8, ta, ma
2284 ; RV32-NEXT: vmv.v.x v8, a4
2285 ; RV32-NEXT: csrr a4, vlenb
2286 ; RV32-NEXT: li a5, 24
2287 ; RV32-NEXT: mul a4, a4, a5
2288 ; RV32-NEXT: add a4, sp, a4
2289 ; RV32-NEXT: addi a4, a4, 16
2290 ; RV32-NEXT: vs8r.v v8, (a4) # Unknown-size Folded Spill
2291 ; RV32-NEXT: csrr a4, vlenb
2292 ; RV32-NEXT: li a5, 48
2293 ; RV32-NEXT: mul a4, a4, a5
2294 ; RV32-NEXT: add a4, sp, a4
2295 ; RV32-NEXT: addi a4, a4, 16
2296 ; RV32-NEXT: vl8r.v v16, (a4) # Unknown-size Folded Reload
2297 ; RV32-NEXT: vsetvli zero, a3, e64, m8, ta, ma
2298 ; RV32-NEXT: vand.vv v8, v16, v8, v0.t
2299 ; RV32-NEXT: csrr a4, vlenb
2300 ; RV32-NEXT: li a5, 40
2301 ; RV32-NEXT: mul a4, a4, a5
2302 ; RV32-NEXT: add a4, sp, a4
2303 ; RV32-NEXT: addi a4, a4, 16
2304 ; RV32-NEXT: vl8r.v v16, (a4) # Unknown-size Folded Reload
2305 ; RV32-NEXT: vsub.vv v8, v16, v8, v0.t
2306 ; RV32-NEXT: csrr a4, vlenb
2307 ; RV32-NEXT: li a5, 40
2308 ; RV32-NEXT: mul a4, a4, a5
2309 ; RV32-NEXT: add a4, sp, a4
2310 ; RV32-NEXT: addi a4, a4, 16
2311 ; RV32-NEXT: vs8r.v v8, (a4) # Unknown-size Folded Spill
2312 ; RV32-NEXT: lui a4, 209715
2313 ; RV32-NEXT: addi a4, a4, 819
2314 ; RV32-NEXT: vsetvli a5, zero, e32, m8, ta, ma
2315 ; RV32-NEXT: vmv.v.x v16, a4
2316 ; RV32-NEXT: csrr a4, vlenb
2317 ; RV32-NEXT: li a5, 40
2318 ; RV32-NEXT: mul a4, a4, a5
2319 ; RV32-NEXT: add a4, sp, a4
2320 ; RV32-NEXT: addi a4, a4, 16
2321 ; RV32-NEXT: vl8r.v v8, (a4) # Unknown-size Folded Reload
2322 ; RV32-NEXT: vsetvli zero, a3, e64, m8, ta, ma
2323 ; RV32-NEXT: vand.vv v8, v8, v16, v0.t
2324 ; RV32-NEXT: csrr a4, vlenb
2325 ; RV32-NEXT: slli a4, a4, 4
2326 ; RV32-NEXT: add a4, sp, a4
2327 ; RV32-NEXT: addi a4, a4, 16
2328 ; RV32-NEXT: vs8r.v v8, (a4) # Unknown-size Folded Spill
2329 ; RV32-NEXT: csrr a4, vlenb
2330 ; RV32-NEXT: li a5, 40
2331 ; RV32-NEXT: mul a4, a4, a5
2332 ; RV32-NEXT: add a4, sp, a4
2333 ; RV32-NEXT: addi a4, a4, 16
2334 ; RV32-NEXT: vl8r.v v8, (a4) # Unknown-size Folded Reload
2335 ; RV32-NEXT: vsrl.vi v8, v8, 2, v0.t
2336 ; RV32-NEXT: csrr a4, vlenb
2337 ; RV32-NEXT: li a5, 48
2338 ; RV32-NEXT: mul a4, a4, a5
2339 ; RV32-NEXT: add a4, sp, a4
2340 ; RV32-NEXT: addi a4, a4, 16
2341 ; RV32-NEXT: vs8r.v v16, (a4) # Unknown-size Folded Spill
2342 ; RV32-NEXT: vand.vv v8, v8, v16, v0.t
2343 ; RV32-NEXT: csrr a4, vlenb
2344 ; RV32-NEXT: slli a4, a4, 4
2345 ; RV32-NEXT: add a4, sp, a4
2346 ; RV32-NEXT: addi a4, a4, 16
2347 ; RV32-NEXT: vl8r.v v16, (a4) # Unknown-size Folded Reload
2348 ; RV32-NEXT: vadd.vv v8, v16, v8, v0.t
2349 ; RV32-NEXT: vsrl.vi v16, v8, 4, v0.t
2350 ; RV32-NEXT: vadd.vv v8, v8, v16, v0.t
2351 ; RV32-NEXT: lui a4, 61681
2352 ; RV32-NEXT: addi a4, a4, -241
2353 ; RV32-NEXT: vsetvli a5, zero, e32, m8, ta, ma
2354 ; RV32-NEXT: vmv.v.x v16, a4
2355 ; RV32-NEXT: csrr a4, vlenb
2356 ; RV32-NEXT: slli a4, a4, 4
2357 ; RV32-NEXT: add a4, sp, a4
2358 ; RV32-NEXT: addi a4, a4, 16
2359 ; RV32-NEXT: vs8r.v v16, (a4) # Unknown-size Folded Spill
2360 ; RV32-NEXT: vsetvli zero, a3, e64, m8, ta, ma
2361 ; RV32-NEXT: vand.vv v16, v8, v16, v0.t
2362 ; RV32-NEXT: lui a4, 4112
2363 ; RV32-NEXT: addi a4, a4, 257
2364 ; RV32-NEXT: vsetvli a5, zero, e32, m8, ta, ma
2365 ; RV32-NEXT: vmv.v.x v8, a4
2366 ; RV32-NEXT: csrr a4, vlenb
2367 ; RV32-NEXT: slli a4, a4, 3
2368 ; RV32-NEXT: add a4, sp, a4
2369 ; RV32-NEXT: addi a4, a4, 16
2370 ; RV32-NEXT: vs8r.v v8, (a4) # Unknown-size Folded Spill
2371 ; RV32-NEXT: vsetvli zero, a3, e64, m8, ta, ma
2372 ; RV32-NEXT: vmul.vv v16, v16, v8, v0.t
2373 ; RV32-NEXT: li a3, 56
2374 ; RV32-NEXT: vsrl.vx v8, v16, a3, v0.t
2375 ; RV32-NEXT: addi a4, sp, 16
2376 ; RV32-NEXT: vs8r.v v8, (a4) # Unknown-size Folded Spill
2377 ; RV32-NEXT: bltu a0, a1, .LBB46_2
2378 ; RV32-NEXT: # %bb.1:
2379 ; RV32-NEXT: mv a0, a1
2380 ; RV32-NEXT: .LBB46_2:
2381 ; RV32-NEXT: vmv1r.v v0, v24
2382 ; RV32-NEXT: slli a1, a1, 5
2383 ; RV32-NEXT: add a1, sp, a1
2384 ; RV32-NEXT: addi a1, a1, 16
2385 ; RV32-NEXT: vl8r.v v8, (a1) # Unknown-size Folded Reload
2386 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2387 ; RV32-NEXT: vsub.vx v16, v8, a2, v0.t
2388 ; RV32-NEXT: vnot.v v8, v8, v0.t
2389 ; RV32-NEXT: vand.vv v8, v8, v16, v0.t
2390 ; RV32-NEXT: csrr a0, vlenb
2391 ; RV32-NEXT: slli a0, a0, 5
2392 ; RV32-NEXT: add a0, sp, a0
2393 ; RV32-NEXT: addi a0, a0, 16
2394 ; RV32-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
2395 ; RV32-NEXT: vsrl.vi v8, v8, 1, v0.t
2396 ; RV32-NEXT: csrr a0, vlenb
2397 ; RV32-NEXT: li a1, 40
2398 ; RV32-NEXT: mul a0, a0, a1
2399 ; RV32-NEXT: add a0, sp, a0
2400 ; RV32-NEXT: addi a0, a0, 16
2401 ; RV32-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
2402 ; RV32-NEXT: csrr a0, vlenb
2403 ; RV32-NEXT: li a1, 24
2404 ; RV32-NEXT: mul a0, a0, a1
2405 ; RV32-NEXT: add a0, sp, a0
2406 ; RV32-NEXT: addi a0, a0, 16
2407 ; RV32-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2408 ; RV32-NEXT: csrr a0, vlenb
2409 ; RV32-NEXT: li a1, 40
2410 ; RV32-NEXT: mul a0, a0, a1
2411 ; RV32-NEXT: add a0, sp, a0
2412 ; RV32-NEXT: addi a0, a0, 16
2413 ; RV32-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
2414 ; RV32-NEXT: vand.vv v16, v8, v16, v0.t
2415 ; RV32-NEXT: csrr a0, vlenb
2416 ; RV32-NEXT: slli a0, a0, 5
2417 ; RV32-NEXT: add a0, sp, a0
2418 ; RV32-NEXT: addi a0, a0, 16
2419 ; RV32-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
2420 ; RV32-NEXT: vsub.vv v8, v8, v16, v0.t
2421 ; RV32-NEXT: csrr a0, vlenb
2422 ; RV32-NEXT: li a1, 40
2423 ; RV32-NEXT: mul a0, a0, a1
2424 ; RV32-NEXT: add a0, sp, a0
2425 ; RV32-NEXT: addi a0, a0, 16
2426 ; RV32-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
2427 ; RV32-NEXT: csrr a0, vlenb
2428 ; RV32-NEXT: li a1, 48
2429 ; RV32-NEXT: mul a0, a0, a1
2430 ; RV32-NEXT: add a0, sp, a0
2431 ; RV32-NEXT: addi a0, a0, 16
2432 ; RV32-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
2433 ; RV32-NEXT: csrr a0, vlenb
2434 ; RV32-NEXT: li a1, 40
2435 ; RV32-NEXT: mul a0, a0, a1
2436 ; RV32-NEXT: add a0, sp, a0
2437 ; RV32-NEXT: addi a0, a0, 16
2438 ; RV32-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2439 ; RV32-NEXT: vand.vv v16, v16, v8, v0.t
2440 ; RV32-NEXT: csrr a0, vlenb
2441 ; RV32-NEXT: slli a0, a0, 5
2442 ; RV32-NEXT: add a0, sp, a0
2443 ; RV32-NEXT: addi a0, a0, 16
2444 ; RV32-NEXT: vs8r.v v16, (a0) # Unknown-size Folded Spill
2445 ; RV32-NEXT: csrr a0, vlenb
2446 ; RV32-NEXT: li a1, 40
2447 ; RV32-NEXT: mul a0, a0, a1
2448 ; RV32-NEXT: add a0, sp, a0
2449 ; RV32-NEXT: addi a0, a0, 16
2450 ; RV32-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
2451 ; RV32-NEXT: vsrl.vi v8, v8, 2, v0.t
2452 ; RV32-NEXT: csrr a0, vlenb
2453 ; RV32-NEXT: li a1, 48
2454 ; RV32-NEXT: mul a0, a0, a1
2455 ; RV32-NEXT: add a0, sp, a0
2456 ; RV32-NEXT: addi a0, a0, 16
2457 ; RV32-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2458 ; RV32-NEXT: vand.vv v8, v8, v16, v0.t
2459 ; RV32-NEXT: csrr a0, vlenb
2460 ; RV32-NEXT: slli a0, a0, 5
2461 ; RV32-NEXT: add a0, sp, a0
2462 ; RV32-NEXT: addi a0, a0, 16
2463 ; RV32-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2464 ; RV32-NEXT: vadd.vv v8, v16, v8, v0.t
2465 ; RV32-NEXT: vsrl.vi v16, v8, 4, v0.t
2466 ; RV32-NEXT: vadd.vv v8, v8, v16, v0.t
2467 ; RV32-NEXT: csrr a0, vlenb
2468 ; RV32-NEXT: slli a0, a0, 4
2469 ; RV32-NEXT: add a0, sp, a0
2470 ; RV32-NEXT: addi a0, a0, 16
2471 ; RV32-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2472 ; RV32-NEXT: vand.vv v8, v8, v16, v0.t
2473 ; RV32-NEXT: csrr a0, vlenb
2474 ; RV32-NEXT: slli a0, a0, 3
2475 ; RV32-NEXT: add a0, sp, a0
2476 ; RV32-NEXT: addi a0, a0, 16
2477 ; RV32-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2478 ; RV32-NEXT: vmul.vv v8, v8, v16, v0.t
2479 ; RV32-NEXT: vsrl.vx v8, v8, a3, v0.t
2480 ; RV32-NEXT: addi a0, sp, 16
2481 ; RV32-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2482 ; RV32-NEXT: csrr a0, vlenb
2483 ; RV32-NEXT: li a1, 56
2484 ; RV32-NEXT: mul a0, a0, a1
2485 ; RV32-NEXT: add sp, sp, a0
2486 ; RV32-NEXT: addi sp, sp, 16
2489 ; RV64-LABEL: vp_cttz_nxv16i64:
2491 ; RV64-NEXT: addi sp, sp, -16
2492 ; RV64-NEXT: .cfi_def_cfa_offset 16
2493 ; RV64-NEXT: csrr a1, vlenb
2494 ; RV64-NEXT: slli a1, a1, 4
2495 ; RV64-NEXT: sub sp, sp, a1
2496 ; RV64-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x10, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 16 * vlenb
2497 ; RV64-NEXT: vmv1r.v v24, v0
2498 ; RV64-NEXT: csrr a1, vlenb
2499 ; RV64-NEXT: slli a1, a1, 3
2500 ; RV64-NEXT: add a1, sp, a1
2501 ; RV64-NEXT: addi a1, a1, 16
2502 ; RV64-NEXT: vs8r.v v8, (a1) # Unknown-size Folded Spill
2503 ; RV64-NEXT: csrr a1, vlenb
2504 ; RV64-NEXT: srli a2, a1, 3
2505 ; RV64-NEXT: vsetvli a3, zero, e8, mf4, ta, ma
2506 ; RV64-NEXT: vslidedown.vx v0, v0, a2
2507 ; RV64-NEXT: sub a2, a0, a1
2508 ; RV64-NEXT: sltu a3, a0, a2
2509 ; RV64-NEXT: addi a3, a3, -1
2510 ; RV64-NEXT: and a3, a3, a2
2511 ; RV64-NEXT: li a2, 1
2512 ; RV64-NEXT: vsetvli zero, a3, e64, m8, ta, ma
2513 ; RV64-NEXT: vsub.vx v8, v16, a2, v0.t
2514 ; RV64-NEXT: vnot.v v16, v16, v0.t
2515 ; RV64-NEXT: vand.vv v16, v16, v8, v0.t
2516 ; RV64-NEXT: vsrl.vi v8, v16, 1, v0.t
2517 ; RV64-NEXT: lui a3, 349525
2518 ; RV64-NEXT: addiw a3, a3, 1365
2519 ; RV64-NEXT: slli a4, a3, 32
2520 ; RV64-NEXT: add a3, a3, a4
2521 ; RV64-NEXT: vand.vx v8, v8, a3, v0.t
2522 ; RV64-NEXT: vsub.vv v16, v16, v8, v0.t
2523 ; RV64-NEXT: lui a4, 209715
2524 ; RV64-NEXT: addiw a4, a4, 819
2525 ; RV64-NEXT: slli a5, a4, 32
2526 ; RV64-NEXT: add a4, a4, a5
2527 ; RV64-NEXT: vand.vx v8, v16, a4, v0.t
2528 ; RV64-NEXT: vsrl.vi v16, v16, 2, v0.t
2529 ; RV64-NEXT: vand.vx v16, v16, a4, v0.t
2530 ; RV64-NEXT: vadd.vv v8, v8, v16, v0.t
2531 ; RV64-NEXT: vsrl.vi v16, v8, 4, v0.t
2532 ; RV64-NEXT: vadd.vv v8, v8, v16, v0.t
2533 ; RV64-NEXT: lui a5, 61681
2534 ; RV64-NEXT: addiw a5, a5, -241
2535 ; RV64-NEXT: slli a6, a5, 32
2536 ; RV64-NEXT: add a5, a5, a6
2537 ; RV64-NEXT: vand.vx v8, v8, a5, v0.t
2538 ; RV64-NEXT: lui a6, 4112
2539 ; RV64-NEXT: addiw a6, a6, 257
2540 ; RV64-NEXT: slli a7, a6, 32
2541 ; RV64-NEXT: add a6, a6, a7
2542 ; RV64-NEXT: vmul.vx v8, v8, a6, v0.t
2543 ; RV64-NEXT: li a7, 56
2544 ; RV64-NEXT: vsrl.vx v8, v8, a7, v0.t
2545 ; RV64-NEXT: addi t0, sp, 16
2546 ; RV64-NEXT: vs8r.v v8, (t0) # Unknown-size Folded Spill
2547 ; RV64-NEXT: bltu a0, a1, .LBB46_2
2548 ; RV64-NEXT: # %bb.1:
2549 ; RV64-NEXT: mv a0, a1
2550 ; RV64-NEXT: .LBB46_2:
2551 ; RV64-NEXT: vmv1r.v v0, v24
2552 ; RV64-NEXT: slli a1, a1, 3
2553 ; RV64-NEXT: add a1, sp, a1
2554 ; RV64-NEXT: addi a1, a1, 16
2555 ; RV64-NEXT: vl8r.v v8, (a1) # Unknown-size Folded Reload
2556 ; RV64-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2557 ; RV64-NEXT: vsub.vx v16, v8, a2, v0.t
2558 ; RV64-NEXT: vnot.v v8, v8, v0.t
2559 ; RV64-NEXT: vand.vv v8, v8, v16, v0.t
2560 ; RV64-NEXT: vsrl.vi v16, v8, 1, v0.t
2561 ; RV64-NEXT: vand.vx v16, v16, a3, v0.t
2562 ; RV64-NEXT: vsub.vv v8, v8, v16, v0.t
2563 ; RV64-NEXT: vand.vx v16, v8, a4, v0.t
2564 ; RV64-NEXT: vsrl.vi v8, v8, 2, v0.t
2565 ; RV64-NEXT: vand.vx v8, v8, a4, v0.t
2566 ; RV64-NEXT: vadd.vv v8, v16, v8, v0.t
2567 ; RV64-NEXT: vsrl.vi v16, v8, 4, v0.t
2568 ; RV64-NEXT: vadd.vv v8, v8, v16, v0.t
2569 ; RV64-NEXT: vand.vx v8, v8, a5, v0.t
2570 ; RV64-NEXT: vmul.vx v8, v8, a6, v0.t
2571 ; RV64-NEXT: vsrl.vx v8, v8, a7, v0.t
2572 ; RV64-NEXT: addi a0, sp, 16
2573 ; RV64-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2574 ; RV64-NEXT: csrr a0, vlenb
2575 ; RV64-NEXT: slli a0, a0, 4
2576 ; RV64-NEXT: add sp, sp, a0
2577 ; RV64-NEXT: addi sp, sp, 16
2580 ; CHECK-ZVBB-LABEL: vp_cttz_nxv16i64:
2581 ; CHECK-ZVBB: # %bb.0:
2582 ; CHECK-ZVBB-NEXT: vmv1r.v v24, v0
2583 ; CHECK-ZVBB-NEXT: csrr a1, vlenb
2584 ; CHECK-ZVBB-NEXT: srli a2, a1, 3
2585 ; CHECK-ZVBB-NEXT: vsetvli a3, zero, e8, mf4, ta, ma
2586 ; CHECK-ZVBB-NEXT: vslidedown.vx v0, v0, a2
2587 ; CHECK-ZVBB-NEXT: sub a2, a0, a1
2588 ; CHECK-ZVBB-NEXT: sltu a3, a0, a2
2589 ; CHECK-ZVBB-NEXT: addi a3, a3, -1
2590 ; CHECK-ZVBB-NEXT: and a2, a3, a2
2591 ; CHECK-ZVBB-NEXT: vsetvli zero, a2, e64, m8, ta, ma
2592 ; CHECK-ZVBB-NEXT: vctz.v v16, v16, v0.t
2593 ; CHECK-ZVBB-NEXT: bltu a0, a1, .LBB46_2
2594 ; CHECK-ZVBB-NEXT: # %bb.1:
2595 ; CHECK-ZVBB-NEXT: mv a0, a1
2596 ; CHECK-ZVBB-NEXT: .LBB46_2:
2597 ; CHECK-ZVBB-NEXT: vmv1r.v v0, v24
2598 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2599 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
2600 ; CHECK-ZVBB-NEXT: ret
2601 %v = call <vscale x 16 x i64> @llvm.vp.cttz.nxv16i64(<vscale x 16 x i64> %va, i1 false, <vscale x 16 x i1> %m, i32 %evl)
2602 ret <vscale x 16 x i64> %v
2605 define <vscale x 16 x i64> @vp_cttz_nxv16i64_unmasked(<vscale x 16 x i64> %va, i32 zeroext %evl) {
2606 ; RV32-LABEL: vp_cttz_nxv16i64_unmasked:
2608 ; RV32-NEXT: addi sp, sp, -16
2609 ; RV32-NEXT: .cfi_def_cfa_offset 16
2610 ; RV32-NEXT: csrr a1, vlenb
2611 ; RV32-NEXT: li a2, 40
2612 ; RV32-NEXT: mul a1, a1, a2
2613 ; RV32-NEXT: sub sp, sp, a1
2614 ; RV32-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x28, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 40 * vlenb
2615 ; RV32-NEXT: csrr a1, vlenb
2616 ; RV32-NEXT: slli a1, a1, 5
2617 ; RV32-NEXT: add a1, sp, a1
2618 ; RV32-NEXT: addi a1, a1, 16
2619 ; RV32-NEXT: vs8r.v v8, (a1) # Unknown-size Folded Spill
2620 ; RV32-NEXT: csrr a1, vlenb
2621 ; RV32-NEXT: sub a2, a0, a1
2622 ; RV32-NEXT: sltu a3, a0, a2
2623 ; RV32-NEXT: addi a3, a3, -1
2624 ; RV32-NEXT: and a3, a3, a2
2625 ; RV32-NEXT: li a2, 1
2626 ; RV32-NEXT: vsetvli zero, a3, e64, m8, ta, ma
2627 ; RV32-NEXT: vsub.vx v8, v16, a2
2628 ; RV32-NEXT: vnot.v v16, v16
2629 ; RV32-NEXT: vand.vv v16, v16, v8
2630 ; RV32-NEXT: vsrl.vi v24, v16, 1
2631 ; RV32-NEXT: lui a4, 349525
2632 ; RV32-NEXT: addi a4, a4, 1365
2633 ; RV32-NEXT: vsetvli a5, zero, e32, m8, ta, ma
2634 ; RV32-NEXT: vmv.v.x v8, a4
2635 ; RV32-NEXT: csrr a4, vlenb
2636 ; RV32-NEXT: li a5, 24
2637 ; RV32-NEXT: mul a4, a4, a5
2638 ; RV32-NEXT: add a4, sp, a4
2639 ; RV32-NEXT: addi a4, a4, 16
2640 ; RV32-NEXT: vs8r.v v8, (a4) # Unknown-size Folded Spill
2641 ; RV32-NEXT: vsetvli zero, a3, e64, m8, ta, ma
2642 ; RV32-NEXT: vand.vv v24, v24, v8
2643 ; RV32-NEXT: vsub.vv v16, v16, v24
2644 ; RV32-NEXT: lui a4, 209715
2645 ; RV32-NEXT: addi a4, a4, 819
2646 ; RV32-NEXT: vsetvli a5, zero, e32, m8, ta, ma
2647 ; RV32-NEXT: vmv.v.x v0, a4
2648 ; RV32-NEXT: vsetvli zero, a3, e64, m8, ta, ma
2649 ; RV32-NEXT: vand.vv v24, v16, v0
2650 ; RV32-NEXT: vsrl.vi v16, v16, 2
2651 ; RV32-NEXT: vand.vv v16, v16, v0
2652 ; RV32-NEXT: vadd.vv v16, v24, v16
2653 ; RV32-NEXT: vsrl.vi v24, v16, 4
2654 ; RV32-NEXT: vadd.vv v16, v16, v24
2655 ; RV32-NEXT: lui a4, 61681
2656 ; RV32-NEXT: addi a4, a4, -241
2657 ; RV32-NEXT: vsetvli a5, zero, e32, m8, ta, ma
2658 ; RV32-NEXT: vmv.v.x v8, a4
2659 ; RV32-NEXT: csrr a4, vlenb
2660 ; RV32-NEXT: slli a4, a4, 4
2661 ; RV32-NEXT: add a4, sp, a4
2662 ; RV32-NEXT: addi a4, a4, 16
2663 ; RV32-NEXT: vs8r.v v8, (a4) # Unknown-size Folded Spill
2664 ; RV32-NEXT: vsetvli zero, a3, e64, m8, ta, ma
2665 ; RV32-NEXT: vand.vv v8, v16, v8
2666 ; RV32-NEXT: lui a4, 4112
2667 ; RV32-NEXT: addi a4, a4, 257
2668 ; RV32-NEXT: vsetvli a5, zero, e32, m8, ta, ma
2669 ; RV32-NEXT: vmv.v.x v16, a4
2670 ; RV32-NEXT: csrr a4, vlenb
2671 ; RV32-NEXT: slli a4, a4, 3
2672 ; RV32-NEXT: add a4, sp, a4
2673 ; RV32-NEXT: addi a4, a4, 16
2674 ; RV32-NEXT: vs8r.v v16, (a4) # Unknown-size Folded Spill
2675 ; RV32-NEXT: vsetvli zero, a3, e64, m8, ta, ma
2676 ; RV32-NEXT: vmul.vv v8, v8, v16
2677 ; RV32-NEXT: li a3, 56
2678 ; RV32-NEXT: vsrl.vx v8, v8, a3
2679 ; RV32-NEXT: addi a4, sp, 16
2680 ; RV32-NEXT: vs8r.v v8, (a4) # Unknown-size Folded Spill
2681 ; RV32-NEXT: bltu a0, a1, .LBB47_2
2682 ; RV32-NEXT: # %bb.1:
2683 ; RV32-NEXT: mv a0, a1
2684 ; RV32-NEXT: .LBB47_2:
2685 ; RV32-NEXT: slli a1, a1, 5
2686 ; RV32-NEXT: add a1, sp, a1
2687 ; RV32-NEXT: addi a1, a1, 16
2688 ; RV32-NEXT: vl8r.v v24, (a1) # Unknown-size Folded Reload
2689 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2690 ; RV32-NEXT: vsub.vx v8, v24, a2
2691 ; RV32-NEXT: vnot.v v24, v24
2692 ; RV32-NEXT: vand.vv v8, v24, v8
2693 ; RV32-NEXT: vsrl.vi v24, v8, 1
2694 ; RV32-NEXT: csrr a0, vlenb
2695 ; RV32-NEXT: li a1, 24
2696 ; RV32-NEXT: mul a0, a0, a1
2697 ; RV32-NEXT: add a0, sp, a0
2698 ; RV32-NEXT: addi a0, a0, 16
2699 ; RV32-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2700 ; RV32-NEXT: vand.vv v24, v24, v16
2701 ; RV32-NEXT: vsub.vv v8, v8, v24
2702 ; RV32-NEXT: vand.vv v24, v8, v0
2703 ; RV32-NEXT: vsrl.vi v8, v8, 2
2704 ; RV32-NEXT: vand.vv v8, v8, v0
2705 ; RV32-NEXT: vadd.vv v8, v24, v8
2706 ; RV32-NEXT: vsrl.vi v24, v8, 4
2707 ; RV32-NEXT: vadd.vv v8, v8, v24
2708 ; RV32-NEXT: csrr a0, vlenb
2709 ; RV32-NEXT: slli a0, a0, 4
2710 ; RV32-NEXT: add a0, sp, a0
2711 ; RV32-NEXT: addi a0, a0, 16
2712 ; RV32-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2713 ; RV32-NEXT: vand.vv v8, v8, v16
2714 ; RV32-NEXT: csrr a0, vlenb
2715 ; RV32-NEXT: slli a0, a0, 3
2716 ; RV32-NEXT: add a0, sp, a0
2717 ; RV32-NEXT: addi a0, a0, 16
2718 ; RV32-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2719 ; RV32-NEXT: vmul.vv v8, v8, v16
2720 ; RV32-NEXT: vsrl.vx v8, v8, a3
2721 ; RV32-NEXT: addi a0, sp, 16
2722 ; RV32-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2723 ; RV32-NEXT: csrr a0, vlenb
2724 ; RV32-NEXT: li a1, 40
2725 ; RV32-NEXT: mul a0, a0, a1
2726 ; RV32-NEXT: add sp, sp, a0
2727 ; RV32-NEXT: addi sp, sp, 16
2730 ; RV64-LABEL: vp_cttz_nxv16i64_unmasked:
2732 ; RV64-NEXT: csrr a1, vlenb
2733 ; RV64-NEXT: sub a2, a0, a1
2734 ; RV64-NEXT: sltu a3, a0, a2
2735 ; RV64-NEXT: addi a3, a3, -1
2736 ; RV64-NEXT: and a3, a3, a2
2737 ; RV64-NEXT: li a2, 1
2738 ; RV64-NEXT: vsetvli zero, a3, e64, m8, ta, ma
2739 ; RV64-NEXT: vsub.vx v24, v16, a2
2740 ; RV64-NEXT: vnot.v v16, v16
2741 ; RV64-NEXT: vand.vv v16, v16, v24
2742 ; RV64-NEXT: vsrl.vi v24, v16, 1
2743 ; RV64-NEXT: lui a3, 349525
2744 ; RV64-NEXT: addiw a3, a3, 1365
2745 ; RV64-NEXT: slli a4, a3, 32
2746 ; RV64-NEXT: add a3, a3, a4
2747 ; RV64-NEXT: vand.vx v24, v24, a3
2748 ; RV64-NEXT: vsub.vv v16, v16, v24
2749 ; RV64-NEXT: lui a4, 209715
2750 ; RV64-NEXT: addiw a4, a4, 819
2751 ; RV64-NEXT: slli a5, a4, 32
2752 ; RV64-NEXT: add a4, a4, a5
2753 ; RV64-NEXT: vand.vx v24, v16, a4
2754 ; RV64-NEXT: vsrl.vi v16, v16, 2
2755 ; RV64-NEXT: vand.vx v16, v16, a4
2756 ; RV64-NEXT: vadd.vv v16, v24, v16
2757 ; RV64-NEXT: vsrl.vi v24, v16, 4
2758 ; RV64-NEXT: vadd.vv v16, v16, v24
2759 ; RV64-NEXT: lui a5, 61681
2760 ; RV64-NEXT: addiw a5, a5, -241
2761 ; RV64-NEXT: slli a6, a5, 32
2762 ; RV64-NEXT: add a5, a5, a6
2763 ; RV64-NEXT: vand.vx v16, v16, a5
2764 ; RV64-NEXT: lui a6, 4112
2765 ; RV64-NEXT: addiw a6, a6, 257
2766 ; RV64-NEXT: slli a7, a6, 32
2767 ; RV64-NEXT: add a6, a6, a7
2768 ; RV64-NEXT: vmul.vx v16, v16, a6
2769 ; RV64-NEXT: li a7, 56
2770 ; RV64-NEXT: vsrl.vx v16, v16, a7
2771 ; RV64-NEXT: bltu a0, a1, .LBB47_2
2772 ; RV64-NEXT: # %bb.1:
2773 ; RV64-NEXT: mv a0, a1
2774 ; RV64-NEXT: .LBB47_2:
2775 ; RV64-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2776 ; RV64-NEXT: vsub.vx v24, v8, a2
2777 ; RV64-NEXT: vnot.v v8, v8
2778 ; RV64-NEXT: vand.vv v8, v8, v24
2779 ; RV64-NEXT: vsrl.vi v24, v8, 1
2780 ; RV64-NEXT: vand.vx v24, v24, a3
2781 ; RV64-NEXT: vsub.vv v8, v8, v24
2782 ; RV64-NEXT: vand.vx v24, v8, a4
2783 ; RV64-NEXT: vsrl.vi v8, v8, 2
2784 ; RV64-NEXT: vand.vx v8, v8, a4
2785 ; RV64-NEXT: vadd.vv v8, v24, v8
2786 ; RV64-NEXT: vsrl.vi v24, v8, 4
2787 ; RV64-NEXT: vadd.vv v8, v8, v24
2788 ; RV64-NEXT: vand.vx v8, v8, a5
2789 ; RV64-NEXT: vmul.vx v8, v8, a6
2790 ; RV64-NEXT: vsrl.vx v8, v8, a7
2793 ; CHECK-ZVBB-LABEL: vp_cttz_nxv16i64_unmasked:
2794 ; CHECK-ZVBB: # %bb.0:
2795 ; CHECK-ZVBB-NEXT: csrr a1, vlenb
2796 ; CHECK-ZVBB-NEXT: sub a2, a0, a1
2797 ; CHECK-ZVBB-NEXT: sltu a3, a0, a2
2798 ; CHECK-ZVBB-NEXT: addi a3, a3, -1
2799 ; CHECK-ZVBB-NEXT: and a2, a3, a2
2800 ; CHECK-ZVBB-NEXT: vsetvli zero, a2, e64, m8, ta, ma
2801 ; CHECK-ZVBB-NEXT: vctz.v v16, v16
2802 ; CHECK-ZVBB-NEXT: bltu a0, a1, .LBB47_2
2803 ; CHECK-ZVBB-NEXT: # %bb.1:
2804 ; CHECK-ZVBB-NEXT: mv a0, a1
2805 ; CHECK-ZVBB-NEXT: .LBB47_2:
2806 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m8, ta, ma
2807 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
2808 ; CHECK-ZVBB-NEXT: ret
2809 %v = call <vscale x 16 x i64> @llvm.vp.cttz.nxv16i64(<vscale x 16 x i64> %va, i1 false, <vscale x 16 x i1> splat (i1 true), i32 %evl)
2810 ret <vscale x 16 x i64> %v
2813 define <vscale x 1 x i8> @vp_cttz_zero_undef_nxv1i8(<vscale x 1 x i8> %va, <vscale x 1 x i1> %m, i32 zeroext %evl) {
2814 ; CHECK-LABEL: vp_cttz_zero_undef_nxv1i8:
2816 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
2817 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
2818 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
2819 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
2820 ; CHECK-NEXT: vzext.vf2 v9, v8, v0.t
2821 ; CHECK-NEXT: vfwcvt.f.xu.v v8, v9, v0.t
2822 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
2823 ; CHECK-NEXT: vsrl.vi v8, v8, 23, v0.t
2824 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
2825 ; CHECK-NEXT: vnsrl.wi v8, v8, 0, v0.t
2826 ; CHECK-NEXT: vsetvli zero, zero, e8, mf8, ta, ma
2827 ; CHECK-NEXT: vnsrl.wi v8, v8, 0, v0.t
2828 ; CHECK-NEXT: li a0, 127
2829 ; CHECK-NEXT: vsub.vx v8, v8, a0, v0.t
2832 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv1i8:
2833 ; CHECK-ZVBB: # %bb.0:
2834 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
2835 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
2836 ; CHECK-ZVBB-NEXT: ret
2837 %v = call <vscale x 1 x i8> @llvm.vp.cttz.nxv1i8(<vscale x 1 x i8> %va, i1 true, <vscale x 1 x i1> %m, i32 %evl)
2838 ret <vscale x 1 x i8> %v
2841 define <vscale x 1 x i8> @vp_cttz_zero_undef_nxv1i8_unmasked(<vscale x 1 x i8> %va, i32 zeroext %evl) {
2842 ; CHECK-LABEL: vp_cttz_zero_undef_nxv1i8_unmasked:
2844 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
2845 ; CHECK-NEXT: vrsub.vi v9, v8, 0
2846 ; CHECK-NEXT: vand.vv v8, v8, v9
2847 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
2848 ; CHECK-NEXT: vzext.vf2 v9, v8
2849 ; CHECK-NEXT: vfwcvt.f.xu.v v8, v9
2850 ; CHECK-NEXT: vnsrl.wi v8, v8, 23
2851 ; CHECK-NEXT: vsetvli zero, zero, e8, mf8, ta, ma
2852 ; CHECK-NEXT: vnsrl.wi v8, v8, 0
2853 ; CHECK-NEXT: li a0, 127
2854 ; CHECK-NEXT: vsub.vx v8, v8, a0
2857 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv1i8_unmasked:
2858 ; CHECK-ZVBB: # %bb.0:
2859 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
2860 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
2861 ; CHECK-ZVBB-NEXT: ret
2862 %v = call <vscale x 1 x i8> @llvm.vp.cttz.nxv1i8(<vscale x 1 x i8> %va, i1 true, <vscale x 1 x i1> splat (i1 true), i32 %evl)
2863 ret <vscale x 1 x i8> %v
2867 define <vscale x 2 x i8> @vp_cttz_zero_undef_nxv2i8(<vscale x 2 x i8> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
2868 ; CHECK-LABEL: vp_cttz_zero_undef_nxv2i8:
2870 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
2871 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
2872 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
2873 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
2874 ; CHECK-NEXT: vzext.vf2 v9, v8, v0.t
2875 ; CHECK-NEXT: vfwcvt.f.xu.v v8, v9, v0.t
2876 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
2877 ; CHECK-NEXT: vsrl.vi v8, v8, 23, v0.t
2878 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
2879 ; CHECK-NEXT: vnsrl.wi v8, v8, 0, v0.t
2880 ; CHECK-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
2881 ; CHECK-NEXT: vnsrl.wi v8, v8, 0, v0.t
2882 ; CHECK-NEXT: li a0, 127
2883 ; CHECK-NEXT: vsub.vx v8, v8, a0, v0.t
2886 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv2i8:
2887 ; CHECK-ZVBB: # %bb.0:
2888 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
2889 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
2890 ; CHECK-ZVBB-NEXT: ret
2891 %v = call <vscale x 2 x i8> @llvm.vp.cttz.nxv2i8(<vscale x 2 x i8> %va, i1 true, <vscale x 2 x i1> %m, i32 %evl)
2892 ret <vscale x 2 x i8> %v
2895 define <vscale x 2 x i8> @vp_cttz_zero_undef_nxv2i8_unmasked(<vscale x 2 x i8> %va, i32 zeroext %evl) {
2896 ; CHECK-LABEL: vp_cttz_zero_undef_nxv2i8_unmasked:
2898 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
2899 ; CHECK-NEXT: vrsub.vi v9, v8, 0
2900 ; CHECK-NEXT: vand.vv v8, v8, v9
2901 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
2902 ; CHECK-NEXT: vzext.vf2 v9, v8
2903 ; CHECK-NEXT: vfwcvt.f.xu.v v8, v9
2904 ; CHECK-NEXT: vnsrl.wi v8, v8, 23
2905 ; CHECK-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
2906 ; CHECK-NEXT: vnsrl.wi v8, v8, 0
2907 ; CHECK-NEXT: li a0, 127
2908 ; CHECK-NEXT: vsub.vx v8, v8, a0
2911 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv2i8_unmasked:
2912 ; CHECK-ZVBB: # %bb.0:
2913 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
2914 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
2915 ; CHECK-ZVBB-NEXT: ret
2916 %v = call <vscale x 2 x i8> @llvm.vp.cttz.nxv2i8(<vscale x 2 x i8> %va, i1 true, <vscale x 2 x i1> splat (i1 true), i32 %evl)
2917 ret <vscale x 2 x i8> %v
2921 define <vscale x 4 x i8> @vp_cttz_zero_undef_nxv4i8(<vscale x 4 x i8> %va, <vscale x 4 x i1> %m, i32 zeroext %evl) {
2922 ; CHECK-LABEL: vp_cttz_zero_undef_nxv4i8:
2924 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
2925 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
2926 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
2927 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
2928 ; CHECK-NEXT: vzext.vf2 v9, v8, v0.t
2929 ; CHECK-NEXT: vfwcvt.f.xu.v v10, v9, v0.t
2930 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
2931 ; CHECK-NEXT: vsrl.vi v8, v10, 23, v0.t
2932 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
2933 ; CHECK-NEXT: vnsrl.wi v10, v8, 0, v0.t
2934 ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
2935 ; CHECK-NEXT: vnsrl.wi v8, v10, 0, v0.t
2936 ; CHECK-NEXT: li a0, 127
2937 ; CHECK-NEXT: vsub.vx v8, v8, a0, v0.t
2940 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv4i8:
2941 ; CHECK-ZVBB: # %bb.0:
2942 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
2943 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
2944 ; CHECK-ZVBB-NEXT: ret
2945 %v = call <vscale x 4 x i8> @llvm.vp.cttz.nxv4i8(<vscale x 4 x i8> %va, i1 true, <vscale x 4 x i1> %m, i32 %evl)
2946 ret <vscale x 4 x i8> %v
2949 define <vscale x 4 x i8> @vp_cttz_zero_undef_nxv4i8_unmasked(<vscale x 4 x i8> %va, i32 zeroext %evl) {
2950 ; CHECK-LABEL: vp_cttz_zero_undef_nxv4i8_unmasked:
2952 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
2953 ; CHECK-NEXT: vrsub.vi v9, v8, 0
2954 ; CHECK-NEXT: vand.vv v8, v8, v9
2955 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
2956 ; CHECK-NEXT: vzext.vf2 v9, v8
2957 ; CHECK-NEXT: vfwcvt.f.xu.v v10, v9
2958 ; CHECK-NEXT: vnsrl.wi v8, v10, 23
2959 ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
2960 ; CHECK-NEXT: vnsrl.wi v8, v8, 0
2961 ; CHECK-NEXT: li a0, 127
2962 ; CHECK-NEXT: vsub.vx v8, v8, a0
2965 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv4i8_unmasked:
2966 ; CHECK-ZVBB: # %bb.0:
2967 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
2968 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
2969 ; CHECK-ZVBB-NEXT: ret
2970 %v = call <vscale x 4 x i8> @llvm.vp.cttz.nxv4i8(<vscale x 4 x i8> %va, i1 true, <vscale x 4 x i1> splat (i1 true), i32 %evl)
2971 ret <vscale x 4 x i8> %v
2975 define <vscale x 8 x i8> @vp_cttz_zero_undef_nxv8i8(<vscale x 8 x i8> %va, <vscale x 8 x i1> %m, i32 zeroext %evl) {
2976 ; CHECK-LABEL: vp_cttz_zero_undef_nxv8i8:
2978 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
2979 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
2980 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
2981 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
2982 ; CHECK-NEXT: vzext.vf2 v10, v8, v0.t
2983 ; CHECK-NEXT: vfwcvt.f.xu.v v12, v10, v0.t
2984 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, ma
2985 ; CHECK-NEXT: vsrl.vi v8, v12, 23, v0.t
2986 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
2987 ; CHECK-NEXT: vnsrl.wi v12, v8, 0, v0.t
2988 ; CHECK-NEXT: vsetvli zero, zero, e8, m1, ta, ma
2989 ; CHECK-NEXT: vnsrl.wi v8, v12, 0, v0.t
2990 ; CHECK-NEXT: li a0, 127
2991 ; CHECK-NEXT: vsub.vx v8, v8, a0, v0.t
2994 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv8i8:
2995 ; CHECK-ZVBB: # %bb.0:
2996 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m1, ta, ma
2997 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
2998 ; CHECK-ZVBB-NEXT: ret
2999 %v = call <vscale x 8 x i8> @llvm.vp.cttz.nxv8i8(<vscale x 8 x i8> %va, i1 true, <vscale x 8 x i1> %m, i32 %evl)
3000 ret <vscale x 8 x i8> %v
3003 define <vscale x 8 x i8> @vp_cttz_zero_undef_nxv8i8_unmasked(<vscale x 8 x i8> %va, i32 zeroext %evl) {
3004 ; CHECK-LABEL: vp_cttz_zero_undef_nxv8i8_unmasked:
3006 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
3007 ; CHECK-NEXT: vrsub.vi v9, v8, 0
3008 ; CHECK-NEXT: vand.vv v8, v8, v9
3009 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
3010 ; CHECK-NEXT: vzext.vf2 v10, v8
3011 ; CHECK-NEXT: vfwcvt.f.xu.v v12, v10
3012 ; CHECK-NEXT: vnsrl.wi v8, v12, 23
3013 ; CHECK-NEXT: vsetvli zero, zero, e8, m1, ta, ma
3014 ; CHECK-NEXT: vnsrl.wi v10, v8, 0
3015 ; CHECK-NEXT: li a0, 127
3016 ; CHECK-NEXT: vsub.vx v8, v10, a0
3019 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv8i8_unmasked:
3020 ; CHECK-ZVBB: # %bb.0:
3021 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m1, ta, ma
3022 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3023 ; CHECK-ZVBB-NEXT: ret
3024 %v = call <vscale x 8 x i8> @llvm.vp.cttz.nxv8i8(<vscale x 8 x i8> %va, i1 true, <vscale x 8 x i1> splat (i1 true), i32 %evl)
3025 ret <vscale x 8 x i8> %v
3029 define <vscale x 16 x i8> @vp_cttz_zero_undef_nxv16i8(<vscale x 16 x i8> %va, <vscale x 16 x i1> %m, i32 zeroext %evl) {
3030 ; CHECK-LABEL: vp_cttz_zero_undef_nxv16i8:
3032 ; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, ma
3033 ; CHECK-NEXT: vrsub.vi v10, v8, 0, v0.t
3034 ; CHECK-NEXT: vand.vv v8, v8, v10, v0.t
3035 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, ma
3036 ; CHECK-NEXT: vzext.vf2 v12, v8, v0.t
3037 ; CHECK-NEXT: vfwcvt.f.xu.v v16, v12, v0.t
3038 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, ma
3039 ; CHECK-NEXT: vsrl.vi v8, v16, 23, v0.t
3040 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, ma
3041 ; CHECK-NEXT: vnsrl.wi v16, v8, 0, v0.t
3042 ; CHECK-NEXT: vsetvli zero, zero, e8, m2, ta, ma
3043 ; CHECK-NEXT: vnsrl.wi v8, v16, 0, v0.t
3044 ; CHECK-NEXT: li a0, 127
3045 ; CHECK-NEXT: vsub.vx v8, v8, a0, v0.t
3048 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv16i8:
3049 ; CHECK-ZVBB: # %bb.0:
3050 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m2, ta, ma
3051 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3052 ; CHECK-ZVBB-NEXT: ret
3053 %v = call <vscale x 16 x i8> @llvm.vp.cttz.nxv16i8(<vscale x 16 x i8> %va, i1 true, <vscale x 16 x i1> %m, i32 %evl)
3054 ret <vscale x 16 x i8> %v
3057 define <vscale x 16 x i8> @vp_cttz_zero_undef_nxv16i8_unmasked(<vscale x 16 x i8> %va, i32 zeroext %evl) {
3058 ; CHECK-LABEL: vp_cttz_zero_undef_nxv16i8_unmasked:
3060 ; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, ma
3061 ; CHECK-NEXT: vrsub.vi v10, v8, 0
3062 ; CHECK-NEXT: vand.vv v8, v8, v10
3063 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, ma
3064 ; CHECK-NEXT: vzext.vf2 v12, v8
3065 ; CHECK-NEXT: vfwcvt.f.xu.v v16, v12
3066 ; CHECK-NEXT: vnsrl.wi v8, v16, 23
3067 ; CHECK-NEXT: vsetvli zero, zero, e8, m2, ta, ma
3068 ; CHECK-NEXT: vnsrl.wi v12, v8, 0
3069 ; CHECK-NEXT: li a0, 127
3070 ; CHECK-NEXT: vsub.vx v8, v12, a0
3073 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv16i8_unmasked:
3074 ; CHECK-ZVBB: # %bb.0:
3075 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m2, ta, ma
3076 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3077 ; CHECK-ZVBB-NEXT: ret
3078 %v = call <vscale x 16 x i8> @llvm.vp.cttz.nxv16i8(<vscale x 16 x i8> %va, i1 true, <vscale x 16 x i1> splat (i1 true), i32 %evl)
3079 ret <vscale x 16 x i8> %v
3083 define <vscale x 32 x i8> @vp_cttz_zero_undef_nxv32i8(<vscale x 32 x i8> %va, <vscale x 32 x i1> %m, i32 zeroext %evl) {
3084 ; CHECK-LABEL: vp_cttz_zero_undef_nxv32i8:
3086 ; CHECK-NEXT: li a1, 1
3087 ; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, ma
3088 ; CHECK-NEXT: vsub.vx v12, v8, a1, v0.t
3089 ; CHECK-NEXT: vnot.v v8, v8, v0.t
3090 ; CHECK-NEXT: vand.vv v8, v8, v12, v0.t
3091 ; CHECK-NEXT: vsrl.vi v12, v8, 1, v0.t
3092 ; CHECK-NEXT: li a0, 85
3093 ; CHECK-NEXT: vand.vx v12, v12, a0, v0.t
3094 ; CHECK-NEXT: vsub.vv v8, v8, v12, v0.t
3095 ; CHECK-NEXT: li a0, 51
3096 ; CHECK-NEXT: vand.vx v12, v8, a0, v0.t
3097 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
3098 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
3099 ; CHECK-NEXT: vadd.vv v8, v12, v8, v0.t
3100 ; CHECK-NEXT: vsrl.vi v12, v8, 4, v0.t
3101 ; CHECK-NEXT: vadd.vv v8, v8, v12, v0.t
3102 ; CHECK-NEXT: vand.vi v8, v8, 15, v0.t
3105 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv32i8:
3106 ; CHECK-ZVBB: # %bb.0:
3107 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m4, ta, ma
3108 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3109 ; CHECK-ZVBB-NEXT: ret
3110 %v = call <vscale x 32 x i8> @llvm.vp.cttz.nxv32i8(<vscale x 32 x i8> %va, i1 true, <vscale x 32 x i1> %m, i32 %evl)
3111 ret <vscale x 32 x i8> %v
3114 define <vscale x 32 x i8> @vp_cttz_zero_undef_nxv32i8_unmasked(<vscale x 32 x i8> %va, i32 zeroext %evl) {
3115 ; CHECK-LABEL: vp_cttz_zero_undef_nxv32i8_unmasked:
3117 ; CHECK-NEXT: li a1, 1
3118 ; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, ma
3119 ; CHECK-NEXT: vsub.vx v12, v8, a1
3120 ; CHECK-NEXT: vnot.v v8, v8
3121 ; CHECK-NEXT: vand.vv v8, v8, v12
3122 ; CHECK-NEXT: vsrl.vi v12, v8, 1
3123 ; CHECK-NEXT: li a0, 85
3124 ; CHECK-NEXT: vand.vx v12, v12, a0
3125 ; CHECK-NEXT: vsub.vv v8, v8, v12
3126 ; CHECK-NEXT: li a0, 51
3127 ; CHECK-NEXT: vand.vx v12, v8, a0
3128 ; CHECK-NEXT: vsrl.vi v8, v8, 2
3129 ; CHECK-NEXT: vand.vx v8, v8, a0
3130 ; CHECK-NEXT: vadd.vv v8, v12, v8
3131 ; CHECK-NEXT: vsrl.vi v12, v8, 4
3132 ; CHECK-NEXT: vadd.vv v8, v8, v12
3133 ; CHECK-NEXT: vand.vi v8, v8, 15
3136 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv32i8_unmasked:
3137 ; CHECK-ZVBB: # %bb.0:
3138 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m4, ta, ma
3139 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3140 ; CHECK-ZVBB-NEXT: ret
3141 %v = call <vscale x 32 x i8> @llvm.vp.cttz.nxv32i8(<vscale x 32 x i8> %va, i1 true, <vscale x 32 x i1> splat (i1 true), i32 %evl)
3142 ret <vscale x 32 x i8> %v
3146 define <vscale x 64 x i8> @vp_cttz_zero_undef_nxv64i8(<vscale x 64 x i8> %va, <vscale x 64 x i1> %m, i32 zeroext %evl) {
3147 ; CHECK-LABEL: vp_cttz_zero_undef_nxv64i8:
3149 ; CHECK-NEXT: li a1, 1
3150 ; CHECK-NEXT: vsetvli zero, a0, e8, m8, ta, ma
3151 ; CHECK-NEXT: vsub.vx v16, v8, a1, v0.t
3152 ; CHECK-NEXT: vnot.v v8, v8, v0.t
3153 ; CHECK-NEXT: vand.vv v8, v8, v16, v0.t
3154 ; CHECK-NEXT: vsrl.vi v16, v8, 1, v0.t
3155 ; CHECK-NEXT: li a0, 85
3156 ; CHECK-NEXT: vand.vx v16, v16, a0, v0.t
3157 ; CHECK-NEXT: vsub.vv v8, v8, v16, v0.t
3158 ; CHECK-NEXT: li a0, 51
3159 ; CHECK-NEXT: vand.vx v16, v8, a0, v0.t
3160 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
3161 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
3162 ; CHECK-NEXT: vadd.vv v8, v16, v8, v0.t
3163 ; CHECK-NEXT: vsrl.vi v16, v8, 4, v0.t
3164 ; CHECK-NEXT: vadd.vv v8, v8, v16, v0.t
3165 ; CHECK-NEXT: vand.vi v8, v8, 15, v0.t
3168 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv64i8:
3169 ; CHECK-ZVBB: # %bb.0:
3170 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m8, ta, ma
3171 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3172 ; CHECK-ZVBB-NEXT: ret
3173 %v = call <vscale x 64 x i8> @llvm.vp.cttz.nxv64i8(<vscale x 64 x i8> %va, i1 true, <vscale x 64 x i1> %m, i32 %evl)
3174 ret <vscale x 64 x i8> %v
3177 define <vscale x 64 x i8> @vp_cttz_zero_undef_nxv64i8_unmasked(<vscale x 64 x i8> %va, i32 zeroext %evl) {
3178 ; CHECK-LABEL: vp_cttz_zero_undef_nxv64i8_unmasked:
3180 ; CHECK-NEXT: li a1, 1
3181 ; CHECK-NEXT: vsetvli zero, a0, e8, m8, ta, ma
3182 ; CHECK-NEXT: vsub.vx v16, v8, a1
3183 ; CHECK-NEXT: vnot.v v8, v8
3184 ; CHECK-NEXT: vand.vv v8, v8, v16
3185 ; CHECK-NEXT: vsrl.vi v16, v8, 1
3186 ; CHECK-NEXT: li a0, 85
3187 ; CHECK-NEXT: vand.vx v16, v16, a0
3188 ; CHECK-NEXT: vsub.vv v8, v8, v16
3189 ; CHECK-NEXT: li a0, 51
3190 ; CHECK-NEXT: vand.vx v16, v8, a0
3191 ; CHECK-NEXT: vsrl.vi v8, v8, 2
3192 ; CHECK-NEXT: vand.vx v8, v8, a0
3193 ; CHECK-NEXT: vadd.vv v8, v16, v8
3194 ; CHECK-NEXT: vsrl.vi v16, v8, 4
3195 ; CHECK-NEXT: vadd.vv v8, v8, v16
3196 ; CHECK-NEXT: vand.vi v8, v8, 15
3199 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv64i8_unmasked:
3200 ; CHECK-ZVBB: # %bb.0:
3201 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e8, m8, ta, ma
3202 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3203 ; CHECK-ZVBB-NEXT: ret
3204 %v = call <vscale x 64 x i8> @llvm.vp.cttz.nxv64i8(<vscale x 64 x i8> %va, i1 true, <vscale x 64 x i1> splat (i1 true), i32 %evl)
3205 ret <vscale x 64 x i8> %v
3209 define <vscale x 1 x i16> @vp_cttz_zero_undef_nxv1i16(<vscale x 1 x i16> %va, <vscale x 1 x i1> %m, i32 zeroext %evl) {
3210 ; CHECK-LABEL: vp_cttz_zero_undef_nxv1i16:
3212 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
3213 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
3214 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
3215 ; CHECK-NEXT: vfwcvt.f.xu.v v9, v8, v0.t
3216 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
3217 ; CHECK-NEXT: vsrl.vi v8, v9, 23, v0.t
3218 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
3219 ; CHECK-NEXT: vnsrl.wi v8, v8, 0, v0.t
3220 ; CHECK-NEXT: li a0, 127
3221 ; CHECK-NEXT: vsub.vx v8, v8, a0, v0.t
3224 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv1i16:
3225 ; CHECK-ZVBB: # %bb.0:
3226 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
3227 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3228 ; CHECK-ZVBB-NEXT: ret
3229 %v = call <vscale x 1 x i16> @llvm.vp.cttz.nxv1i16(<vscale x 1 x i16> %va, i1 true, <vscale x 1 x i1> %m, i32 %evl)
3230 ret <vscale x 1 x i16> %v
3233 define <vscale x 1 x i16> @vp_cttz_zero_undef_nxv1i16_unmasked(<vscale x 1 x i16> %va, i32 zeroext %evl) {
3234 ; CHECK-LABEL: vp_cttz_zero_undef_nxv1i16_unmasked:
3236 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
3237 ; CHECK-NEXT: vrsub.vi v9, v8, 0
3238 ; CHECK-NEXT: vand.vv v8, v8, v9
3239 ; CHECK-NEXT: vfwcvt.f.xu.v v9, v8
3240 ; CHECK-NEXT: vnsrl.wi v8, v9, 23
3241 ; CHECK-NEXT: li a0, 127
3242 ; CHECK-NEXT: vsub.vx v8, v8, a0
3245 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv1i16_unmasked:
3246 ; CHECK-ZVBB: # %bb.0:
3247 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
3248 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3249 ; CHECK-ZVBB-NEXT: ret
3250 %v = call <vscale x 1 x i16> @llvm.vp.cttz.nxv1i16(<vscale x 1 x i16> %va, i1 true, <vscale x 1 x i1> splat (i1 true), i32 %evl)
3251 ret <vscale x 1 x i16> %v
3255 define <vscale x 2 x i16> @vp_cttz_zero_undef_nxv2i16(<vscale x 2 x i16> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
3256 ; CHECK-LABEL: vp_cttz_zero_undef_nxv2i16:
3258 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
3259 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
3260 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
3261 ; CHECK-NEXT: vfwcvt.f.xu.v v9, v8, v0.t
3262 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
3263 ; CHECK-NEXT: vsrl.vi v8, v9, 23, v0.t
3264 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
3265 ; CHECK-NEXT: vnsrl.wi v8, v8, 0, v0.t
3266 ; CHECK-NEXT: li a0, 127
3267 ; CHECK-NEXT: vsub.vx v8, v8, a0, v0.t
3270 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv2i16:
3271 ; CHECK-ZVBB: # %bb.0:
3272 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
3273 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3274 ; CHECK-ZVBB-NEXT: ret
3275 %v = call <vscale x 2 x i16> @llvm.vp.cttz.nxv2i16(<vscale x 2 x i16> %va, i1 true, <vscale x 2 x i1> %m, i32 %evl)
3276 ret <vscale x 2 x i16> %v
3279 define <vscale x 2 x i16> @vp_cttz_zero_undef_nxv2i16_unmasked(<vscale x 2 x i16> %va, i32 zeroext %evl) {
3280 ; CHECK-LABEL: vp_cttz_zero_undef_nxv2i16_unmasked:
3282 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
3283 ; CHECK-NEXT: vrsub.vi v9, v8, 0
3284 ; CHECK-NEXT: vand.vv v8, v8, v9
3285 ; CHECK-NEXT: vfwcvt.f.xu.v v9, v8
3286 ; CHECK-NEXT: vnsrl.wi v8, v9, 23
3287 ; CHECK-NEXT: li a0, 127
3288 ; CHECK-NEXT: vsub.vx v8, v8, a0
3291 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv2i16_unmasked:
3292 ; CHECK-ZVBB: # %bb.0:
3293 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
3294 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3295 ; CHECK-ZVBB-NEXT: ret
3296 %v = call <vscale x 2 x i16> @llvm.vp.cttz.nxv2i16(<vscale x 2 x i16> %va, i1 true, <vscale x 2 x i1> splat (i1 true), i32 %evl)
3297 ret <vscale x 2 x i16> %v
3301 define <vscale x 4 x i16> @vp_cttz_zero_undef_nxv4i16(<vscale x 4 x i16> %va, <vscale x 4 x i1> %m, i32 zeroext %evl) {
3302 ; CHECK-LABEL: vp_cttz_zero_undef_nxv4i16:
3304 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
3305 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
3306 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
3307 ; CHECK-NEXT: vfwcvt.f.xu.v v10, v8, v0.t
3308 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
3309 ; CHECK-NEXT: vsrl.vi v8, v10, 23, v0.t
3310 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
3311 ; CHECK-NEXT: vnsrl.wi v10, v8, 0, v0.t
3312 ; CHECK-NEXT: li a0, 127
3313 ; CHECK-NEXT: vsub.vx v8, v10, a0, v0.t
3316 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv4i16:
3317 ; CHECK-ZVBB: # %bb.0:
3318 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m1, ta, ma
3319 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3320 ; CHECK-ZVBB-NEXT: ret
3321 %v = call <vscale x 4 x i16> @llvm.vp.cttz.nxv4i16(<vscale x 4 x i16> %va, i1 true, <vscale x 4 x i1> %m, i32 %evl)
3322 ret <vscale x 4 x i16> %v
3325 define <vscale x 4 x i16> @vp_cttz_zero_undef_nxv4i16_unmasked(<vscale x 4 x i16> %va, i32 zeroext %evl) {
3326 ; CHECK-LABEL: vp_cttz_zero_undef_nxv4i16_unmasked:
3328 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
3329 ; CHECK-NEXT: vrsub.vi v9, v8, 0
3330 ; CHECK-NEXT: vand.vv v8, v8, v9
3331 ; CHECK-NEXT: vfwcvt.f.xu.v v10, v8
3332 ; CHECK-NEXT: vnsrl.wi v8, v10, 23
3333 ; CHECK-NEXT: li a0, 127
3334 ; CHECK-NEXT: vsub.vx v8, v8, a0
3337 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv4i16_unmasked:
3338 ; CHECK-ZVBB: # %bb.0:
3339 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m1, ta, ma
3340 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3341 ; CHECK-ZVBB-NEXT: ret
3342 %v = call <vscale x 4 x i16> @llvm.vp.cttz.nxv4i16(<vscale x 4 x i16> %va, i1 true, <vscale x 4 x i1> splat (i1 true), i32 %evl)
3343 ret <vscale x 4 x i16> %v
3347 define <vscale x 8 x i16> @vp_cttz_zero_undef_nxv8i16(<vscale x 8 x i16> %va, <vscale x 8 x i1> %m, i32 zeroext %evl) {
3348 ; CHECK-LABEL: vp_cttz_zero_undef_nxv8i16:
3350 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
3351 ; CHECK-NEXT: vrsub.vi v10, v8, 0, v0.t
3352 ; CHECK-NEXT: vand.vv v8, v8, v10, v0.t
3353 ; CHECK-NEXT: vfwcvt.f.xu.v v12, v8, v0.t
3354 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, ma
3355 ; CHECK-NEXT: vsrl.vi v8, v12, 23, v0.t
3356 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
3357 ; CHECK-NEXT: vnsrl.wi v12, v8, 0, v0.t
3358 ; CHECK-NEXT: li a0, 127
3359 ; CHECK-NEXT: vsub.vx v8, v12, a0, v0.t
3362 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv8i16:
3363 ; CHECK-ZVBB: # %bb.0:
3364 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m2, ta, ma
3365 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3366 ; CHECK-ZVBB-NEXT: ret
3367 %v = call <vscale x 8 x i16> @llvm.vp.cttz.nxv8i16(<vscale x 8 x i16> %va, i1 true, <vscale x 8 x i1> %m, i32 %evl)
3368 ret <vscale x 8 x i16> %v
3371 define <vscale x 8 x i16> @vp_cttz_zero_undef_nxv8i16_unmasked(<vscale x 8 x i16> %va, i32 zeroext %evl) {
3372 ; CHECK-LABEL: vp_cttz_zero_undef_nxv8i16_unmasked:
3374 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
3375 ; CHECK-NEXT: vrsub.vi v10, v8, 0
3376 ; CHECK-NEXT: vand.vv v8, v8, v10
3377 ; CHECK-NEXT: vfwcvt.f.xu.v v12, v8
3378 ; CHECK-NEXT: vnsrl.wi v8, v12, 23
3379 ; CHECK-NEXT: li a0, 127
3380 ; CHECK-NEXT: vsub.vx v8, v8, a0
3383 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv8i16_unmasked:
3384 ; CHECK-ZVBB: # %bb.0:
3385 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m2, ta, ma
3386 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3387 ; CHECK-ZVBB-NEXT: ret
3388 %v = call <vscale x 8 x i16> @llvm.vp.cttz.nxv8i16(<vscale x 8 x i16> %va, i1 true, <vscale x 8 x i1> splat (i1 true), i32 %evl)
3389 ret <vscale x 8 x i16> %v
3393 define <vscale x 16 x i16> @vp_cttz_zero_undef_nxv16i16(<vscale x 16 x i16> %va, <vscale x 16 x i1> %m, i32 zeroext %evl) {
3394 ; CHECK-LABEL: vp_cttz_zero_undef_nxv16i16:
3396 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
3397 ; CHECK-NEXT: vrsub.vi v12, v8, 0, v0.t
3398 ; CHECK-NEXT: vand.vv v8, v8, v12, v0.t
3399 ; CHECK-NEXT: vfwcvt.f.xu.v v16, v8, v0.t
3400 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, ma
3401 ; CHECK-NEXT: vsrl.vi v8, v16, 23, v0.t
3402 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, ma
3403 ; CHECK-NEXT: vnsrl.wi v16, v8, 0, v0.t
3404 ; CHECK-NEXT: li a0, 127
3405 ; CHECK-NEXT: vsub.vx v8, v16, a0, v0.t
3408 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv16i16:
3409 ; CHECK-ZVBB: # %bb.0:
3410 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m4, ta, ma
3411 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3412 ; CHECK-ZVBB-NEXT: ret
3413 %v = call <vscale x 16 x i16> @llvm.vp.cttz.nxv16i16(<vscale x 16 x i16> %va, i1 true, <vscale x 16 x i1> %m, i32 %evl)
3414 ret <vscale x 16 x i16> %v
3417 define <vscale x 16 x i16> @vp_cttz_zero_undef_nxv16i16_unmasked(<vscale x 16 x i16> %va, i32 zeroext %evl) {
3418 ; CHECK-LABEL: vp_cttz_zero_undef_nxv16i16_unmasked:
3420 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
3421 ; CHECK-NEXT: vrsub.vi v12, v8, 0
3422 ; CHECK-NEXT: vand.vv v8, v8, v12
3423 ; CHECK-NEXT: vfwcvt.f.xu.v v16, v8
3424 ; CHECK-NEXT: vnsrl.wi v8, v16, 23
3425 ; CHECK-NEXT: li a0, 127
3426 ; CHECK-NEXT: vsub.vx v8, v8, a0
3429 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv16i16_unmasked:
3430 ; CHECK-ZVBB: # %bb.0:
3431 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m4, ta, ma
3432 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3433 ; CHECK-ZVBB-NEXT: ret
3434 %v = call <vscale x 16 x i16> @llvm.vp.cttz.nxv16i16(<vscale x 16 x i16> %va, i1 true, <vscale x 16 x i1> splat (i1 true), i32 %evl)
3435 ret <vscale x 16 x i16> %v
3439 define <vscale x 32 x i16> @vp_cttz_zero_undef_nxv32i16(<vscale x 32 x i16> %va, <vscale x 32 x i1> %m, i32 zeroext %evl) {
3440 ; CHECK-LABEL: vp_cttz_zero_undef_nxv32i16:
3442 ; CHECK-NEXT: li a1, 1
3443 ; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, ma
3444 ; CHECK-NEXT: vsub.vx v16, v8, a1, v0.t
3445 ; CHECK-NEXT: vnot.v v8, v8, v0.t
3446 ; CHECK-NEXT: vand.vv v8, v8, v16, v0.t
3447 ; CHECK-NEXT: vsrl.vi v16, v8, 1, v0.t
3448 ; CHECK-NEXT: lui a0, 5
3449 ; CHECK-NEXT: addi a0, a0, 1365
3450 ; CHECK-NEXT: vand.vx v16, v16, a0, v0.t
3451 ; CHECK-NEXT: vsub.vv v8, v8, v16, v0.t
3452 ; CHECK-NEXT: lui a0, 3
3453 ; CHECK-NEXT: addi a0, a0, 819
3454 ; CHECK-NEXT: vand.vx v16, v8, a0, v0.t
3455 ; CHECK-NEXT: vsrl.vi v8, v8, 2, v0.t
3456 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
3457 ; CHECK-NEXT: vadd.vv v8, v16, v8, v0.t
3458 ; CHECK-NEXT: vsrl.vi v16, v8, 4, v0.t
3459 ; CHECK-NEXT: vadd.vv v8, v8, v16, v0.t
3460 ; CHECK-NEXT: lui a0, 1
3461 ; CHECK-NEXT: addi a0, a0, -241
3462 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
3463 ; CHECK-NEXT: li a0, 257
3464 ; CHECK-NEXT: vmul.vx v8, v8, a0, v0.t
3465 ; CHECK-NEXT: vsrl.vi v8, v8, 8, v0.t
3468 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv32i16:
3469 ; CHECK-ZVBB: # %bb.0:
3470 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m8, ta, ma
3471 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3472 ; CHECK-ZVBB-NEXT: ret
3473 %v = call <vscale x 32 x i16> @llvm.vp.cttz.nxv32i16(<vscale x 32 x i16> %va, i1 true, <vscale x 32 x i1> %m, i32 %evl)
3474 ret <vscale x 32 x i16> %v
3477 define <vscale x 32 x i16> @vp_cttz_zero_undef_nxv32i16_unmasked(<vscale x 32 x i16> %va, i32 zeroext %evl) {
3478 ; CHECK-LABEL: vp_cttz_zero_undef_nxv32i16_unmasked:
3480 ; CHECK-NEXT: li a1, 1
3481 ; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, ma
3482 ; CHECK-NEXT: vsub.vx v16, v8, a1
3483 ; CHECK-NEXT: vnot.v v8, v8
3484 ; CHECK-NEXT: vand.vv v8, v8, v16
3485 ; CHECK-NEXT: vsrl.vi v16, v8, 1
3486 ; CHECK-NEXT: lui a0, 5
3487 ; CHECK-NEXT: addi a0, a0, 1365
3488 ; CHECK-NEXT: vand.vx v16, v16, a0
3489 ; CHECK-NEXT: vsub.vv v8, v8, v16
3490 ; CHECK-NEXT: lui a0, 3
3491 ; CHECK-NEXT: addi a0, a0, 819
3492 ; CHECK-NEXT: vand.vx v16, v8, a0
3493 ; CHECK-NEXT: vsrl.vi v8, v8, 2
3494 ; CHECK-NEXT: vand.vx v8, v8, a0
3495 ; CHECK-NEXT: vadd.vv v8, v16, v8
3496 ; CHECK-NEXT: vsrl.vi v16, v8, 4
3497 ; CHECK-NEXT: vadd.vv v8, v8, v16
3498 ; CHECK-NEXT: lui a0, 1
3499 ; CHECK-NEXT: addi a0, a0, -241
3500 ; CHECK-NEXT: vand.vx v8, v8, a0
3501 ; CHECK-NEXT: li a0, 257
3502 ; CHECK-NEXT: vmul.vx v8, v8, a0
3503 ; CHECK-NEXT: vsrl.vi v8, v8, 8
3506 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv32i16_unmasked:
3507 ; CHECK-ZVBB: # %bb.0:
3508 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, m8, ta, ma
3509 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3510 ; CHECK-ZVBB-NEXT: ret
3511 %v = call <vscale x 32 x i16> @llvm.vp.cttz.nxv32i16(<vscale x 32 x i16> %va, i1 true, <vscale x 32 x i1> splat (i1 true), i32 %evl)
3512 ret <vscale x 32 x i16> %v
3516 define <vscale x 1 x i32> @vp_cttz_zero_undef_nxv1i32(<vscale x 1 x i32> %va, <vscale x 1 x i1> %m, i32 zeroext %evl) {
3517 ; CHECK-LABEL: vp_cttz_zero_undef_nxv1i32:
3519 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
3520 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
3521 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
3522 ; CHECK-NEXT: vfwcvt.f.xu.v v9, v8, v0.t
3523 ; CHECK-NEXT: li a0, 52
3524 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, ma
3525 ; CHECK-NEXT: vsrl.vx v8, v9, a0, v0.t
3526 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
3527 ; CHECK-NEXT: vnsrl.wi v8, v8, 0, v0.t
3528 ; CHECK-NEXT: li a0, 1023
3529 ; CHECK-NEXT: vsub.vx v8, v8, a0, v0.t
3532 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv1i32:
3533 ; CHECK-ZVBB: # %bb.0:
3534 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
3535 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3536 ; CHECK-ZVBB-NEXT: ret
3537 %v = call <vscale x 1 x i32> @llvm.vp.cttz.nxv1i32(<vscale x 1 x i32> %va, i1 true, <vscale x 1 x i1> %m, i32 %evl)
3538 ret <vscale x 1 x i32> %v
3541 define <vscale x 1 x i32> @vp_cttz_zero_undef_nxv1i32_unmasked(<vscale x 1 x i32> %va, i32 zeroext %evl) {
3542 ; CHECK-LABEL: vp_cttz_zero_undef_nxv1i32_unmasked:
3544 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
3545 ; CHECK-NEXT: vrsub.vi v9, v8, 0
3546 ; CHECK-NEXT: vand.vv v8, v8, v9
3547 ; CHECK-NEXT: vfwcvt.f.xu.v v9, v8
3548 ; CHECK-NEXT: li a0, 52
3549 ; CHECK-NEXT: vnsrl.wx v8, v9, a0
3550 ; CHECK-NEXT: li a0, 1023
3551 ; CHECK-NEXT: vsub.vx v8, v8, a0
3554 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv1i32_unmasked:
3555 ; CHECK-ZVBB: # %bb.0:
3556 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
3557 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3558 ; CHECK-ZVBB-NEXT: ret
3559 %v = call <vscale x 1 x i32> @llvm.vp.cttz.nxv1i32(<vscale x 1 x i32> %va, i1 true, <vscale x 1 x i1> splat (i1 true), i32 %evl)
3560 ret <vscale x 1 x i32> %v
3564 define <vscale x 2 x i32> @vp_cttz_zero_undef_nxv2i32(<vscale x 2 x i32> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
3565 ; CHECK-LABEL: vp_cttz_zero_undef_nxv2i32:
3567 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
3568 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
3569 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
3570 ; CHECK-NEXT: vfwcvt.f.xu.v v10, v8, v0.t
3571 ; CHECK-NEXT: li a0, 52
3572 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, ma
3573 ; CHECK-NEXT: vsrl.vx v8, v10, a0, v0.t
3574 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
3575 ; CHECK-NEXT: vnsrl.wi v10, v8, 0, v0.t
3576 ; CHECK-NEXT: li a0, 1023
3577 ; CHECK-NEXT: vsub.vx v8, v10, a0, v0.t
3580 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv2i32:
3581 ; CHECK-ZVBB: # %bb.0:
3582 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m1, ta, ma
3583 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3584 ; CHECK-ZVBB-NEXT: ret
3585 %v = call <vscale x 2 x i32> @llvm.vp.cttz.nxv2i32(<vscale x 2 x i32> %va, i1 true, <vscale x 2 x i1> %m, i32 %evl)
3586 ret <vscale x 2 x i32> %v
3589 define <vscale x 2 x i32> @vp_cttz_zero_undef_nxv2i32_unmasked(<vscale x 2 x i32> %va, i32 zeroext %evl) {
3590 ; CHECK-LABEL: vp_cttz_zero_undef_nxv2i32_unmasked:
3592 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
3593 ; CHECK-NEXT: vrsub.vi v9, v8, 0
3594 ; CHECK-NEXT: vand.vv v8, v8, v9
3595 ; CHECK-NEXT: vfwcvt.f.xu.v v10, v8
3596 ; CHECK-NEXT: li a0, 52
3597 ; CHECK-NEXT: vnsrl.wx v8, v10, a0
3598 ; CHECK-NEXT: li a0, 1023
3599 ; CHECK-NEXT: vsub.vx v8, v8, a0
3602 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv2i32_unmasked:
3603 ; CHECK-ZVBB: # %bb.0:
3604 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m1, ta, ma
3605 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3606 ; CHECK-ZVBB-NEXT: ret
3607 %v = call <vscale x 2 x i32> @llvm.vp.cttz.nxv2i32(<vscale x 2 x i32> %va, i1 true, <vscale x 2 x i1> splat (i1 true), i32 %evl)
3608 ret <vscale x 2 x i32> %v
3612 define <vscale x 4 x i32> @vp_cttz_zero_undef_nxv4i32(<vscale x 4 x i32> %va, <vscale x 4 x i1> %m, i32 zeroext %evl) {
3613 ; CHECK-LABEL: vp_cttz_zero_undef_nxv4i32:
3615 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
3616 ; CHECK-NEXT: vrsub.vi v10, v8, 0, v0.t
3617 ; CHECK-NEXT: vand.vv v8, v8, v10, v0.t
3618 ; CHECK-NEXT: vfwcvt.f.xu.v v12, v8, v0.t
3619 ; CHECK-NEXT: li a0, 52
3620 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, ma
3621 ; CHECK-NEXT: vsrl.vx v8, v12, a0, v0.t
3622 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
3623 ; CHECK-NEXT: vnsrl.wi v12, v8, 0, v0.t
3624 ; CHECK-NEXT: li a0, 1023
3625 ; CHECK-NEXT: vsub.vx v8, v12, a0, v0.t
3628 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv4i32:
3629 ; CHECK-ZVBB: # %bb.0:
3630 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m2, ta, ma
3631 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3632 ; CHECK-ZVBB-NEXT: ret
3633 %v = call <vscale x 4 x i32> @llvm.vp.cttz.nxv4i32(<vscale x 4 x i32> %va, i1 true, <vscale x 4 x i1> %m, i32 %evl)
3634 ret <vscale x 4 x i32> %v
3637 define <vscale x 4 x i32> @vp_cttz_zero_undef_nxv4i32_unmasked(<vscale x 4 x i32> %va, i32 zeroext %evl) {
3638 ; CHECK-LABEL: vp_cttz_zero_undef_nxv4i32_unmasked:
3640 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
3641 ; CHECK-NEXT: vrsub.vi v10, v8, 0
3642 ; CHECK-NEXT: vand.vv v8, v8, v10
3643 ; CHECK-NEXT: vfwcvt.f.xu.v v12, v8
3644 ; CHECK-NEXT: li a0, 52
3645 ; CHECK-NEXT: vnsrl.wx v8, v12, a0
3646 ; CHECK-NEXT: li a0, 1023
3647 ; CHECK-NEXT: vsub.vx v8, v8, a0
3650 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv4i32_unmasked:
3651 ; CHECK-ZVBB: # %bb.0:
3652 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m2, ta, ma
3653 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3654 ; CHECK-ZVBB-NEXT: ret
3655 %v = call <vscale x 4 x i32> @llvm.vp.cttz.nxv4i32(<vscale x 4 x i32> %va, i1 true, <vscale x 4 x i1> splat (i1 true), i32 %evl)
3656 ret <vscale x 4 x i32> %v
3660 define <vscale x 8 x i32> @vp_cttz_zero_undef_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i1> %m, i32 zeroext %evl) {
3661 ; CHECK-LABEL: vp_cttz_zero_undef_nxv8i32:
3663 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
3664 ; CHECK-NEXT: vrsub.vi v12, v8, 0, v0.t
3665 ; CHECK-NEXT: vand.vv v8, v8, v12, v0.t
3666 ; CHECK-NEXT: vfwcvt.f.xu.v v16, v8, v0.t
3667 ; CHECK-NEXT: li a0, 52
3668 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, ma
3669 ; CHECK-NEXT: vsrl.vx v8, v16, a0, v0.t
3670 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, ma
3671 ; CHECK-NEXT: vnsrl.wi v16, v8, 0, v0.t
3672 ; CHECK-NEXT: li a0, 1023
3673 ; CHECK-NEXT: vsub.vx v8, v16, a0, v0.t
3676 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv8i32:
3677 ; CHECK-ZVBB: # %bb.0:
3678 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m4, ta, ma
3679 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3680 ; CHECK-ZVBB-NEXT: ret
3681 %v = call <vscale x 8 x i32> @llvm.vp.cttz.nxv8i32(<vscale x 8 x i32> %va, i1 true, <vscale x 8 x i1> %m, i32 %evl)
3682 ret <vscale x 8 x i32> %v
3685 define <vscale x 8 x i32> @vp_cttz_zero_undef_nxv8i32_unmasked(<vscale x 8 x i32> %va, i32 zeroext %evl) {
3686 ; CHECK-LABEL: vp_cttz_zero_undef_nxv8i32_unmasked:
3688 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
3689 ; CHECK-NEXT: vrsub.vi v12, v8, 0
3690 ; CHECK-NEXT: vand.vv v8, v8, v12
3691 ; CHECK-NEXT: vfwcvt.f.xu.v v16, v8
3692 ; CHECK-NEXT: li a0, 52
3693 ; CHECK-NEXT: vnsrl.wx v8, v16, a0
3694 ; CHECK-NEXT: li a0, 1023
3695 ; CHECK-NEXT: vsub.vx v8, v8, a0
3698 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv8i32_unmasked:
3699 ; CHECK-ZVBB: # %bb.0:
3700 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m4, ta, ma
3701 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3702 ; CHECK-ZVBB-NEXT: ret
3703 %v = call <vscale x 8 x i32> @llvm.vp.cttz.nxv8i32(<vscale x 8 x i32> %va, i1 true, <vscale x 8 x i1> splat (i1 true), i32 %evl)
3704 ret <vscale x 8 x i32> %v
3708 define <vscale x 16 x i32> @vp_cttz_zero_undef_nxv16i32(<vscale x 16 x i32> %va, <vscale x 16 x i1> %m, i32 zeroext %evl) {
3709 ; CHECK-LABEL: vp_cttz_zero_undef_nxv16i32:
3711 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
3712 ; CHECK-NEXT: vrsub.vi v16, v8, 0, v0.t
3713 ; CHECK-NEXT: vand.vv v8, v8, v16, v0.t
3714 ; CHECK-NEXT: fsrmi a0, 1
3715 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8, v0.t
3716 ; CHECK-NEXT: vsrl.vi v8, v8, 23, v0.t
3717 ; CHECK-NEXT: li a1, 127
3718 ; CHECK-NEXT: vsub.vx v8, v8, a1, v0.t
3719 ; CHECK-NEXT: fsrm a0
3722 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv16i32:
3723 ; CHECK-ZVBB: # %bb.0:
3724 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m8, ta, ma
3725 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3726 ; CHECK-ZVBB-NEXT: ret
3727 %v = call <vscale x 16 x i32> @llvm.vp.cttz.nxv16i32(<vscale x 16 x i32> %va, i1 true, <vscale x 16 x i1> %m, i32 %evl)
3728 ret <vscale x 16 x i32> %v
3731 define <vscale x 16 x i32> @vp_cttz_zero_undef_nxv16i32_unmasked(<vscale x 16 x i32> %va, i32 zeroext %evl) {
3732 ; CHECK-LABEL: vp_cttz_zero_undef_nxv16i32_unmasked:
3734 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
3735 ; CHECK-NEXT: vrsub.vi v16, v8, 0
3736 ; CHECK-NEXT: vand.vv v8, v8, v16
3737 ; CHECK-NEXT: fsrmi a0, 1
3738 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8
3739 ; CHECK-NEXT: vsrl.vi v8, v8, 23
3740 ; CHECK-NEXT: li a1, 127
3741 ; CHECK-NEXT: vsub.vx v8, v8, a1
3742 ; CHECK-NEXT: fsrm a0
3745 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv16i32_unmasked:
3746 ; CHECK-ZVBB: # %bb.0:
3747 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e32, m8, ta, ma
3748 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3749 ; CHECK-ZVBB-NEXT: ret
3750 %v = call <vscale x 16 x i32> @llvm.vp.cttz.nxv16i32(<vscale x 16 x i32> %va, i1 true, <vscale x 16 x i1> splat (i1 true), i32 %evl)
3751 ret <vscale x 16 x i32> %v
3755 define <vscale x 1 x i64> @vp_cttz_zero_undef_nxv1i64(<vscale x 1 x i64> %va, <vscale x 1 x i1> %m, i32 zeroext %evl) {
3756 ; CHECK-LABEL: vp_cttz_zero_undef_nxv1i64:
3758 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
3759 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
3760 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
3761 ; CHECK-NEXT: fsrmi a0, 1
3762 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8, v0.t
3763 ; CHECK-NEXT: li a1, 52
3764 ; CHECK-NEXT: vsrl.vx v8, v8, a1, v0.t
3765 ; CHECK-NEXT: li a1, 1023
3766 ; CHECK-NEXT: vsub.vx v8, v8, a1, v0.t
3767 ; CHECK-NEXT: fsrm a0
3770 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv1i64:
3771 ; CHECK-ZVBB: # %bb.0:
3772 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m1, ta, ma
3773 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3774 ; CHECK-ZVBB-NEXT: ret
3775 %v = call <vscale x 1 x i64> @llvm.vp.cttz.nxv1i64(<vscale x 1 x i64> %va, i1 true, <vscale x 1 x i1> %m, i32 %evl)
3776 ret <vscale x 1 x i64> %v
3779 define <vscale x 1 x i64> @vp_cttz_zero_undef_nxv1i64_unmasked(<vscale x 1 x i64> %va, i32 zeroext %evl) {
3780 ; CHECK-LABEL: vp_cttz_zero_undef_nxv1i64_unmasked:
3782 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
3783 ; CHECK-NEXT: vrsub.vi v9, v8, 0
3784 ; CHECK-NEXT: vand.vv v8, v8, v9
3785 ; CHECK-NEXT: fsrmi a0, 1
3786 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8
3787 ; CHECK-NEXT: li a1, 52
3788 ; CHECK-NEXT: vsrl.vx v8, v8, a1
3789 ; CHECK-NEXT: li a1, 1023
3790 ; CHECK-NEXT: vsub.vx v8, v8, a1
3791 ; CHECK-NEXT: fsrm a0
3794 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv1i64_unmasked:
3795 ; CHECK-ZVBB: # %bb.0:
3796 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m1, ta, ma
3797 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3798 ; CHECK-ZVBB-NEXT: ret
3799 %v = call <vscale x 1 x i64> @llvm.vp.cttz.nxv1i64(<vscale x 1 x i64> %va, i1 true, <vscale x 1 x i1> splat (i1 true), i32 %evl)
3800 ret <vscale x 1 x i64> %v
3804 define <vscale x 2 x i64> @vp_cttz_zero_undef_nxv2i64(<vscale x 2 x i64> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
3805 ; CHECK-LABEL: vp_cttz_zero_undef_nxv2i64:
3807 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
3808 ; CHECK-NEXT: vrsub.vi v10, v8, 0, v0.t
3809 ; CHECK-NEXT: vand.vv v8, v8, v10, v0.t
3810 ; CHECK-NEXT: fsrmi a0, 1
3811 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8, v0.t
3812 ; CHECK-NEXT: li a1, 52
3813 ; CHECK-NEXT: vsrl.vx v8, v8, a1, v0.t
3814 ; CHECK-NEXT: li a1, 1023
3815 ; CHECK-NEXT: vsub.vx v8, v8, a1, v0.t
3816 ; CHECK-NEXT: fsrm a0
3819 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv2i64:
3820 ; CHECK-ZVBB: # %bb.0:
3821 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m2, ta, ma
3822 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3823 ; CHECK-ZVBB-NEXT: ret
3824 %v = call <vscale x 2 x i64> @llvm.vp.cttz.nxv2i64(<vscale x 2 x i64> %va, i1 true, <vscale x 2 x i1> %m, i32 %evl)
3825 ret <vscale x 2 x i64> %v
3828 define <vscale x 2 x i64> @vp_cttz_zero_undef_nxv2i64_unmasked(<vscale x 2 x i64> %va, i32 zeroext %evl) {
3829 ; CHECK-LABEL: vp_cttz_zero_undef_nxv2i64_unmasked:
3831 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
3832 ; CHECK-NEXT: vrsub.vi v10, v8, 0
3833 ; CHECK-NEXT: vand.vv v8, v8, v10
3834 ; CHECK-NEXT: fsrmi a0, 1
3835 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8
3836 ; CHECK-NEXT: li a1, 52
3837 ; CHECK-NEXT: vsrl.vx v8, v8, a1
3838 ; CHECK-NEXT: li a1, 1023
3839 ; CHECK-NEXT: vsub.vx v8, v8, a1
3840 ; CHECK-NEXT: fsrm a0
3843 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv2i64_unmasked:
3844 ; CHECK-ZVBB: # %bb.0:
3845 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m2, ta, ma
3846 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3847 ; CHECK-ZVBB-NEXT: ret
3848 %v = call <vscale x 2 x i64> @llvm.vp.cttz.nxv2i64(<vscale x 2 x i64> %va, i1 true, <vscale x 2 x i1> splat (i1 true), i32 %evl)
3849 ret <vscale x 2 x i64> %v
3853 define <vscale x 4 x i64> @vp_cttz_zero_undef_nxv4i64(<vscale x 4 x i64> %va, <vscale x 4 x i1> %m, i32 zeroext %evl) {
3854 ; CHECK-LABEL: vp_cttz_zero_undef_nxv4i64:
3856 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
3857 ; CHECK-NEXT: vrsub.vi v12, v8, 0, v0.t
3858 ; CHECK-NEXT: vand.vv v8, v8, v12, v0.t
3859 ; CHECK-NEXT: fsrmi a0, 1
3860 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8, v0.t
3861 ; CHECK-NEXT: li a1, 52
3862 ; CHECK-NEXT: vsrl.vx v8, v8, a1, v0.t
3863 ; CHECK-NEXT: li a1, 1023
3864 ; CHECK-NEXT: vsub.vx v8, v8, a1, v0.t
3865 ; CHECK-NEXT: fsrm a0
3868 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv4i64:
3869 ; CHECK-ZVBB: # %bb.0:
3870 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m4, ta, ma
3871 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3872 ; CHECK-ZVBB-NEXT: ret
3873 %v = call <vscale x 4 x i64> @llvm.vp.cttz.nxv4i64(<vscale x 4 x i64> %va, i1 true, <vscale x 4 x i1> %m, i32 %evl)
3874 ret <vscale x 4 x i64> %v
3877 define <vscale x 4 x i64> @vp_cttz_zero_undef_nxv4i64_unmasked(<vscale x 4 x i64> %va, i32 zeroext %evl) {
3878 ; CHECK-LABEL: vp_cttz_zero_undef_nxv4i64_unmasked:
3880 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
3881 ; CHECK-NEXT: vrsub.vi v12, v8, 0
3882 ; CHECK-NEXT: vand.vv v8, v8, v12
3883 ; CHECK-NEXT: fsrmi a0, 1
3884 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8
3885 ; CHECK-NEXT: li a1, 52
3886 ; CHECK-NEXT: vsrl.vx v8, v8, a1
3887 ; CHECK-NEXT: li a1, 1023
3888 ; CHECK-NEXT: vsub.vx v8, v8, a1
3889 ; CHECK-NEXT: fsrm a0
3892 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv4i64_unmasked:
3893 ; CHECK-ZVBB: # %bb.0:
3894 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m4, ta, ma
3895 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3896 ; CHECK-ZVBB-NEXT: ret
3897 %v = call <vscale x 4 x i64> @llvm.vp.cttz.nxv4i64(<vscale x 4 x i64> %va, i1 true, <vscale x 4 x i1> splat (i1 true), i32 %evl)
3898 ret <vscale x 4 x i64> %v
3902 define <vscale x 7 x i64> @vp_cttz_zero_undef_nxv7i64(<vscale x 7 x i64> %va, <vscale x 7 x i1> %m, i32 zeroext %evl) {
3903 ; CHECK-LABEL: vp_cttz_zero_undef_nxv7i64:
3905 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
3906 ; CHECK-NEXT: vrsub.vi v16, v8, 0, v0.t
3907 ; CHECK-NEXT: vand.vv v8, v8, v16, v0.t
3908 ; CHECK-NEXT: fsrmi a0, 1
3909 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8, v0.t
3910 ; CHECK-NEXT: li a1, 52
3911 ; CHECK-NEXT: vsrl.vx v8, v8, a1, v0.t
3912 ; CHECK-NEXT: li a1, 1023
3913 ; CHECK-NEXT: vsub.vx v8, v8, a1, v0.t
3914 ; CHECK-NEXT: fsrm a0
3917 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv7i64:
3918 ; CHECK-ZVBB: # %bb.0:
3919 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m8, ta, ma
3920 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3921 ; CHECK-ZVBB-NEXT: ret
3922 %v = call <vscale x 7 x i64> @llvm.vp.cttz.nxv7i64(<vscale x 7 x i64> %va, i1 true, <vscale x 7 x i1> %m, i32 %evl)
3923 ret <vscale x 7 x i64> %v
3926 define <vscale x 7 x i64> @vp_cttz_zero_undef_nxv7i64_unmasked(<vscale x 7 x i64> %va, i32 zeroext %evl) {
3927 ; CHECK-LABEL: vp_cttz_zero_undef_nxv7i64_unmasked:
3929 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
3930 ; CHECK-NEXT: vrsub.vi v16, v8, 0
3931 ; CHECK-NEXT: vand.vv v8, v8, v16
3932 ; CHECK-NEXT: fsrmi a0, 1
3933 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8
3934 ; CHECK-NEXT: li a1, 52
3935 ; CHECK-NEXT: vsrl.vx v8, v8, a1
3936 ; CHECK-NEXT: li a1, 1023
3937 ; CHECK-NEXT: vsub.vx v8, v8, a1
3938 ; CHECK-NEXT: fsrm a0
3941 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv7i64_unmasked:
3942 ; CHECK-ZVBB: # %bb.0:
3943 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m8, ta, ma
3944 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3945 ; CHECK-ZVBB-NEXT: ret
3946 %v = call <vscale x 7 x i64> @llvm.vp.cttz.nxv7i64(<vscale x 7 x i64> %va, i1 true, <vscale x 7 x i1> splat (i1 true), i32 %evl)
3947 ret <vscale x 7 x i64> %v
3951 define <vscale x 8 x i64> @vp_cttz_zero_undef_nxv8i64(<vscale x 8 x i64> %va, <vscale x 8 x i1> %m, i32 zeroext %evl) {
3952 ; CHECK-LABEL: vp_cttz_zero_undef_nxv8i64:
3954 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
3955 ; CHECK-NEXT: vrsub.vi v16, v8, 0, v0.t
3956 ; CHECK-NEXT: vand.vv v8, v8, v16, v0.t
3957 ; CHECK-NEXT: fsrmi a0, 1
3958 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8, v0.t
3959 ; CHECK-NEXT: li a1, 52
3960 ; CHECK-NEXT: vsrl.vx v8, v8, a1, v0.t
3961 ; CHECK-NEXT: li a1, 1023
3962 ; CHECK-NEXT: vsub.vx v8, v8, a1, v0.t
3963 ; CHECK-NEXT: fsrm a0
3966 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv8i64:
3967 ; CHECK-ZVBB: # %bb.0:
3968 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m8, ta, ma
3969 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
3970 ; CHECK-ZVBB-NEXT: ret
3971 %v = call <vscale x 8 x i64> @llvm.vp.cttz.nxv8i64(<vscale x 8 x i64> %va, i1 true, <vscale x 8 x i1> %m, i32 %evl)
3972 ret <vscale x 8 x i64> %v
3975 define <vscale x 8 x i64> @vp_cttz_zero_undef_nxv8i64_unmasked(<vscale x 8 x i64> %va, i32 zeroext %evl) {
3976 ; CHECK-LABEL: vp_cttz_zero_undef_nxv8i64_unmasked:
3978 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
3979 ; CHECK-NEXT: vrsub.vi v16, v8, 0
3980 ; CHECK-NEXT: vand.vv v8, v8, v16
3981 ; CHECK-NEXT: fsrmi a0, 1
3982 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8
3983 ; CHECK-NEXT: li a1, 52
3984 ; CHECK-NEXT: vsrl.vx v8, v8, a1
3985 ; CHECK-NEXT: li a1, 1023
3986 ; CHECK-NEXT: vsub.vx v8, v8, a1
3987 ; CHECK-NEXT: fsrm a0
3990 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv8i64_unmasked:
3991 ; CHECK-ZVBB: # %bb.0:
3992 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m8, ta, ma
3993 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
3994 ; CHECK-ZVBB-NEXT: ret
3995 %v = call <vscale x 8 x i64> @llvm.vp.cttz.nxv8i64(<vscale x 8 x i64> %va, i1 true, <vscale x 8 x i1> splat (i1 true), i32 %evl)
3996 ret <vscale x 8 x i64> %v
3999 define <vscale x 16 x i64> @vp_cttz_zero_undef_nxv16i64(<vscale x 16 x i64> %va, <vscale x 16 x i1> %m, i32 zeroext %evl) {
4000 ; CHECK-LABEL: vp_cttz_zero_undef_nxv16i64:
4002 ; CHECK-NEXT: addi sp, sp, -16
4003 ; CHECK-NEXT: .cfi_def_cfa_offset 16
4004 ; CHECK-NEXT: csrr a1, vlenb
4005 ; CHECK-NEXT: slli a1, a1, 4
4006 ; CHECK-NEXT: sub sp, sp, a1
4007 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x10, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 16 * vlenb
4008 ; CHECK-NEXT: vmv1r.v v24, v0
4009 ; CHECK-NEXT: csrr a1, vlenb
4010 ; CHECK-NEXT: slli a1, a1, 3
4011 ; CHECK-NEXT: add a1, sp, a1
4012 ; CHECK-NEXT: addi a1, a1, 16
4013 ; CHECK-NEXT: vs8r.v v8, (a1) # Unknown-size Folded Spill
4014 ; CHECK-NEXT: csrr a1, vlenb
4015 ; CHECK-NEXT: srli a2, a1, 3
4016 ; CHECK-NEXT: vsetvli a3, zero, e8, mf4, ta, ma
4017 ; CHECK-NEXT: vslidedown.vx v0, v0, a2
4018 ; CHECK-NEXT: sub a2, a0, a1
4019 ; CHECK-NEXT: sltu a3, a0, a2
4020 ; CHECK-NEXT: addi a3, a3, -1
4021 ; CHECK-NEXT: and a2, a3, a2
4022 ; CHECK-NEXT: vsetvli zero, a2, e64, m8, ta, ma
4023 ; CHECK-NEXT: vrsub.vi v8, v16, 0, v0.t
4024 ; CHECK-NEXT: vand.vv v8, v16, v8, v0.t
4025 ; CHECK-NEXT: fsrmi a2, 1
4026 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8, v0.t
4027 ; CHECK-NEXT: fsrm a2
4028 ; CHECK-NEXT: li a2, 52
4029 ; CHECK-NEXT: vsrl.vx v8, v8, a2, v0.t
4030 ; CHECK-NEXT: li a3, 1023
4031 ; CHECK-NEXT: vsub.vx v8, v8, a3, v0.t
4032 ; CHECK-NEXT: addi a4, sp, 16
4033 ; CHECK-NEXT: vs8r.v v8, (a4) # Unknown-size Folded Spill
4034 ; CHECK-NEXT: bltu a0, a1, .LBB94_2
4035 ; CHECK-NEXT: # %bb.1:
4036 ; CHECK-NEXT: mv a0, a1
4037 ; CHECK-NEXT: .LBB94_2:
4038 ; CHECK-NEXT: vmv1r.v v0, v24
4039 ; CHECK-NEXT: slli a1, a1, 3
4040 ; CHECK-NEXT: add a1, sp, a1
4041 ; CHECK-NEXT: addi a1, a1, 16
4042 ; CHECK-NEXT: vl8r.v v8, (a1) # Unknown-size Folded Reload
4043 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
4044 ; CHECK-NEXT: vrsub.vi v16, v8, 0, v0.t
4045 ; CHECK-NEXT: vand.vv v8, v8, v16, v0.t
4046 ; CHECK-NEXT: fsrmi a0, 1
4047 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8, v0.t
4048 ; CHECK-NEXT: vsrl.vx v8, v8, a2, v0.t
4049 ; CHECK-NEXT: vsub.vx v8, v8, a3, v0.t
4050 ; CHECK-NEXT: fsrm a0
4051 ; CHECK-NEXT: addi a0, sp, 16
4052 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
4053 ; CHECK-NEXT: csrr a0, vlenb
4054 ; CHECK-NEXT: slli a0, a0, 4
4055 ; CHECK-NEXT: add sp, sp, a0
4056 ; CHECK-NEXT: addi sp, sp, 16
4059 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv16i64:
4060 ; CHECK-ZVBB: # %bb.0:
4061 ; CHECK-ZVBB-NEXT: vmv1r.v v24, v0
4062 ; CHECK-ZVBB-NEXT: csrr a1, vlenb
4063 ; CHECK-ZVBB-NEXT: srli a2, a1, 3
4064 ; CHECK-ZVBB-NEXT: vsetvli a3, zero, e8, mf4, ta, ma
4065 ; CHECK-ZVBB-NEXT: vslidedown.vx v0, v0, a2
4066 ; CHECK-ZVBB-NEXT: sub a2, a0, a1
4067 ; CHECK-ZVBB-NEXT: sltu a3, a0, a2
4068 ; CHECK-ZVBB-NEXT: addi a3, a3, -1
4069 ; CHECK-ZVBB-NEXT: and a2, a3, a2
4070 ; CHECK-ZVBB-NEXT: vsetvli zero, a2, e64, m8, ta, ma
4071 ; CHECK-ZVBB-NEXT: vctz.v v16, v16, v0.t
4072 ; CHECK-ZVBB-NEXT: bltu a0, a1, .LBB94_2
4073 ; CHECK-ZVBB-NEXT: # %bb.1:
4074 ; CHECK-ZVBB-NEXT: mv a0, a1
4075 ; CHECK-ZVBB-NEXT: .LBB94_2:
4076 ; CHECK-ZVBB-NEXT: vmv1r.v v0, v24
4077 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m8, ta, ma
4078 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
4079 ; CHECK-ZVBB-NEXT: ret
4080 %v = call <vscale x 16 x i64> @llvm.vp.cttz.nxv16i64(<vscale x 16 x i64> %va, i1 true, <vscale x 16 x i1> %m, i32 %evl)
4081 ret <vscale x 16 x i64> %v
4084 define <vscale x 16 x i64> @vp_cttz_zero_undef_nxv16i64_unmasked(<vscale x 16 x i64> %va, i32 zeroext %evl) {
4085 ; CHECK-LABEL: vp_cttz_zero_undef_nxv16i64_unmasked:
4087 ; CHECK-NEXT: csrr a1, vlenb
4088 ; CHECK-NEXT: sub a2, a0, a1
4089 ; CHECK-NEXT: sltu a3, a0, a2
4090 ; CHECK-NEXT: addi a3, a3, -1
4091 ; CHECK-NEXT: and a2, a3, a2
4092 ; CHECK-NEXT: vsetvli zero, a2, e64, m8, ta, ma
4093 ; CHECK-NEXT: vrsub.vi v24, v16, 0
4094 ; CHECK-NEXT: vand.vv v16, v16, v24
4095 ; CHECK-NEXT: fsrmi a2, 1
4096 ; CHECK-NEXT: vfcvt.f.xu.v v16, v16
4097 ; CHECK-NEXT: fsrm a2
4098 ; CHECK-NEXT: li a2, 52
4099 ; CHECK-NEXT: vsrl.vx v16, v16, a2
4100 ; CHECK-NEXT: li a3, 1023
4101 ; CHECK-NEXT: vsub.vx v16, v16, a3
4102 ; CHECK-NEXT: bltu a0, a1, .LBB95_2
4103 ; CHECK-NEXT: # %bb.1:
4104 ; CHECK-NEXT: mv a0, a1
4105 ; CHECK-NEXT: .LBB95_2:
4106 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
4107 ; CHECK-NEXT: vrsub.vi v24, v8, 0
4108 ; CHECK-NEXT: vand.vv v8, v8, v24
4109 ; CHECK-NEXT: fsrmi a0, 1
4110 ; CHECK-NEXT: vfcvt.f.xu.v v8, v8
4111 ; CHECK-NEXT: vsrl.vx v8, v8, a2
4112 ; CHECK-NEXT: vsub.vx v8, v8, a3
4113 ; CHECK-NEXT: fsrm a0
4116 ; CHECK-ZVBB-LABEL: vp_cttz_zero_undef_nxv16i64_unmasked:
4117 ; CHECK-ZVBB: # %bb.0:
4118 ; CHECK-ZVBB-NEXT: csrr a1, vlenb
4119 ; CHECK-ZVBB-NEXT: sub a2, a0, a1
4120 ; CHECK-ZVBB-NEXT: sltu a3, a0, a2
4121 ; CHECK-ZVBB-NEXT: addi a3, a3, -1
4122 ; CHECK-ZVBB-NEXT: and a2, a3, a2
4123 ; CHECK-ZVBB-NEXT: vsetvli zero, a2, e64, m8, ta, ma
4124 ; CHECK-ZVBB-NEXT: vctz.v v16, v16
4125 ; CHECK-ZVBB-NEXT: bltu a0, a1, .LBB95_2
4126 ; CHECK-ZVBB-NEXT: # %bb.1:
4127 ; CHECK-ZVBB-NEXT: mv a0, a1
4128 ; CHECK-ZVBB-NEXT: .LBB95_2:
4129 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e64, m8, ta, ma
4130 ; CHECK-ZVBB-NEXT: vctz.v v8, v8
4131 ; CHECK-ZVBB-NEXT: ret
4132 %v = call <vscale x 16 x i64> @llvm.vp.cttz.nxv16i64(<vscale x 16 x i64> %va, i1 true, <vscale x 16 x i1> splat (i1 true), i32 %evl)
4133 ret <vscale x 16 x i64> %v
4137 declare <vscale x 1 x i9> @llvm.vp.cttz.nxv1i9(<vscale x 1 x i9>, i1 immarg, <vscale x 1 x i1>, i32)
4138 define <vscale x 1 x i9> @vp_cttz_nxv1i9(<vscale x 1 x i9> %va, <vscale x 1 x i1> %m, i32 zeroext %evl) {
4139 ; CHECK-LABEL: vp_cttz_nxv1i9:
4141 ; CHECK-NEXT: li a1, 512
4142 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
4143 ; CHECK-NEXT: vor.vx v8, v8, a1, v0.t
4144 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
4145 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
4146 ; CHECK-NEXT: vfwcvt.f.xu.v v9, v8, v0.t
4147 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
4148 ; CHECK-NEXT: vsrl.vi v8, v9, 23, v0.t
4149 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
4150 ; CHECK-NEXT: vnsrl.wi v8, v8, 0, v0.t
4151 ; CHECK-NEXT: li a0, 127
4152 ; CHECK-NEXT: vsub.vx v8, v8, a0, v0.t
4155 ; CHECK-ZVBB-LABEL: vp_cttz_nxv1i9:
4156 ; CHECK-ZVBB: # %bb.0:
4157 ; CHECK-ZVBB-NEXT: li a1, 512
4158 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
4159 ; CHECK-ZVBB-NEXT: vor.vx v8, v8, a1, v0.t
4160 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
4161 ; CHECK-ZVBB-NEXT: ret
4162 %v = call <vscale x 1 x i9> @llvm.vp.cttz.nxv1i9(<vscale x 1 x i9> %va, i1 false, <vscale x 1 x i1> %m, i32 %evl)
4163 ret <vscale x 1 x i9> %v
4165 define <vscale x 1 x i9> @vp_zero_undef_cttz_nxv1i9(<vscale x 1 x i9> %va, <vscale x 1 x i1> %m, i32 zeroext %evl) {
4166 ; CHECK-LABEL: vp_zero_undef_cttz_nxv1i9:
4168 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
4169 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
4170 ; CHECK-NEXT: vand.vv v8, v8, v9, v0.t
4171 ; CHECK-NEXT: vfwcvt.f.xu.v v9, v8, v0.t
4172 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
4173 ; CHECK-NEXT: vsrl.vi v8, v9, 23, v0.t
4174 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
4175 ; CHECK-NEXT: vnsrl.wi v8, v8, 0, v0.t
4176 ; CHECK-NEXT: li a0, 127
4177 ; CHECK-NEXT: vsub.vx v8, v8, a0, v0.t
4180 ; CHECK-ZVBB-LABEL: vp_zero_undef_cttz_nxv1i9:
4181 ; CHECK-ZVBB: # %bb.0:
4182 ; CHECK-ZVBB-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
4183 ; CHECK-ZVBB-NEXT: vctz.v v8, v8, v0.t
4184 ; CHECK-ZVBB-NEXT: ret
4185 %v = call <vscale x 1 x i9> @llvm.vp.cttz.nxv1i9(<vscale x 1 x i9> %va, i1 true, <vscale x 1 x i1> %m, i32 %evl)
4186 ret <vscale x 1 x i9> %v