1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV32
3 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV64
5 define <vscale x 1 x i8> @vand_vv_nxv1i8(<vscale x 1 x i8> %va, <vscale x 1 x i8> %vb) {
6 ; CHECK-LABEL: vand_vv_nxv1i8:
8 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
9 ; CHECK-NEXT: vand.vv v8, v8, v9
11 %vc = and <vscale x 1 x i8> %va, %vb
12 ret <vscale x 1 x i8> %vc
15 define <vscale x 1 x i8> @vand_vx_nxv1i8(<vscale x 1 x i8> %va, i8 signext %b) {
16 ; CHECK-LABEL: vand_vx_nxv1i8:
18 ; CHECK-NEXT: vsetvli a1, zero, e8, mf8, ta, ma
19 ; CHECK-NEXT: vand.vx v8, v8, a0
21 %head = insertelement <vscale x 1 x i8> poison, i8 %b, i32 0
22 %splat = shufflevector <vscale x 1 x i8> %head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
23 %vc = and <vscale x 1 x i8> %va, %splat
24 ret <vscale x 1 x i8> %vc
27 define <vscale x 1 x i8> @vand_vi_nxv1i8_0(<vscale x 1 x i8> %va) {
28 ; CHECK-LABEL: vand_vi_nxv1i8_0:
30 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
31 ; CHECK-NEXT: vand.vi v8, v8, -10
33 %vc = and <vscale x 1 x i8> %va, splat (i8 -10)
34 ret <vscale x 1 x i8> %vc
37 define <vscale x 1 x i8> @vand_vi_nxv1i8_1(<vscale x 1 x i8> %va) {
38 ; CHECK-LABEL: vand_vi_nxv1i8_1:
40 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
41 ; CHECK-NEXT: vand.vi v8, v8, 8
43 %vc = and <vscale x 1 x i8> %va, splat (i8 8)
44 ret <vscale x 1 x i8> %vc
47 define <vscale x 1 x i8> @vand_vi_nxv1i8_2(<vscale x 1 x i8> %va) {
48 ; CHECK-LABEL: vand_vi_nxv1i8_2:
50 ; CHECK-NEXT: li a0, 16
51 ; CHECK-NEXT: vsetvli a1, zero, e8, mf8, ta, ma
52 ; CHECK-NEXT: vand.vx v8, v8, a0
54 %vc = and <vscale x 1 x i8> %va, splat (i8 16)
55 ret <vscale x 1 x i8> %vc
58 define <vscale x 2 x i8> @vand_vv_nxv2i8(<vscale x 2 x i8> %va, <vscale x 2 x i8> %vb) {
59 ; CHECK-LABEL: vand_vv_nxv2i8:
61 ; CHECK-NEXT: vsetvli a0, zero, e8, mf4, ta, ma
62 ; CHECK-NEXT: vand.vv v8, v8, v9
64 %vc = and <vscale x 2 x i8> %va, %vb
65 ret <vscale x 2 x i8> %vc
68 define <vscale x 2 x i8> @vand_vx_nxv2i8(<vscale x 2 x i8> %va, i8 signext %b) {
69 ; CHECK-LABEL: vand_vx_nxv2i8:
71 ; CHECK-NEXT: vsetvli a1, zero, e8, mf4, ta, ma
72 ; CHECK-NEXT: vand.vx v8, v8, a0
74 %head = insertelement <vscale x 2 x i8> poison, i8 %b, i32 0
75 %splat = shufflevector <vscale x 2 x i8> %head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
76 %vc = and <vscale x 2 x i8> %va, %splat
77 ret <vscale x 2 x i8> %vc
80 define <vscale x 2 x i8> @vand_vi_nxv2i8_0(<vscale x 2 x i8> %va) {
81 ; CHECK-LABEL: vand_vi_nxv2i8_0:
83 ; CHECK-NEXT: vsetvli a0, zero, e8, mf4, ta, ma
84 ; CHECK-NEXT: vand.vi v8, v8, -10
86 %vc = and <vscale x 2 x i8> %va, splat (i8 -10)
87 ret <vscale x 2 x i8> %vc
90 define <vscale x 2 x i8> @vand_vi_nxv2i8_1(<vscale x 2 x i8> %va) {
91 ; CHECK-LABEL: vand_vi_nxv2i8_1:
93 ; CHECK-NEXT: vsetvli a0, zero, e8, mf4, ta, ma
94 ; CHECK-NEXT: vand.vi v8, v8, 8
96 %vc = and <vscale x 2 x i8> %va, splat (i8 8)
97 ret <vscale x 2 x i8> %vc
100 define <vscale x 2 x i8> @vand_vi_nxv2i8_2(<vscale x 2 x i8> %va) {
101 ; CHECK-LABEL: vand_vi_nxv2i8_2:
103 ; CHECK-NEXT: li a0, 16
104 ; CHECK-NEXT: vsetvli a1, zero, e8, mf4, ta, ma
105 ; CHECK-NEXT: vand.vx v8, v8, a0
107 %vc = and <vscale x 2 x i8> %va, splat (i8 16)
108 ret <vscale x 2 x i8> %vc
111 define <vscale x 4 x i8> @vand_vv_nxv4i8(<vscale x 4 x i8> %va, <vscale x 4 x i8> %vb) {
112 ; CHECK-LABEL: vand_vv_nxv4i8:
114 ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
115 ; CHECK-NEXT: vand.vv v8, v8, v9
117 %vc = and <vscale x 4 x i8> %va, %vb
118 ret <vscale x 4 x i8> %vc
121 define <vscale x 4 x i8> @vand_vx_nxv4i8(<vscale x 4 x i8> %va, i8 signext %b) {
122 ; CHECK-LABEL: vand_vx_nxv4i8:
124 ; CHECK-NEXT: vsetvli a1, zero, e8, mf2, ta, ma
125 ; CHECK-NEXT: vand.vx v8, v8, a0
127 %head = insertelement <vscale x 4 x i8> poison, i8 %b, i32 0
128 %splat = shufflevector <vscale x 4 x i8> %head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
129 %vc = and <vscale x 4 x i8> %va, %splat
130 ret <vscale x 4 x i8> %vc
133 define <vscale x 4 x i8> @vand_vi_nxv4i8_0(<vscale x 4 x i8> %va) {
134 ; CHECK-LABEL: vand_vi_nxv4i8_0:
136 ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
137 ; CHECK-NEXT: vand.vi v8, v8, -10
139 %vc = and <vscale x 4 x i8> %va, splat (i8 -10)
140 ret <vscale x 4 x i8> %vc
143 define <vscale x 4 x i8> @vand_vi_nxv4i8_1(<vscale x 4 x i8> %va) {
144 ; CHECK-LABEL: vand_vi_nxv4i8_1:
146 ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
147 ; CHECK-NEXT: vand.vi v8, v8, 8
149 %vc = and <vscale x 4 x i8> %va, splat (i8 8)
150 ret <vscale x 4 x i8> %vc
153 define <vscale x 4 x i8> @vand_vi_nxv4i8_2(<vscale x 4 x i8> %va) {
154 ; CHECK-LABEL: vand_vi_nxv4i8_2:
156 ; CHECK-NEXT: li a0, 16
157 ; CHECK-NEXT: vsetvli a1, zero, e8, mf2, ta, ma
158 ; CHECK-NEXT: vand.vx v8, v8, a0
160 %vc = and <vscale x 4 x i8> %va, splat (i8 16)
161 ret <vscale x 4 x i8> %vc
164 define <vscale x 8 x i8> @vand_vv_nxv8i8(<vscale x 8 x i8> %va, <vscale x 8 x i8> %vb) {
165 ; CHECK-LABEL: vand_vv_nxv8i8:
167 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
168 ; CHECK-NEXT: vand.vv v8, v8, v9
170 %vc = and <vscale x 8 x i8> %va, %vb
171 ret <vscale x 8 x i8> %vc
174 define <vscale x 8 x i8> @vand_vx_nxv8i8(<vscale x 8 x i8> %va, i8 signext %b) {
175 ; CHECK-LABEL: vand_vx_nxv8i8:
177 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
178 ; CHECK-NEXT: vand.vx v8, v8, a0
180 %head = insertelement <vscale x 8 x i8> poison, i8 %b, i32 0
181 %splat = shufflevector <vscale x 8 x i8> %head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
182 %vc = and <vscale x 8 x i8> %va, %splat
183 ret <vscale x 8 x i8> %vc
186 define <vscale x 8 x i8> @vand_vi_nxv8i8_0(<vscale x 8 x i8> %va) {
187 ; CHECK-LABEL: vand_vi_nxv8i8_0:
189 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
190 ; CHECK-NEXT: vand.vi v8, v8, -10
192 %vc = and <vscale x 8 x i8> %va, splat (i8 -10)
193 ret <vscale x 8 x i8> %vc
196 define <vscale x 8 x i8> @vand_vi_nxv8i8_1(<vscale x 8 x i8> %va) {
197 ; CHECK-LABEL: vand_vi_nxv8i8_1:
199 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
200 ; CHECK-NEXT: vand.vi v8, v8, 8
202 %vc = and <vscale x 8 x i8> %va, splat (i8 8)
203 ret <vscale x 8 x i8> %vc
206 define <vscale x 8 x i8> @vand_vi_nxv8i8_2(<vscale x 8 x i8> %va) {
207 ; CHECK-LABEL: vand_vi_nxv8i8_2:
209 ; CHECK-NEXT: li a0, 16
210 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
211 ; CHECK-NEXT: vand.vx v8, v8, a0
213 %vc = and <vscale x 8 x i8> %va, splat (i8 16)
214 ret <vscale x 8 x i8> %vc
217 define <vscale x 16 x i8> @vand_vv_nxv16i8(<vscale x 16 x i8> %va, <vscale x 16 x i8> %vb) {
218 ; CHECK-LABEL: vand_vv_nxv16i8:
220 ; CHECK-NEXT: vsetvli a0, zero, e8, m2, ta, ma
221 ; CHECK-NEXT: vand.vv v8, v8, v10
223 %vc = and <vscale x 16 x i8> %va, %vb
224 ret <vscale x 16 x i8> %vc
227 define <vscale x 16 x i8> @vand_vx_nxv16i8(<vscale x 16 x i8> %va, i8 signext %b) {
228 ; CHECK-LABEL: vand_vx_nxv16i8:
230 ; CHECK-NEXT: vsetvli a1, zero, e8, m2, ta, ma
231 ; CHECK-NEXT: vand.vx v8, v8, a0
233 %head = insertelement <vscale x 16 x i8> poison, i8 %b, i32 0
234 %splat = shufflevector <vscale x 16 x i8> %head, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
235 %vc = and <vscale x 16 x i8> %va, %splat
236 ret <vscale x 16 x i8> %vc
239 define <vscale x 16 x i8> @vand_vi_nxv16i8_0(<vscale x 16 x i8> %va) {
240 ; CHECK-LABEL: vand_vi_nxv16i8_0:
242 ; CHECK-NEXT: vsetvli a0, zero, e8, m2, ta, ma
243 ; CHECK-NEXT: vand.vi v8, v8, -10
245 %vc = and <vscale x 16 x i8> %va, splat (i8 -10)
246 ret <vscale x 16 x i8> %vc
249 define <vscale x 16 x i8> @vand_vi_nxv16i8_1(<vscale x 16 x i8> %va) {
250 ; CHECK-LABEL: vand_vi_nxv16i8_1:
252 ; CHECK-NEXT: vsetvli a0, zero, e8, m2, ta, ma
253 ; CHECK-NEXT: vand.vi v8, v8, 8
255 %vc = and <vscale x 16 x i8> %va, splat (i8 8)
256 ret <vscale x 16 x i8> %vc
259 define <vscale x 16 x i8> @vand_vi_nxv16i8_2(<vscale x 16 x i8> %va) {
260 ; CHECK-LABEL: vand_vi_nxv16i8_2:
262 ; CHECK-NEXT: li a0, 16
263 ; CHECK-NEXT: vsetvli a1, zero, e8, m2, ta, ma
264 ; CHECK-NEXT: vand.vx v8, v8, a0
266 %vc = and <vscale x 16 x i8> %va, splat (i8 16)
267 ret <vscale x 16 x i8> %vc
270 define <vscale x 32 x i8> @vand_vv_nxv32i8(<vscale x 32 x i8> %va, <vscale x 32 x i8> %vb) {
271 ; CHECK-LABEL: vand_vv_nxv32i8:
273 ; CHECK-NEXT: vsetvli a0, zero, e8, m4, ta, ma
274 ; CHECK-NEXT: vand.vv v8, v8, v12
276 %vc = and <vscale x 32 x i8> %va, %vb
277 ret <vscale x 32 x i8> %vc
280 define <vscale x 32 x i8> @vand_vx_nxv32i8(<vscale x 32 x i8> %va, i8 signext %b) {
281 ; CHECK-LABEL: vand_vx_nxv32i8:
283 ; CHECK-NEXT: vsetvli a1, zero, e8, m4, ta, ma
284 ; CHECK-NEXT: vand.vx v8, v8, a0
286 %head = insertelement <vscale x 32 x i8> poison, i8 %b, i32 0
287 %splat = shufflevector <vscale x 32 x i8> %head, <vscale x 32 x i8> poison, <vscale x 32 x i32> zeroinitializer
288 %vc = and <vscale x 32 x i8> %va, %splat
289 ret <vscale x 32 x i8> %vc
292 define <vscale x 32 x i8> @vand_vi_nxv32i8_0(<vscale x 32 x i8> %va) {
293 ; CHECK-LABEL: vand_vi_nxv32i8_0:
295 ; CHECK-NEXT: vsetvli a0, zero, e8, m4, ta, ma
296 ; CHECK-NEXT: vand.vi v8, v8, -10
298 %vc = and <vscale x 32 x i8> %va, splat (i8 -10)
299 ret <vscale x 32 x i8> %vc
302 define <vscale x 32 x i8> @vand_vi_nxv32i8_1(<vscale x 32 x i8> %va) {
303 ; CHECK-LABEL: vand_vi_nxv32i8_1:
305 ; CHECK-NEXT: vsetvli a0, zero, e8, m4, ta, ma
306 ; CHECK-NEXT: vand.vi v8, v8, 8
308 %vc = and <vscale x 32 x i8> %va, splat (i8 8)
309 ret <vscale x 32 x i8> %vc
312 define <vscale x 32 x i8> @vand_vi_nxv32i8_2(<vscale x 32 x i8> %va) {
313 ; CHECK-LABEL: vand_vi_nxv32i8_2:
315 ; CHECK-NEXT: li a0, 16
316 ; CHECK-NEXT: vsetvli a1, zero, e8, m4, ta, ma
317 ; CHECK-NEXT: vand.vx v8, v8, a0
319 %vc = and <vscale x 32 x i8> %va, splat (i8 16)
320 ret <vscale x 32 x i8> %vc
323 define <vscale x 64 x i8> @vand_vv_nxv64i8(<vscale x 64 x i8> %va, <vscale x 64 x i8> %vb) {
324 ; CHECK-LABEL: vand_vv_nxv64i8:
326 ; CHECK-NEXT: vsetvli a0, zero, e8, m8, ta, ma
327 ; CHECK-NEXT: vand.vv v8, v8, v16
329 %vc = and <vscale x 64 x i8> %va, %vb
330 ret <vscale x 64 x i8> %vc
333 define <vscale x 64 x i8> @vand_vx_nxv64i8(<vscale x 64 x i8> %va, i8 signext %b) {
334 ; CHECK-LABEL: vand_vx_nxv64i8:
336 ; CHECK-NEXT: vsetvli a1, zero, e8, m8, ta, ma
337 ; CHECK-NEXT: vand.vx v8, v8, a0
339 %head = insertelement <vscale x 64 x i8> poison, i8 %b, i32 0
340 %splat = shufflevector <vscale x 64 x i8> %head, <vscale x 64 x i8> poison, <vscale x 64 x i32> zeroinitializer
341 %vc = and <vscale x 64 x i8> %va, %splat
342 ret <vscale x 64 x i8> %vc
345 define <vscale x 64 x i8> @vand_vi_nxv64i8_0(<vscale x 64 x i8> %va) {
346 ; CHECK-LABEL: vand_vi_nxv64i8_0:
348 ; CHECK-NEXT: vsetvli a0, zero, e8, m8, ta, ma
349 ; CHECK-NEXT: vand.vi v8, v8, -10
351 %vc = and <vscale x 64 x i8> %va, splat (i8 -10)
352 ret <vscale x 64 x i8> %vc
355 define <vscale x 64 x i8> @vand_vi_nxv64i8_1(<vscale x 64 x i8> %va) {
356 ; CHECK-LABEL: vand_vi_nxv64i8_1:
358 ; CHECK-NEXT: vsetvli a0, zero, e8, m8, ta, ma
359 ; CHECK-NEXT: vand.vi v8, v8, 8
361 %vc = and <vscale x 64 x i8> %va, splat (i8 8)
362 ret <vscale x 64 x i8> %vc
365 define <vscale x 64 x i8> @vand_vi_nxv64i8_2(<vscale x 64 x i8> %va) {
366 ; CHECK-LABEL: vand_vi_nxv64i8_2:
368 ; CHECK-NEXT: li a0, 16
369 ; CHECK-NEXT: vsetvli a1, zero, e8, m8, ta, ma
370 ; CHECK-NEXT: vand.vx v8, v8, a0
372 %vc = and <vscale x 64 x i8> %va, splat (i8 16)
373 ret <vscale x 64 x i8> %vc
376 define <vscale x 1 x i16> @vand_vv_nxv1i16(<vscale x 1 x i16> %va, <vscale x 1 x i16> %vb) {
377 ; CHECK-LABEL: vand_vv_nxv1i16:
379 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
380 ; CHECK-NEXT: vand.vv v8, v8, v9
382 %vc = and <vscale x 1 x i16> %va, %vb
383 ret <vscale x 1 x i16> %vc
386 define <vscale x 1 x i16> @vand_vx_nxv1i16(<vscale x 1 x i16> %va, i16 signext %b) {
387 ; CHECK-LABEL: vand_vx_nxv1i16:
389 ; CHECK-NEXT: vsetvli a1, zero, e16, mf4, ta, ma
390 ; CHECK-NEXT: vand.vx v8, v8, a0
392 %head = insertelement <vscale x 1 x i16> poison, i16 %b, i32 0
393 %splat = shufflevector <vscale x 1 x i16> %head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
394 %vc = and <vscale x 1 x i16> %va, %splat
395 ret <vscale x 1 x i16> %vc
398 define <vscale x 1 x i16> @vand_vi_nxv1i16_0(<vscale x 1 x i16> %va) {
399 ; CHECK-LABEL: vand_vi_nxv1i16_0:
401 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
402 ; CHECK-NEXT: vand.vi v8, v8, -10
404 %vc = and <vscale x 1 x i16> %va, splat (i16 -10)
405 ret <vscale x 1 x i16> %vc
408 define <vscale x 1 x i16> @vand_vi_nxv1i16_1(<vscale x 1 x i16> %va) {
409 ; CHECK-LABEL: vand_vi_nxv1i16_1:
411 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
412 ; CHECK-NEXT: vand.vi v8, v8, 8
414 %vc = and <vscale x 1 x i16> %va, splat (i16 8)
415 ret <vscale x 1 x i16> %vc
418 define <vscale x 1 x i16> @vand_vi_nxv1i16_2(<vscale x 1 x i16> %va) {
419 ; CHECK-LABEL: vand_vi_nxv1i16_2:
421 ; CHECK-NEXT: li a0, 16
422 ; CHECK-NEXT: vsetvli a1, zero, e16, mf4, ta, ma
423 ; CHECK-NEXT: vand.vx v8, v8, a0
425 %vc = and <vscale x 1 x i16> %va, splat (i16 16)
426 ret <vscale x 1 x i16> %vc
429 define <vscale x 2 x i16> @vand_vv_nxv2i16(<vscale x 2 x i16> %va, <vscale x 2 x i16> %vb) {
430 ; CHECK-LABEL: vand_vv_nxv2i16:
432 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
433 ; CHECK-NEXT: vand.vv v8, v8, v9
435 %vc = and <vscale x 2 x i16> %va, %vb
436 ret <vscale x 2 x i16> %vc
439 define <vscale x 2 x i16> @vand_vx_nxv2i16(<vscale x 2 x i16> %va, i16 signext %b) {
440 ; CHECK-LABEL: vand_vx_nxv2i16:
442 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
443 ; CHECK-NEXT: vand.vx v8, v8, a0
445 %head = insertelement <vscale x 2 x i16> poison, i16 %b, i32 0
446 %splat = shufflevector <vscale x 2 x i16> %head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
447 %vc = and <vscale x 2 x i16> %va, %splat
448 ret <vscale x 2 x i16> %vc
451 define <vscale x 2 x i16> @vand_vi_nxv2i16_0(<vscale x 2 x i16> %va) {
452 ; CHECK-LABEL: vand_vi_nxv2i16_0:
454 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
455 ; CHECK-NEXT: vand.vi v8, v8, -10
457 %vc = and <vscale x 2 x i16> %va, splat (i16 -10)
458 ret <vscale x 2 x i16> %vc
461 define <vscale x 2 x i16> @vand_vi_nxv2i16_1(<vscale x 2 x i16> %va) {
462 ; CHECK-LABEL: vand_vi_nxv2i16_1:
464 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
465 ; CHECK-NEXT: vand.vi v8, v8, 8
467 %vc = and <vscale x 2 x i16> %va, splat (i16 8)
468 ret <vscale x 2 x i16> %vc
471 define <vscale x 2 x i16> @vand_vi_nxv2i16_2(<vscale x 2 x i16> %va) {
472 ; CHECK-LABEL: vand_vi_nxv2i16_2:
474 ; CHECK-NEXT: li a0, 16
475 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
476 ; CHECK-NEXT: vand.vx v8, v8, a0
478 %vc = and <vscale x 2 x i16> %va, splat (i16 16)
479 ret <vscale x 2 x i16> %vc
482 define <vscale x 4 x i16> @vand_vv_nxv4i16(<vscale x 4 x i16> %va, <vscale x 4 x i16> %vb) {
483 ; CHECK-LABEL: vand_vv_nxv4i16:
485 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
486 ; CHECK-NEXT: vand.vv v8, v8, v9
488 %vc = and <vscale x 4 x i16> %va, %vb
489 ret <vscale x 4 x i16> %vc
492 define <vscale x 4 x i16> @vand_vx_nxv4i16(<vscale x 4 x i16> %va, i16 signext %b) {
493 ; CHECK-LABEL: vand_vx_nxv4i16:
495 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
496 ; CHECK-NEXT: vand.vx v8, v8, a0
498 %head = insertelement <vscale x 4 x i16> poison, i16 %b, i32 0
499 %splat = shufflevector <vscale x 4 x i16> %head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
500 %vc = and <vscale x 4 x i16> %va, %splat
501 ret <vscale x 4 x i16> %vc
504 define <vscale x 4 x i16> @vand_vi_nxv4i16_0(<vscale x 4 x i16> %va) {
505 ; CHECK-LABEL: vand_vi_nxv4i16_0:
507 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
508 ; CHECK-NEXT: vand.vi v8, v8, -10
510 %vc = and <vscale x 4 x i16> %va, splat (i16 -10)
511 ret <vscale x 4 x i16> %vc
514 define <vscale x 4 x i16> @vand_vi_nxv4i16_1(<vscale x 4 x i16> %va) {
515 ; CHECK-LABEL: vand_vi_nxv4i16_1:
517 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
518 ; CHECK-NEXT: vand.vi v8, v8, 8
520 %vc = and <vscale x 4 x i16> %va, splat (i16 8)
521 ret <vscale x 4 x i16> %vc
524 define <vscale x 4 x i16> @vand_vi_nxv4i16_2(<vscale x 4 x i16> %va) {
525 ; CHECK-LABEL: vand_vi_nxv4i16_2:
527 ; CHECK-NEXT: li a0, 16
528 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
529 ; CHECK-NEXT: vand.vx v8, v8, a0
531 %vc = and <vscale x 4 x i16> %va, splat (i16 16)
532 ret <vscale x 4 x i16> %vc
535 define <vscale x 8 x i16> @vand_vv_nxv8i16(<vscale x 8 x i16> %va, <vscale x 8 x i16> %vb) {
536 ; CHECK-LABEL: vand_vv_nxv8i16:
538 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
539 ; CHECK-NEXT: vand.vv v8, v8, v10
541 %vc = and <vscale x 8 x i16> %va, %vb
542 ret <vscale x 8 x i16> %vc
545 define <vscale x 8 x i16> @vand_vx_nxv8i16(<vscale x 8 x i16> %va, i16 signext %b) {
546 ; CHECK-LABEL: vand_vx_nxv8i16:
548 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
549 ; CHECK-NEXT: vand.vx v8, v8, a0
551 %head = insertelement <vscale x 8 x i16> poison, i16 %b, i32 0
552 %splat = shufflevector <vscale x 8 x i16> %head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
553 %vc = and <vscale x 8 x i16> %va, %splat
554 ret <vscale x 8 x i16> %vc
557 define <vscale x 8 x i16> @vand_vi_nxv8i16_0(<vscale x 8 x i16> %va) {
558 ; CHECK-LABEL: vand_vi_nxv8i16_0:
560 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
561 ; CHECK-NEXT: vand.vi v8, v8, -10
563 %vc = and <vscale x 8 x i16> %va, splat (i16 -10)
564 ret <vscale x 8 x i16> %vc
567 define <vscale x 8 x i16> @vand_vi_nxv8i16_1(<vscale x 8 x i16> %va) {
568 ; CHECK-LABEL: vand_vi_nxv8i16_1:
570 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
571 ; CHECK-NEXT: vand.vi v8, v8, 8
573 %vc = and <vscale x 8 x i16> %va, splat (i16 8)
574 ret <vscale x 8 x i16> %vc
577 define <vscale x 8 x i16> @vand_vi_nxv8i16_2(<vscale x 8 x i16> %va) {
578 ; CHECK-LABEL: vand_vi_nxv8i16_2:
580 ; CHECK-NEXT: li a0, 16
581 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
582 ; CHECK-NEXT: vand.vx v8, v8, a0
584 %vc = and <vscale x 8 x i16> %va, splat (i16 16)
585 ret <vscale x 8 x i16> %vc
588 define <vscale x 16 x i16> @vand_vv_nxv16i16(<vscale x 16 x i16> %va, <vscale x 16 x i16> %vb) {
589 ; CHECK-LABEL: vand_vv_nxv16i16:
591 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
592 ; CHECK-NEXT: vand.vv v8, v8, v12
594 %vc = and <vscale x 16 x i16> %va, %vb
595 ret <vscale x 16 x i16> %vc
598 define <vscale x 16 x i16> @vand_vx_nxv16i16(<vscale x 16 x i16> %va, i16 signext %b) {
599 ; CHECK-LABEL: vand_vx_nxv16i16:
601 ; CHECK-NEXT: vsetvli a1, zero, e16, m4, ta, ma
602 ; CHECK-NEXT: vand.vx v8, v8, a0
604 %head = insertelement <vscale x 16 x i16> poison, i16 %b, i32 0
605 %splat = shufflevector <vscale x 16 x i16> %head, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
606 %vc = and <vscale x 16 x i16> %va, %splat
607 ret <vscale x 16 x i16> %vc
610 define <vscale x 16 x i16> @vand_vi_nxv16i16_0(<vscale x 16 x i16> %va) {
611 ; CHECK-LABEL: vand_vi_nxv16i16_0:
613 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
614 ; CHECK-NEXT: vand.vi v8, v8, -10
616 %vc = and <vscale x 16 x i16> %va, splat (i16 -10)
617 ret <vscale x 16 x i16> %vc
620 define <vscale x 16 x i16> @vand_vi_nxv16i16_1(<vscale x 16 x i16> %va) {
621 ; CHECK-LABEL: vand_vi_nxv16i16_1:
623 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
624 ; CHECK-NEXT: vand.vi v8, v8, 8
626 %vc = and <vscale x 16 x i16> %va, splat (i16 8)
627 ret <vscale x 16 x i16> %vc
630 define <vscale x 16 x i16> @vand_vi_nxv16i16_2(<vscale x 16 x i16> %va) {
631 ; CHECK-LABEL: vand_vi_nxv16i16_2:
633 ; CHECK-NEXT: li a0, 16
634 ; CHECK-NEXT: vsetvli a1, zero, e16, m4, ta, ma
635 ; CHECK-NEXT: vand.vx v8, v8, a0
637 %vc = and <vscale x 16 x i16> %va, splat (i16 16)
638 ret <vscale x 16 x i16> %vc
641 define <vscale x 32 x i16> @vand_vv_nxv32i16(<vscale x 32 x i16> %va, <vscale x 32 x i16> %vb) {
642 ; CHECK-LABEL: vand_vv_nxv32i16:
644 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
645 ; CHECK-NEXT: vand.vv v8, v8, v16
647 %vc = and <vscale x 32 x i16> %va, %vb
648 ret <vscale x 32 x i16> %vc
651 define <vscale x 32 x i16> @vand_vx_nxv32i16(<vscale x 32 x i16> %va, i16 signext %b) {
652 ; CHECK-LABEL: vand_vx_nxv32i16:
654 ; CHECK-NEXT: vsetvli a1, zero, e16, m8, ta, ma
655 ; CHECK-NEXT: vand.vx v8, v8, a0
657 %head = insertelement <vscale x 32 x i16> poison, i16 %b, i32 0
658 %splat = shufflevector <vscale x 32 x i16> %head, <vscale x 32 x i16> poison, <vscale x 32 x i32> zeroinitializer
659 %vc = and <vscale x 32 x i16> %va, %splat
660 ret <vscale x 32 x i16> %vc
663 define <vscale x 32 x i16> @vand_vi_nxv32i16_0(<vscale x 32 x i16> %va) {
664 ; CHECK-LABEL: vand_vi_nxv32i16_0:
666 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
667 ; CHECK-NEXT: vand.vi v8, v8, -10
669 %vc = and <vscale x 32 x i16> %va, splat (i16 -10)
670 ret <vscale x 32 x i16> %vc
673 define <vscale x 32 x i16> @vand_vi_nxv32i16_1(<vscale x 32 x i16> %va) {
674 ; CHECK-LABEL: vand_vi_nxv32i16_1:
676 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
677 ; CHECK-NEXT: vand.vi v8, v8, 8
679 %vc = and <vscale x 32 x i16> %va, splat (i16 8)
680 ret <vscale x 32 x i16> %vc
683 define <vscale x 32 x i16> @vand_vi_nxv32i16_2(<vscale x 32 x i16> %va) {
684 ; CHECK-LABEL: vand_vi_nxv32i16_2:
686 ; CHECK-NEXT: li a0, 16
687 ; CHECK-NEXT: vsetvli a1, zero, e16, m8, ta, ma
688 ; CHECK-NEXT: vand.vx v8, v8, a0
690 %vc = and <vscale x 32 x i16> %va, splat (i16 16)
691 ret <vscale x 32 x i16> %vc
694 define <vscale x 1 x i32> @vand_vv_nxv1i32(<vscale x 1 x i32> %va, <vscale x 1 x i32> %vb) {
695 ; CHECK-LABEL: vand_vv_nxv1i32:
697 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
698 ; CHECK-NEXT: vand.vv v8, v8, v9
700 %vc = and <vscale x 1 x i32> %va, %vb
701 ret <vscale x 1 x i32> %vc
704 define <vscale x 1 x i32> @vand_vx_nxv1i32(<vscale x 1 x i32> %va, i32 signext %b) {
705 ; CHECK-LABEL: vand_vx_nxv1i32:
707 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
708 ; CHECK-NEXT: vand.vx v8, v8, a0
710 %head = insertelement <vscale x 1 x i32> poison, i32 %b, i32 0
711 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
712 %vc = and <vscale x 1 x i32> %va, %splat
713 ret <vscale x 1 x i32> %vc
716 define <vscale x 1 x i32> @vand_vi_nxv1i32_0(<vscale x 1 x i32> %va) {
717 ; CHECK-LABEL: vand_vi_nxv1i32_0:
719 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
720 ; CHECK-NEXT: vand.vi v8, v8, -10
722 %vc = and <vscale x 1 x i32> %va, splat (i32 -10)
723 ret <vscale x 1 x i32> %vc
726 define <vscale x 1 x i32> @vand_vi_nxv1i32_1(<vscale x 1 x i32> %va) {
727 ; CHECK-LABEL: vand_vi_nxv1i32_1:
729 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
730 ; CHECK-NEXT: vand.vi v8, v8, 8
732 %vc = and <vscale x 1 x i32> %va, splat (i32 8)
733 ret <vscale x 1 x i32> %vc
736 define <vscale x 1 x i32> @vand_vi_nxv1i32_2(<vscale x 1 x i32> %va) {
737 ; CHECK-LABEL: vand_vi_nxv1i32_2:
739 ; CHECK-NEXT: li a0, 16
740 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
741 ; CHECK-NEXT: vand.vx v8, v8, a0
743 %vc = and <vscale x 1 x i32> %va, splat (i32 16)
744 ret <vscale x 1 x i32> %vc
747 define <vscale x 2 x i32> @vand_vv_nxv2i32(<vscale x 2 x i32> %va, <vscale x 2 x i32> %vb) {
748 ; CHECK-LABEL: vand_vv_nxv2i32:
750 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
751 ; CHECK-NEXT: vand.vv v8, v8, v9
753 %vc = and <vscale x 2 x i32> %va, %vb
754 ret <vscale x 2 x i32> %vc
757 define <vscale x 2 x i32> @vand_vx_nxv2i32(<vscale x 2 x i32> %va, i32 signext %b) {
758 ; CHECK-LABEL: vand_vx_nxv2i32:
760 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
761 ; CHECK-NEXT: vand.vx v8, v8, a0
763 %head = insertelement <vscale x 2 x i32> poison, i32 %b, i32 0
764 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
765 %vc = and <vscale x 2 x i32> %va, %splat
766 ret <vscale x 2 x i32> %vc
769 define <vscale x 2 x i32> @vand_vi_nxv2i32_0(<vscale x 2 x i32> %va) {
770 ; CHECK-LABEL: vand_vi_nxv2i32_0:
772 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
773 ; CHECK-NEXT: vand.vi v8, v8, -10
775 %vc = and <vscale x 2 x i32> %va, splat (i32 -10)
776 ret <vscale x 2 x i32> %vc
779 define <vscale x 2 x i32> @vand_vi_nxv2i32_1(<vscale x 2 x i32> %va) {
780 ; CHECK-LABEL: vand_vi_nxv2i32_1:
782 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
783 ; CHECK-NEXT: vand.vi v8, v8, 8
785 %vc = and <vscale x 2 x i32> %va, splat (i32 8)
786 ret <vscale x 2 x i32> %vc
789 define <vscale x 2 x i32> @vand_vi_nxv2i32_2(<vscale x 2 x i32> %va) {
790 ; CHECK-LABEL: vand_vi_nxv2i32_2:
792 ; CHECK-NEXT: li a0, 16
793 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
794 ; CHECK-NEXT: vand.vx v8, v8, a0
796 %vc = and <vscale x 2 x i32> %va, splat (i32 16)
797 ret <vscale x 2 x i32> %vc
800 define <vscale x 4 x i32> @vand_vv_nxv4i32(<vscale x 4 x i32> %va, <vscale x 4 x i32> %vb) {
801 ; CHECK-LABEL: vand_vv_nxv4i32:
803 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
804 ; CHECK-NEXT: vand.vv v8, v8, v10
806 %vc = and <vscale x 4 x i32> %va, %vb
807 ret <vscale x 4 x i32> %vc
810 define <vscale x 4 x i32> @vand_vx_nxv4i32(<vscale x 4 x i32> %va, i32 signext %b) {
811 ; CHECK-LABEL: vand_vx_nxv4i32:
813 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
814 ; CHECK-NEXT: vand.vx v8, v8, a0
816 %head = insertelement <vscale x 4 x i32> poison, i32 %b, i32 0
817 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
818 %vc = and <vscale x 4 x i32> %va, %splat
819 ret <vscale x 4 x i32> %vc
822 define <vscale x 4 x i32> @vand_vi_nxv4i32_0(<vscale x 4 x i32> %va) {
823 ; CHECK-LABEL: vand_vi_nxv4i32_0:
825 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
826 ; CHECK-NEXT: vand.vi v8, v8, -10
828 %vc = and <vscale x 4 x i32> %va, splat (i32 -10)
829 ret <vscale x 4 x i32> %vc
832 define <vscale x 4 x i32> @vand_vi_nxv4i32_1(<vscale x 4 x i32> %va) {
833 ; CHECK-LABEL: vand_vi_nxv4i32_1:
835 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
836 ; CHECK-NEXT: vand.vi v8, v8, 8
838 %vc = and <vscale x 4 x i32> %va, splat (i32 8)
839 ret <vscale x 4 x i32> %vc
842 define <vscale x 4 x i32> @vand_vi_nxv4i32_2(<vscale x 4 x i32> %va) {
843 ; CHECK-LABEL: vand_vi_nxv4i32_2:
845 ; CHECK-NEXT: li a0, 16
846 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
847 ; CHECK-NEXT: vand.vx v8, v8, a0
849 %vc = and <vscale x 4 x i32> %va, splat (i32 16)
850 ret <vscale x 4 x i32> %vc
853 define <vscale x 8 x i32> @vand_vv_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %vb) {
854 ; CHECK-LABEL: vand_vv_nxv8i32:
856 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
857 ; CHECK-NEXT: vand.vv v8, v8, v12
859 %vc = and <vscale x 8 x i32> %va, %vb
860 ret <vscale x 8 x i32> %vc
863 define <vscale x 8 x i32> @vand_vx_nxv8i32(<vscale x 8 x i32> %va, i32 signext %b) {
864 ; CHECK-LABEL: vand_vx_nxv8i32:
866 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
867 ; CHECK-NEXT: vand.vx v8, v8, a0
869 %head = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
870 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
871 %vc = and <vscale x 8 x i32> %va, %splat
872 ret <vscale x 8 x i32> %vc
875 define <vscale x 8 x i32> @vand_vi_nxv8i32_0(<vscale x 8 x i32> %va) {
876 ; CHECK-LABEL: vand_vi_nxv8i32_0:
878 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
879 ; CHECK-NEXT: vand.vi v8, v8, -10
881 %vc = and <vscale x 8 x i32> %va, splat (i32 -10)
882 ret <vscale x 8 x i32> %vc
885 define <vscale x 8 x i32> @vand_vi_nxv8i32_1(<vscale x 8 x i32> %va) {
886 ; CHECK-LABEL: vand_vi_nxv8i32_1:
888 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
889 ; CHECK-NEXT: vand.vi v8, v8, 8
891 %vc = and <vscale x 8 x i32> %va, splat (i32 8)
892 ret <vscale x 8 x i32> %vc
895 define <vscale x 8 x i32> @vand_vi_nxv8i32_2(<vscale x 8 x i32> %va) {
896 ; CHECK-LABEL: vand_vi_nxv8i32_2:
898 ; CHECK-NEXT: li a0, 16
899 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
900 ; CHECK-NEXT: vand.vx v8, v8, a0
902 %vc = and <vscale x 8 x i32> %va, splat (i32 16)
903 ret <vscale x 8 x i32> %vc
906 define <vscale x 16 x i32> @vand_vv_nxv16i32(<vscale x 16 x i32> %va, <vscale x 16 x i32> %vb) {
907 ; CHECK-LABEL: vand_vv_nxv16i32:
909 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
910 ; CHECK-NEXT: vand.vv v8, v8, v16
912 %vc = and <vscale x 16 x i32> %va, %vb
913 ret <vscale x 16 x i32> %vc
916 define <vscale x 16 x i32> @vand_vx_nxv16i32(<vscale x 16 x i32> %va, i32 signext %b) {
917 ; CHECK-LABEL: vand_vx_nxv16i32:
919 ; CHECK-NEXT: vsetvli a1, zero, e32, m8, ta, ma
920 ; CHECK-NEXT: vand.vx v8, v8, a0
922 %head = insertelement <vscale x 16 x i32> poison, i32 %b, i32 0
923 %splat = shufflevector <vscale x 16 x i32> %head, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
924 %vc = and <vscale x 16 x i32> %va, %splat
925 ret <vscale x 16 x i32> %vc
928 define <vscale x 16 x i32> @vand_vi_nxv16i32_0(<vscale x 16 x i32> %va) {
929 ; CHECK-LABEL: vand_vi_nxv16i32_0:
931 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
932 ; CHECK-NEXT: vand.vi v8, v8, -10
934 %vc = and <vscale x 16 x i32> %va, splat (i32 -10)
935 ret <vscale x 16 x i32> %vc
938 define <vscale x 16 x i32> @vand_vi_nxv16i32_1(<vscale x 16 x i32> %va) {
939 ; CHECK-LABEL: vand_vi_nxv16i32_1:
941 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
942 ; CHECK-NEXT: vand.vi v8, v8, 8
944 %vc = and <vscale x 16 x i32> %va, splat (i32 8)
945 ret <vscale x 16 x i32> %vc
948 define <vscale x 16 x i32> @vand_vi_nxv16i32_2(<vscale x 16 x i32> %va) {
949 ; CHECK-LABEL: vand_vi_nxv16i32_2:
951 ; CHECK-NEXT: li a0, 16
952 ; CHECK-NEXT: vsetvli a1, zero, e32, m8, ta, ma
953 ; CHECK-NEXT: vand.vx v8, v8, a0
955 %vc = and <vscale x 16 x i32> %va, splat (i32 16)
956 ret <vscale x 16 x i32> %vc
959 define <vscale x 1 x i64> @vand_vv_nxv1i64(<vscale x 1 x i64> %va, <vscale x 1 x i64> %vb) {
960 ; CHECK-LABEL: vand_vv_nxv1i64:
962 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
963 ; CHECK-NEXT: vand.vv v8, v8, v9
965 %vc = and <vscale x 1 x i64> %va, %vb
966 ret <vscale x 1 x i64> %vc
969 define <vscale x 1 x i64> @vand_vx_nxv1i64(<vscale x 1 x i64> %va, i64 %b) {
970 ; RV32-LABEL: vand_vx_nxv1i64:
972 ; RV32-NEXT: addi sp, sp, -16
973 ; RV32-NEXT: .cfi_def_cfa_offset 16
974 ; RV32-NEXT: sw a1, 12(sp)
975 ; RV32-NEXT: sw a0, 8(sp)
976 ; RV32-NEXT: addi a0, sp, 8
977 ; RV32-NEXT: vsetvli a1, zero, e64, m1, ta, ma
978 ; RV32-NEXT: vlse64.v v9, (a0), zero
979 ; RV32-NEXT: vand.vv v8, v8, v9
980 ; RV32-NEXT: addi sp, sp, 16
983 ; RV64-LABEL: vand_vx_nxv1i64:
985 ; RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma
986 ; RV64-NEXT: vand.vx v8, v8, a0
988 %head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
989 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
990 %vc = and <vscale x 1 x i64> %va, %splat
991 ret <vscale x 1 x i64> %vc
994 define <vscale x 1 x i64> @vand_vi_nxv1i64_0(<vscale x 1 x i64> %va) {
995 ; CHECK-LABEL: vand_vi_nxv1i64_0:
997 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
998 ; CHECK-NEXT: vand.vi v8, v8, -10
1000 %vc = and <vscale x 1 x i64> %va, splat (i64 -10)
1001 ret <vscale x 1 x i64> %vc
1004 define <vscale x 1 x i64> @vand_vi_nxv1i64_1(<vscale x 1 x i64> %va) {
1005 ; CHECK-LABEL: vand_vi_nxv1i64_1:
1007 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
1008 ; CHECK-NEXT: vand.vi v8, v8, 8
1010 %vc = and <vscale x 1 x i64> %va, splat (i64 8)
1011 ret <vscale x 1 x i64> %vc
1014 define <vscale x 1 x i64> @vand_vi_nxv1i64_2(<vscale x 1 x i64> %va) {
1015 ; CHECK-LABEL: vand_vi_nxv1i64_2:
1017 ; CHECK-NEXT: li a0, 16
1018 ; CHECK-NEXT: vsetvli a1, zero, e64, m1, ta, ma
1019 ; CHECK-NEXT: vand.vx v8, v8, a0
1021 %vc = and <vscale x 1 x i64> %va, splat (i64 16)
1022 ret <vscale x 1 x i64> %vc
1025 define <vscale x 2 x i64> @vand_vv_nxv2i64(<vscale x 2 x i64> %va, <vscale x 2 x i64> %vb) {
1026 ; CHECK-LABEL: vand_vv_nxv2i64:
1028 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
1029 ; CHECK-NEXT: vand.vv v8, v8, v10
1031 %vc = and <vscale x 2 x i64> %va, %vb
1032 ret <vscale x 2 x i64> %vc
1035 define <vscale x 2 x i64> @vand_vx_nxv2i64(<vscale x 2 x i64> %va, i64 %b) {
1036 ; RV32-LABEL: vand_vx_nxv2i64:
1038 ; RV32-NEXT: addi sp, sp, -16
1039 ; RV32-NEXT: .cfi_def_cfa_offset 16
1040 ; RV32-NEXT: sw a1, 12(sp)
1041 ; RV32-NEXT: sw a0, 8(sp)
1042 ; RV32-NEXT: addi a0, sp, 8
1043 ; RV32-NEXT: vsetvli a1, zero, e64, m2, ta, ma
1044 ; RV32-NEXT: vlse64.v v10, (a0), zero
1045 ; RV32-NEXT: vand.vv v8, v8, v10
1046 ; RV32-NEXT: addi sp, sp, 16
1049 ; RV64-LABEL: vand_vx_nxv2i64:
1051 ; RV64-NEXT: vsetvli a1, zero, e64, m2, ta, ma
1052 ; RV64-NEXT: vand.vx v8, v8, a0
1054 %head = insertelement <vscale x 2 x i64> poison, i64 %b, i32 0
1055 %splat = shufflevector <vscale x 2 x i64> %head, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
1056 %vc = and <vscale x 2 x i64> %va, %splat
1057 ret <vscale x 2 x i64> %vc
1060 define <vscale x 2 x i64> @vand_vi_nxv2i64_0(<vscale x 2 x i64> %va) {
1061 ; CHECK-LABEL: vand_vi_nxv2i64_0:
1063 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
1064 ; CHECK-NEXT: vand.vi v8, v8, -10
1066 %vc = and <vscale x 2 x i64> %va, splat (i64 -10)
1067 ret <vscale x 2 x i64> %vc
1070 define <vscale x 2 x i64> @vand_vi_nxv2i64_1(<vscale x 2 x i64> %va) {
1071 ; CHECK-LABEL: vand_vi_nxv2i64_1:
1073 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
1074 ; CHECK-NEXT: vand.vi v8, v8, 8
1076 %vc = and <vscale x 2 x i64> %va, splat (i64 8)
1077 ret <vscale x 2 x i64> %vc
1080 define <vscale x 2 x i64> @vand_vi_nxv2i64_2(<vscale x 2 x i64> %va) {
1081 ; CHECK-LABEL: vand_vi_nxv2i64_2:
1083 ; CHECK-NEXT: li a0, 16
1084 ; CHECK-NEXT: vsetvli a1, zero, e64, m2, ta, ma
1085 ; CHECK-NEXT: vand.vx v8, v8, a0
1087 %vc = and <vscale x 2 x i64> %va, splat (i64 16)
1088 ret <vscale x 2 x i64> %vc
1091 define <vscale x 4 x i64> @vand_vv_nxv4i64(<vscale x 4 x i64> %va, <vscale x 4 x i64> %vb) {
1092 ; CHECK-LABEL: vand_vv_nxv4i64:
1094 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
1095 ; CHECK-NEXT: vand.vv v8, v8, v12
1097 %vc = and <vscale x 4 x i64> %va, %vb
1098 ret <vscale x 4 x i64> %vc
1101 define <vscale x 4 x i64> @vand_vx_nxv4i64(<vscale x 4 x i64> %va, i64 %b) {
1102 ; RV32-LABEL: vand_vx_nxv4i64:
1104 ; RV32-NEXT: addi sp, sp, -16
1105 ; RV32-NEXT: .cfi_def_cfa_offset 16
1106 ; RV32-NEXT: sw a1, 12(sp)
1107 ; RV32-NEXT: sw a0, 8(sp)
1108 ; RV32-NEXT: addi a0, sp, 8
1109 ; RV32-NEXT: vsetvli a1, zero, e64, m4, ta, ma
1110 ; RV32-NEXT: vlse64.v v12, (a0), zero
1111 ; RV32-NEXT: vand.vv v8, v8, v12
1112 ; RV32-NEXT: addi sp, sp, 16
1115 ; RV64-LABEL: vand_vx_nxv4i64:
1117 ; RV64-NEXT: vsetvli a1, zero, e64, m4, ta, ma
1118 ; RV64-NEXT: vand.vx v8, v8, a0
1120 %head = insertelement <vscale x 4 x i64> poison, i64 %b, i32 0
1121 %splat = shufflevector <vscale x 4 x i64> %head, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
1122 %vc = and <vscale x 4 x i64> %va, %splat
1123 ret <vscale x 4 x i64> %vc
1126 define <vscale x 4 x i64> @vand_vi_nxv4i64_0(<vscale x 4 x i64> %va) {
1127 ; CHECK-LABEL: vand_vi_nxv4i64_0:
1129 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
1130 ; CHECK-NEXT: vand.vi v8, v8, -10
1132 %vc = and <vscale x 4 x i64> %va, splat (i64 -10)
1133 ret <vscale x 4 x i64> %vc
1136 define <vscale x 4 x i64> @vand_vi_nxv4i64_1(<vscale x 4 x i64> %va) {
1137 ; CHECK-LABEL: vand_vi_nxv4i64_1:
1139 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
1140 ; CHECK-NEXT: vand.vi v8, v8, 8
1142 %vc = and <vscale x 4 x i64> %va, splat (i64 8)
1143 ret <vscale x 4 x i64> %vc
1146 define <vscale x 4 x i64> @vand_vi_nxv4i64_2(<vscale x 4 x i64> %va) {
1147 ; CHECK-LABEL: vand_vi_nxv4i64_2:
1149 ; CHECK-NEXT: li a0, 16
1150 ; CHECK-NEXT: vsetvli a1, zero, e64, m4, ta, ma
1151 ; CHECK-NEXT: vand.vx v8, v8, a0
1153 %vc = and <vscale x 4 x i64> %va, splat (i64 16)
1154 ret <vscale x 4 x i64> %vc
1157 define <vscale x 8 x i64> @vand_vv_nxv8i64(<vscale x 8 x i64> %va, <vscale x 8 x i64> %vb) {
1158 ; CHECK-LABEL: vand_vv_nxv8i64:
1160 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
1161 ; CHECK-NEXT: vand.vv v8, v8, v16
1163 %vc = and <vscale x 8 x i64> %va, %vb
1164 ret <vscale x 8 x i64> %vc
1167 define <vscale x 8 x i64> @vand_vx_nxv8i64(<vscale x 8 x i64> %va, i64 %b) {
1168 ; RV32-LABEL: vand_vx_nxv8i64:
1170 ; RV32-NEXT: addi sp, sp, -16
1171 ; RV32-NEXT: .cfi_def_cfa_offset 16
1172 ; RV32-NEXT: sw a1, 12(sp)
1173 ; RV32-NEXT: sw a0, 8(sp)
1174 ; RV32-NEXT: addi a0, sp, 8
1175 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1176 ; RV32-NEXT: vlse64.v v16, (a0), zero
1177 ; RV32-NEXT: vand.vv v8, v8, v16
1178 ; RV32-NEXT: addi sp, sp, 16
1181 ; RV64-LABEL: vand_vx_nxv8i64:
1183 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1184 ; RV64-NEXT: vand.vx v8, v8, a0
1186 %head = insertelement <vscale x 8 x i64> poison, i64 %b, i32 0
1187 %splat = shufflevector <vscale x 8 x i64> %head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
1188 %vc = and <vscale x 8 x i64> %va, %splat
1189 ret <vscale x 8 x i64> %vc
1192 define <vscale x 8 x i64> @vand_vi_nxv8i64_0(<vscale x 8 x i64> %va) {
1193 ; CHECK-LABEL: vand_vi_nxv8i64_0:
1195 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
1196 ; CHECK-NEXT: vand.vi v8, v8, -10
1198 %vc = and <vscale x 8 x i64> %va, splat (i64 -10)
1199 ret <vscale x 8 x i64> %vc
1202 define <vscale x 8 x i64> @vand_vi_nxv8i64_1(<vscale x 8 x i64> %va) {
1203 ; CHECK-LABEL: vand_vi_nxv8i64_1:
1205 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
1206 ; CHECK-NEXT: vand.vi v8, v8, 8
1208 %vc = and <vscale x 8 x i64> %va, splat (i64 8)
1209 ret <vscale x 8 x i64> %vc
1212 define <vscale x 8 x i64> @vand_vi_nxv8i64_2(<vscale x 8 x i64> %va) {
1213 ; CHECK-LABEL: vand_vi_nxv8i64_2:
1215 ; CHECK-NEXT: li a0, 16
1216 ; CHECK-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1217 ; CHECK-NEXT: vand.vx v8, v8, a0
1219 %vc = and <vscale x 8 x i64> %va, splat (i64 16)
1220 ret <vscale x 8 x i64> %vc
1223 define <vscale x 8 x i64> @vand_xx_nxv8i64(i64 %a, i64 %b) nounwind {
1224 ; RV32-LABEL: vand_xx_nxv8i64:
1226 ; RV32-NEXT: addi sp, sp, -16
1227 ; RV32-NEXT: sw a1, 12(sp)
1228 ; RV32-NEXT: sw a0, 8(sp)
1229 ; RV32-NEXT: addi a0, sp, 8
1230 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1231 ; RV32-NEXT: vlse64.v v8, (a0), zero
1232 ; RV32-NEXT: sw a3, 4(sp)
1233 ; RV32-NEXT: sw a2, 0(sp)
1234 ; RV32-NEXT: mv a0, sp
1235 ; RV32-NEXT: vlse64.v v16, (a0), zero
1236 ; RV32-NEXT: vand.vv v8, v8, v16
1237 ; RV32-NEXT: addi sp, sp, 16
1240 ; RV64-LABEL: vand_xx_nxv8i64:
1242 ; RV64-NEXT: and a0, a0, a1
1243 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1244 ; RV64-NEXT: vmv.v.x v8, a0
1246 %head1 = insertelement <vscale x 8 x i64> poison, i64 %a, i32 0
1247 %splat1 = shufflevector <vscale x 8 x i64> %head1, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
1248 %head2 = insertelement <vscale x 8 x i64> poison, i64 %b, i32 0
1249 %splat2 = shufflevector <vscale x 8 x i64> %head2, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
1250 %v = and <vscale x 8 x i64> %splat1, %splat2
1251 ret <vscale x 8 x i64> %v
1254 define <vscale x 8 x i32> @vand_vv_mask_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %vb, <vscale x 8 x i1> %mask) {
1255 ; CHECK-LABEL: vand_vv_mask_nxv8i32:
1257 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, mu
1258 ; CHECK-NEXT: vand.vv v8, v8, v12, v0.t
1260 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x i32> %vb, <vscale x 8 x i32> splat (i32 -1)
1261 %vc = and <vscale x 8 x i32> %va, %vs
1262 ret <vscale x 8 x i32> %vc
1265 define <vscale x 8 x i32> @vand_vx_mask_nxv8i32(<vscale x 8 x i32> %va, i32 signext %b, <vscale x 8 x i1> %mask) {
1266 ; CHECK-LABEL: vand_vx_mask_nxv8i32:
1268 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, mu
1269 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
1271 %head2 = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
1272 %splat = shufflevector <vscale x 8 x i32> %head2, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
1273 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x i32> %splat, <vscale x 8 x i32> splat (i32 -1)
1274 %vc = and <vscale x 8 x i32> %va, %vs
1275 ret <vscale x 8 x i32> %vc
1278 define <vscale x 8 x i32> @vand_vi_mask_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i1> %mask) {
1279 ; CHECK-LABEL: vand_vi_mask_nxv8i32:
1281 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, mu
1282 ; CHECK-NEXT: vand.vi v8, v8, 7, v0.t
1284 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x i32> splat (i32 7), <vscale x 8 x i32> splat (i32 -1)
1285 %vc = and <vscale x 8 x i32> %va, %vs
1286 ret <vscale x 8 x i32> %vc