1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs < %s \
3 ; RUN: | FileCheck %s --check-prefixes=CHECK,RV32
4 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s \
5 ; RUN: | FileCheck %s --check-prefixes=CHECK,RV64
7 define <1 x i1> @select_v1i1(i1 zeroext %c, <1 x i1> %a, <1 x i1> %b) {
8 ; CHECK-LABEL: select_v1i1:
10 ; CHECK-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
11 ; CHECK-NEXT: vmv.s.x v9, a0
12 ; CHECK-NEXT: vmsne.vi v9, v9, 0
13 ; CHECK-NEXT: vmandn.mm v8, v8, v9
14 ; CHECK-NEXT: vmand.mm v9, v0, v9
15 ; CHECK-NEXT: vmor.mm v0, v9, v8
17 %v = select i1 %c, <1 x i1> %a, <1 x i1> %b
21 define <1 x i1> @selectcc_v1i1(i1 signext %a, i1 signext %b, <1 x i1> %c, <1 x i1> %d) {
22 ; CHECK-LABEL: selectcc_v1i1:
24 ; CHECK-NEXT: xor a0, a0, a1
25 ; CHECK-NEXT: andi a0, a0, 1
26 ; CHECK-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
27 ; CHECK-NEXT: vmv.s.x v9, a0
28 ; CHECK-NEXT: vmsne.vi v9, v9, 0
29 ; CHECK-NEXT: vmandn.mm v8, v8, v9
30 ; CHECK-NEXT: vmand.mm v9, v0, v9
31 ; CHECK-NEXT: vmor.mm v0, v9, v8
33 %cmp = icmp ne i1 %a, %b
34 %v = select i1 %cmp, <1 x i1> %c, <1 x i1> %d
38 define <2 x i1> @select_v2i1(i1 zeroext %c, <2 x i1> %a, <2 x i1> %b) {
39 ; CHECK-LABEL: select_v2i1:
41 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
42 ; CHECK-NEXT: vmv.v.x v9, a0
43 ; CHECK-NEXT: vmsne.vi v9, v9, 0
44 ; CHECK-NEXT: vmandn.mm v8, v8, v9
45 ; CHECK-NEXT: vmand.mm v9, v0, v9
46 ; CHECK-NEXT: vmor.mm v0, v9, v8
48 %v = select i1 %c, <2 x i1> %a, <2 x i1> %b
52 define <2 x i1> @selectcc_v2i1(i1 signext %a, i1 signext %b, <2 x i1> %c, <2 x i1> %d) {
53 ; CHECK-LABEL: selectcc_v2i1:
55 ; CHECK-NEXT: xor a0, a0, a1
56 ; CHECK-NEXT: andi a0, a0, 1
57 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
58 ; CHECK-NEXT: vmv.v.x v9, a0
59 ; CHECK-NEXT: vmsne.vi v9, v9, 0
60 ; CHECK-NEXT: vmandn.mm v8, v8, v9
61 ; CHECK-NEXT: vmand.mm v9, v0, v9
62 ; CHECK-NEXT: vmor.mm v0, v9, v8
64 %cmp = icmp ne i1 %a, %b
65 %v = select i1 %cmp, <2 x i1> %c, <2 x i1> %d
69 define <4 x i1> @select_v4i1(i1 zeroext %c, <4 x i1> %a, <4 x i1> %b) {
70 ; CHECK-LABEL: select_v4i1:
72 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
73 ; CHECK-NEXT: vmv.v.x v9, a0
74 ; CHECK-NEXT: vmsne.vi v9, v9, 0
75 ; CHECK-NEXT: vmandn.mm v8, v8, v9
76 ; CHECK-NEXT: vmand.mm v9, v0, v9
77 ; CHECK-NEXT: vmor.mm v0, v9, v8
79 %v = select i1 %c, <4 x i1> %a, <4 x i1> %b
83 define <4 x i1> @selectcc_v4i1(i1 signext %a, i1 signext %b, <4 x i1> %c, <4 x i1> %d) {
84 ; CHECK-LABEL: selectcc_v4i1:
86 ; CHECK-NEXT: xor a0, a0, a1
87 ; CHECK-NEXT: andi a0, a0, 1
88 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
89 ; CHECK-NEXT: vmv.v.x v9, a0
90 ; CHECK-NEXT: vmsne.vi v9, v9, 0
91 ; CHECK-NEXT: vmandn.mm v8, v8, v9
92 ; CHECK-NEXT: vmand.mm v9, v0, v9
93 ; CHECK-NEXT: vmor.mm v0, v9, v8
95 %cmp = icmp ne i1 %a, %b
96 %v = select i1 %cmp, <4 x i1> %c, <4 x i1> %d
100 define <8 x i1> @select_v8i1(i1 zeroext %c, <8 x i1> %a, <8 x i1> %b) {
101 ; CHECK-LABEL: select_v8i1:
103 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
104 ; CHECK-NEXT: vmv.v.x v9, a0
105 ; CHECK-NEXT: vmsne.vi v9, v9, 0
106 ; CHECK-NEXT: vmandn.mm v8, v8, v9
107 ; CHECK-NEXT: vmand.mm v9, v0, v9
108 ; CHECK-NEXT: vmor.mm v0, v9, v8
110 %v = select i1 %c, <8 x i1> %a, <8 x i1> %b
114 define <8 x i1> @selectcc_v8i1(i1 signext %a, i1 signext %b, <8 x i1> %c, <8 x i1> %d) {
115 ; CHECK-LABEL: selectcc_v8i1:
117 ; CHECK-NEXT: xor a0, a0, a1
118 ; CHECK-NEXT: andi a0, a0, 1
119 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
120 ; CHECK-NEXT: vmv.v.x v9, a0
121 ; CHECK-NEXT: vmsne.vi v9, v9, 0
122 ; CHECK-NEXT: vmandn.mm v8, v8, v9
123 ; CHECK-NEXT: vmand.mm v9, v0, v9
124 ; CHECK-NEXT: vmor.mm v0, v9, v8
126 %cmp = icmp ne i1 %a, %b
127 %v = select i1 %cmp, <8 x i1> %c, <8 x i1> %d
131 define <16 x i1> @select_v16i1(i1 zeroext %c, <16 x i1> %a, <16 x i1> %b) {
132 ; CHECK-LABEL: select_v16i1:
134 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
135 ; CHECK-NEXT: vmv.v.x v9, a0
136 ; CHECK-NEXT: vmsne.vi v9, v9, 0
137 ; CHECK-NEXT: vmandn.mm v8, v8, v9
138 ; CHECK-NEXT: vmand.mm v9, v0, v9
139 ; CHECK-NEXT: vmor.mm v0, v9, v8
141 %v = select i1 %c, <16 x i1> %a, <16 x i1> %b
145 define <16 x i1> @selectcc_v16i1(i1 signext %a, i1 signext %b, <16 x i1> %c, <16 x i1> %d) {
146 ; CHECK-LABEL: selectcc_v16i1:
148 ; CHECK-NEXT: xor a0, a0, a1
149 ; CHECK-NEXT: andi a0, a0, 1
150 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
151 ; CHECK-NEXT: vmv.v.x v9, a0
152 ; CHECK-NEXT: vmsne.vi v9, v9, 0
153 ; CHECK-NEXT: vmandn.mm v8, v8, v9
154 ; CHECK-NEXT: vmand.mm v9, v0, v9
155 ; CHECK-NEXT: vmor.mm v0, v9, v8
157 %cmp = icmp ne i1 %a, %b
158 %v = select i1 %cmp, <16 x i1> %c, <16 x i1> %d
162 define <2 x i8> @select_v2i8(i1 zeroext %c, <2 x i8> %a, <2 x i8> %b) {
163 ; CHECK-LABEL: select_v2i8:
165 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
166 ; CHECK-NEXT: vmv.v.x v10, a0
167 ; CHECK-NEXT: vmsne.vi v0, v10, 0
168 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
170 %v = select i1 %c, <2 x i8> %a, <2 x i8> %b
174 define <2 x i8> @selectcc_v2i8(i8 signext %a, i8 signext %b, <2 x i8> %c, <2 x i8> %d) {
175 ; CHECK-LABEL: selectcc_v2i8:
177 ; CHECK-NEXT: xor a0, a0, a1
178 ; CHECK-NEXT: snez a0, a0
179 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
180 ; CHECK-NEXT: vmv.v.x v10, a0
181 ; CHECK-NEXT: vmsne.vi v0, v10, 0
182 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
184 %cmp = icmp ne i8 %a, %b
185 %v = select i1 %cmp, <2 x i8> %c, <2 x i8> %d
189 define <4 x i8> @select_v4i8(i1 zeroext %c, <4 x i8> %a, <4 x i8> %b) {
190 ; CHECK-LABEL: select_v4i8:
192 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
193 ; CHECK-NEXT: vmv.v.x v10, a0
194 ; CHECK-NEXT: vmsne.vi v0, v10, 0
195 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
197 %v = select i1 %c, <4 x i8> %a, <4 x i8> %b
201 define <4 x i8> @selectcc_v4i8(i8 signext %a, i8 signext %b, <4 x i8> %c, <4 x i8> %d) {
202 ; CHECK-LABEL: selectcc_v4i8:
204 ; CHECK-NEXT: xor a0, a0, a1
205 ; CHECK-NEXT: snez a0, a0
206 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
207 ; CHECK-NEXT: vmv.v.x v10, a0
208 ; CHECK-NEXT: vmsne.vi v0, v10, 0
209 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
211 %cmp = icmp ne i8 %a, %b
212 %v = select i1 %cmp, <4 x i8> %c, <4 x i8> %d
216 define <8 x i8> @select_v8i8(i1 zeroext %c, <8 x i8> %a, <8 x i8> %b) {
217 ; CHECK-LABEL: select_v8i8:
219 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
220 ; CHECK-NEXT: vmv.v.x v10, a0
221 ; CHECK-NEXT: vmsne.vi v0, v10, 0
222 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
224 %v = select i1 %c, <8 x i8> %a, <8 x i8> %b
228 define <8 x i8> @selectcc_v8i8(i8 signext %a, i8 signext %b, <8 x i8> %c, <8 x i8> %d) {
229 ; CHECK-LABEL: selectcc_v8i8:
231 ; CHECK-NEXT: xor a0, a0, a1
232 ; CHECK-NEXT: snez a0, a0
233 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
234 ; CHECK-NEXT: vmv.v.x v10, a0
235 ; CHECK-NEXT: vmsne.vi v0, v10, 0
236 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
238 %cmp = icmp ne i8 %a, %b
239 %v = select i1 %cmp, <8 x i8> %c, <8 x i8> %d
243 define <16 x i8> @select_v16i8(i1 zeroext %c, <16 x i8> %a, <16 x i8> %b) {
244 ; CHECK-LABEL: select_v16i8:
246 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
247 ; CHECK-NEXT: vmv.v.x v10, a0
248 ; CHECK-NEXT: vmsne.vi v0, v10, 0
249 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
251 %v = select i1 %c, <16 x i8> %a, <16 x i8> %b
255 define <16 x i8> @selectcc_v16i8(i8 signext %a, i8 signext %b, <16 x i8> %c, <16 x i8> %d) {
256 ; CHECK-LABEL: selectcc_v16i8:
258 ; CHECK-NEXT: xor a0, a0, a1
259 ; CHECK-NEXT: snez a0, a0
260 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
261 ; CHECK-NEXT: vmv.v.x v10, a0
262 ; CHECK-NEXT: vmsne.vi v0, v10, 0
263 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
265 %cmp = icmp ne i8 %a, %b
266 %v = select i1 %cmp, <16 x i8> %c, <16 x i8> %d
270 define <2 x i16> @select_v2i16(i1 zeroext %c, <2 x i16> %a, <2 x i16> %b) {
271 ; CHECK-LABEL: select_v2i16:
273 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
274 ; CHECK-NEXT: vmv.v.x v10, a0
275 ; CHECK-NEXT: vmsne.vi v0, v10, 0
276 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
277 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
279 %v = select i1 %c, <2 x i16> %a, <2 x i16> %b
283 define <2 x i16> @selectcc_v2i16(i16 signext %a, i16 signext %b, <2 x i16> %c, <2 x i16> %d) {
284 ; CHECK-LABEL: selectcc_v2i16:
286 ; CHECK-NEXT: xor a0, a0, a1
287 ; CHECK-NEXT: snez a0, a0
288 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
289 ; CHECK-NEXT: vmv.v.x v10, a0
290 ; CHECK-NEXT: vmsne.vi v0, v10, 0
291 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
292 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
294 %cmp = icmp ne i16 %a, %b
295 %v = select i1 %cmp, <2 x i16> %c, <2 x i16> %d
299 define <4 x i16> @select_v4i16(i1 zeroext %c, <4 x i16> %a, <4 x i16> %b) {
300 ; CHECK-LABEL: select_v4i16:
302 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
303 ; CHECK-NEXT: vmv.v.x v10, a0
304 ; CHECK-NEXT: vmsne.vi v0, v10, 0
305 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
306 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
308 %v = select i1 %c, <4 x i16> %a, <4 x i16> %b
312 define <4 x i16> @selectcc_v4i16(i16 signext %a, i16 signext %b, <4 x i16> %c, <4 x i16> %d) {
313 ; CHECK-LABEL: selectcc_v4i16:
315 ; CHECK-NEXT: xor a0, a0, a1
316 ; CHECK-NEXT: snez a0, a0
317 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
318 ; CHECK-NEXT: vmv.v.x v10, a0
319 ; CHECK-NEXT: vmsne.vi v0, v10, 0
320 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
321 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
323 %cmp = icmp ne i16 %a, %b
324 %v = select i1 %cmp, <4 x i16> %c, <4 x i16> %d
328 define <8 x i16> @select_v8i16(i1 zeroext %c, <8 x i16> %a, <8 x i16> %b) {
329 ; CHECK-LABEL: select_v8i16:
331 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
332 ; CHECK-NEXT: vmv.v.x v10, a0
333 ; CHECK-NEXT: vmsne.vi v0, v10, 0
334 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
335 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
337 %v = select i1 %c, <8 x i16> %a, <8 x i16> %b
341 define <8 x i16> @selectcc_v8i16(i16 signext %a, i16 signext %b, <8 x i16> %c, <8 x i16> %d) {
342 ; CHECK-LABEL: selectcc_v8i16:
344 ; CHECK-NEXT: xor a0, a0, a1
345 ; CHECK-NEXT: snez a0, a0
346 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
347 ; CHECK-NEXT: vmv.v.x v10, a0
348 ; CHECK-NEXT: vmsne.vi v0, v10, 0
349 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
350 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
352 %cmp = icmp ne i16 %a, %b
353 %v = select i1 %cmp, <8 x i16> %c, <8 x i16> %d
357 define <16 x i16> @select_v16i16(i1 zeroext %c, <16 x i16> %a, <16 x i16> %b) {
358 ; CHECK-LABEL: select_v16i16:
360 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
361 ; CHECK-NEXT: vmv.v.x v12, a0
362 ; CHECK-NEXT: vmsne.vi v0, v12, 0
363 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
364 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
366 %v = select i1 %c, <16 x i16> %a, <16 x i16> %b
370 define <16 x i16> @selectcc_v16i16(i16 signext %a, i16 signext %b, <16 x i16> %c, <16 x i16> %d) {
371 ; CHECK-LABEL: selectcc_v16i16:
373 ; CHECK-NEXT: xor a0, a0, a1
374 ; CHECK-NEXT: snez a0, a0
375 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
376 ; CHECK-NEXT: vmv.v.x v12, a0
377 ; CHECK-NEXT: vmsne.vi v0, v12, 0
378 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
379 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
381 %cmp = icmp ne i16 %a, %b
382 %v = select i1 %cmp, <16 x i16> %c, <16 x i16> %d
386 define <2 x i32> @select_v2i32(i1 zeroext %c, <2 x i32> %a, <2 x i32> %b) {
387 ; CHECK-LABEL: select_v2i32:
389 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
390 ; CHECK-NEXT: vmv.v.x v10, a0
391 ; CHECK-NEXT: vmsne.vi v0, v10, 0
392 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
393 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
395 %v = select i1 %c, <2 x i32> %a, <2 x i32> %b
399 define <2 x i32> @selectcc_v2i32(i32 signext %a, i32 signext %b, <2 x i32> %c, <2 x i32> %d) {
400 ; CHECK-LABEL: selectcc_v2i32:
402 ; CHECK-NEXT: xor a0, a0, a1
403 ; CHECK-NEXT: snez a0, a0
404 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
405 ; CHECK-NEXT: vmv.v.x v10, a0
406 ; CHECK-NEXT: vmsne.vi v0, v10, 0
407 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
408 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
410 %cmp = icmp ne i32 %a, %b
411 %v = select i1 %cmp, <2 x i32> %c, <2 x i32> %d
415 define <4 x i32> @select_v4i32(i1 zeroext %c, <4 x i32> %a, <4 x i32> %b) {
416 ; CHECK-LABEL: select_v4i32:
418 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
419 ; CHECK-NEXT: vmv.v.x v10, a0
420 ; CHECK-NEXT: vmsne.vi v0, v10, 0
421 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
422 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
424 %v = select i1 %c, <4 x i32> %a, <4 x i32> %b
428 define <4 x i32> @selectcc_v4i32(i32 signext %a, i32 signext %b, <4 x i32> %c, <4 x i32> %d) {
429 ; CHECK-LABEL: selectcc_v4i32:
431 ; CHECK-NEXT: xor a0, a0, a1
432 ; CHECK-NEXT: snez a0, a0
433 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
434 ; CHECK-NEXT: vmv.v.x v10, a0
435 ; CHECK-NEXT: vmsne.vi v0, v10, 0
436 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
437 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
439 %cmp = icmp ne i32 %a, %b
440 %v = select i1 %cmp, <4 x i32> %c, <4 x i32> %d
444 define <8 x i32> @select_v8i32(i1 zeroext %c, <8 x i32> %a, <8 x i32> %b) {
445 ; CHECK-LABEL: select_v8i32:
447 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
448 ; CHECK-NEXT: vmv.v.x v12, a0
449 ; CHECK-NEXT: vmsne.vi v0, v12, 0
450 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
451 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
453 %v = select i1 %c, <8 x i32> %a, <8 x i32> %b
457 define <8 x i32> @selectcc_v8i32(i32 signext %a, i32 signext %b, <8 x i32> %c, <8 x i32> %d) {
458 ; CHECK-LABEL: selectcc_v8i32:
460 ; CHECK-NEXT: xor a0, a0, a1
461 ; CHECK-NEXT: snez a0, a0
462 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
463 ; CHECK-NEXT: vmv.v.x v12, a0
464 ; CHECK-NEXT: vmsne.vi v0, v12, 0
465 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
466 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
468 %cmp = icmp ne i32 %a, %b
469 %v = select i1 %cmp, <8 x i32> %c, <8 x i32> %d
473 define <16 x i32> @select_v16i32(i1 zeroext %c, <16 x i32> %a, <16 x i32> %b) {
474 ; CHECK-LABEL: select_v16i32:
476 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
477 ; CHECK-NEXT: vmv.v.x v16, a0
478 ; CHECK-NEXT: vmsne.vi v0, v16, 0
479 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, ma
480 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
482 %v = select i1 %c, <16 x i32> %a, <16 x i32> %b
486 define <16 x i32> @selectcc_v16i32(i32 signext %a, i32 signext %b, <16 x i32> %c, <16 x i32> %d) {
487 ; CHECK-LABEL: selectcc_v16i32:
489 ; CHECK-NEXT: xor a0, a0, a1
490 ; CHECK-NEXT: snez a0, a0
491 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
492 ; CHECK-NEXT: vmv.v.x v16, a0
493 ; CHECK-NEXT: vmsne.vi v0, v16, 0
494 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, ma
495 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
497 %cmp = icmp ne i32 %a, %b
498 %v = select i1 %cmp, <16 x i32> %c, <16 x i32> %d
502 define <2 x i64> @select_v2i64(i1 zeroext %c, <2 x i64> %a, <2 x i64> %b) {
503 ; CHECK-LABEL: select_v2i64:
505 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
506 ; CHECK-NEXT: vmv.v.x v10, a0
507 ; CHECK-NEXT: vmsne.vi v0, v10, 0
508 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, ma
509 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
511 %v = select i1 %c, <2 x i64> %a, <2 x i64> %b
515 define <2 x i64> @selectcc_v2i64(i64 signext %a, i64 signext %b, <2 x i64> %c, <2 x i64> %d) {
516 ; RV32-LABEL: selectcc_v2i64:
518 ; RV32-NEXT: xor a1, a1, a3
519 ; RV32-NEXT: xor a0, a0, a2
520 ; RV32-NEXT: or a0, a0, a1
521 ; RV32-NEXT: snez a0, a0
522 ; RV32-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
523 ; RV32-NEXT: vmv.v.x v10, a0
524 ; RV32-NEXT: vmsne.vi v0, v10, 0
525 ; RV32-NEXT: vsetvli zero, zero, e64, m1, ta, ma
526 ; RV32-NEXT: vmerge.vvm v8, v9, v8, v0
529 ; RV64-LABEL: selectcc_v2i64:
531 ; RV64-NEXT: xor a0, a0, a1
532 ; RV64-NEXT: snez a0, a0
533 ; RV64-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
534 ; RV64-NEXT: vmv.v.x v10, a0
535 ; RV64-NEXT: vmsne.vi v0, v10, 0
536 ; RV64-NEXT: vsetvli zero, zero, e64, m1, ta, ma
537 ; RV64-NEXT: vmerge.vvm v8, v9, v8, v0
539 %cmp = icmp ne i64 %a, %b
540 %v = select i1 %cmp, <2 x i64> %c, <2 x i64> %d
544 define <4 x i64> @select_v4i64(i1 zeroext %c, <4 x i64> %a, <4 x i64> %b) {
545 ; CHECK-LABEL: select_v4i64:
547 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
548 ; CHECK-NEXT: vmv.v.x v12, a0
549 ; CHECK-NEXT: vmsne.vi v0, v12, 0
550 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, ma
551 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
553 %v = select i1 %c, <4 x i64> %a, <4 x i64> %b
557 define <4 x i64> @selectcc_v4i64(i64 signext %a, i64 signext %b, <4 x i64> %c, <4 x i64> %d) {
558 ; RV32-LABEL: selectcc_v4i64:
560 ; RV32-NEXT: xor a1, a1, a3
561 ; RV32-NEXT: xor a0, a0, a2
562 ; RV32-NEXT: or a0, a0, a1
563 ; RV32-NEXT: snez a0, a0
564 ; RV32-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
565 ; RV32-NEXT: vmv.v.x v12, a0
566 ; RV32-NEXT: vmsne.vi v0, v12, 0
567 ; RV32-NEXT: vsetvli zero, zero, e64, m2, ta, ma
568 ; RV32-NEXT: vmerge.vvm v8, v10, v8, v0
571 ; RV64-LABEL: selectcc_v4i64:
573 ; RV64-NEXT: xor a0, a0, a1
574 ; RV64-NEXT: snez a0, a0
575 ; RV64-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
576 ; RV64-NEXT: vmv.v.x v12, a0
577 ; RV64-NEXT: vmsne.vi v0, v12, 0
578 ; RV64-NEXT: vsetvli zero, zero, e64, m2, ta, ma
579 ; RV64-NEXT: vmerge.vvm v8, v10, v8, v0
581 %cmp = icmp ne i64 %a, %b
582 %v = select i1 %cmp, <4 x i64> %c, <4 x i64> %d
586 define <8 x i64> @select_v8i64(i1 zeroext %c, <8 x i64> %a, <8 x i64> %b) {
587 ; CHECK-LABEL: select_v8i64:
589 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
590 ; CHECK-NEXT: vmv.v.x v16, a0
591 ; CHECK-NEXT: vmsne.vi v0, v16, 0
592 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, ma
593 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
595 %v = select i1 %c, <8 x i64> %a, <8 x i64> %b
599 define <8 x i64> @selectcc_v8i64(i64 signext %a, i64 signext %b, <8 x i64> %c, <8 x i64> %d) {
600 ; RV32-LABEL: selectcc_v8i64:
602 ; RV32-NEXT: xor a1, a1, a3
603 ; RV32-NEXT: xor a0, a0, a2
604 ; RV32-NEXT: or a0, a0, a1
605 ; RV32-NEXT: snez a0, a0
606 ; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
607 ; RV32-NEXT: vmv.v.x v16, a0
608 ; RV32-NEXT: vmsne.vi v0, v16, 0
609 ; RV32-NEXT: vsetvli zero, zero, e64, m4, ta, ma
610 ; RV32-NEXT: vmerge.vvm v8, v12, v8, v0
613 ; RV64-LABEL: selectcc_v8i64:
615 ; RV64-NEXT: xor a0, a0, a1
616 ; RV64-NEXT: snez a0, a0
617 ; RV64-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
618 ; RV64-NEXT: vmv.v.x v16, a0
619 ; RV64-NEXT: vmsne.vi v0, v16, 0
620 ; RV64-NEXT: vsetvli zero, zero, e64, m4, ta, ma
621 ; RV64-NEXT: vmerge.vvm v8, v12, v8, v0
623 %cmp = icmp ne i64 %a, %b
624 %v = select i1 %cmp, <8 x i64> %c, <8 x i64> %d
628 define <16 x i64> @select_v16i64(i1 zeroext %c, <16 x i64> %a, <16 x i64> %b) {
629 ; CHECK-LABEL: select_v16i64:
631 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
632 ; CHECK-NEXT: vmv.v.x v24, a0
633 ; CHECK-NEXT: vmsne.vi v0, v24, 0
634 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, ma
635 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
637 %v = select i1 %c, <16 x i64> %a, <16 x i64> %b
641 define <16 x i64> @selectcc_v16i64(i64 signext %a, i64 signext %b, <16 x i64> %c, <16 x i64> %d) {
642 ; RV32-LABEL: selectcc_v16i64:
644 ; RV32-NEXT: xor a1, a1, a3
645 ; RV32-NEXT: xor a0, a0, a2
646 ; RV32-NEXT: or a0, a0, a1
647 ; RV32-NEXT: snez a0, a0
648 ; RV32-NEXT: vsetivli zero, 16, e8, m1, ta, ma
649 ; RV32-NEXT: vmv.v.x v24, a0
650 ; RV32-NEXT: vmsne.vi v0, v24, 0
651 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, ma
652 ; RV32-NEXT: vmerge.vvm v8, v16, v8, v0
655 ; RV64-LABEL: selectcc_v16i64:
657 ; RV64-NEXT: xor a0, a0, a1
658 ; RV64-NEXT: snez a0, a0
659 ; RV64-NEXT: vsetivli zero, 16, e8, m1, ta, ma
660 ; RV64-NEXT: vmv.v.x v24, a0
661 ; RV64-NEXT: vmsne.vi v0, v24, 0
662 ; RV64-NEXT: vsetvli zero, zero, e64, m8, ta, ma
663 ; RV64-NEXT: vmerge.vvm v8, v16, v8, v0
665 %cmp = icmp ne i64 %a, %b
666 %v = select i1 %cmp, <16 x i64> %c, <16 x i64> %d