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
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v,+m -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s
6 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfhmin,+v,+m -target-abi=ilp32d -riscv-v-vector-bits-min=128 \
7 ; RUN: -verify-machineinstrs < %s | FileCheck %s
8 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfhmin,+v,+m -target-abi=lp64d -riscv-v-vector-bits-min=128 \
9 ; RUN: -verify-machineinstrs < %s | FileCheck %s
11 declare <1 x i1> @llvm.vp.select.v1i1(<1 x i1>, <1 x i1>, <1 x i1>, i32)
13 define <1 x i1> @select_v1i1(<1 x i1> %a, <1 x i1> %b, <1 x i1> %c, i32 zeroext %evl) {
14 ; CHECK-LABEL: select_v1i1:
16 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
17 ; CHECK-NEXT: vmandn.mm v9, v9, v0
18 ; CHECK-NEXT: vmand.mm v8, v8, v0
19 ; CHECK-NEXT: vmor.mm v0, v8, v9
21 %v = call <1 x i1> @llvm.vp.select.v1i1(<1 x i1> %a, <1 x i1> %b, <1 x i1> %c, i32 %evl)
25 declare <2 x i1> @llvm.vp.select.v2i1(<2 x i1>, <2 x i1>, <2 x i1>, i32)
27 define <2 x i1> @select_v2i1(<2 x i1> %a, <2 x i1> %b, <2 x i1> %c, i32 zeroext %evl) {
28 ; CHECK-LABEL: select_v2i1:
30 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
31 ; CHECK-NEXT: vmandn.mm v9, v9, v0
32 ; CHECK-NEXT: vmand.mm v8, v8, v0
33 ; CHECK-NEXT: vmor.mm v0, v8, v9
35 %v = call <2 x i1> @llvm.vp.select.v2i1(<2 x i1> %a, <2 x i1> %b, <2 x i1> %c, i32 %evl)
39 declare <4 x i1> @llvm.vp.select.v4i1(<4 x i1>, <4 x i1>, <4 x i1>, i32)
41 define <4 x i1> @select_v4i1(<4 x i1> %a, <4 x i1> %b, <4 x i1> %c, i32 zeroext %evl) {
42 ; CHECK-LABEL: select_v4i1:
44 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
45 ; CHECK-NEXT: vmandn.mm v9, v9, v0
46 ; CHECK-NEXT: vmand.mm v8, v8, v0
47 ; CHECK-NEXT: vmor.mm v0, v8, v9
49 %v = call <4 x i1> @llvm.vp.select.v4i1(<4 x i1> %a, <4 x i1> %b, <4 x i1> %c, i32 %evl)
53 declare <8 x i1> @llvm.vp.select.v8i1(<8 x i1>, <8 x i1>, <8 x i1>, i32)
55 define <8 x i1> @select_v8i1(<8 x i1> %a, <8 x i1> %b, <8 x i1> %c, i32 zeroext %evl) {
56 ; CHECK-LABEL: select_v8i1:
58 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
59 ; CHECK-NEXT: vmandn.mm v9, v9, v0
60 ; CHECK-NEXT: vmand.mm v8, v8, v0
61 ; CHECK-NEXT: vmor.mm v0, v8, v9
63 %v = call <8 x i1> @llvm.vp.select.v8i1(<8 x i1> %a, <8 x i1> %b, <8 x i1> %c, i32 %evl)
67 declare <16 x i1> @llvm.vp.select.v16i1(<16 x i1>, <16 x i1>, <16 x i1>, i32)
69 define <16 x i1> @select_v16i1(<16 x i1> %a, <16 x i1> %b, <16 x i1> %c, i32 zeroext %evl) {
70 ; CHECK-LABEL: select_v16i1:
72 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
73 ; CHECK-NEXT: vmandn.mm v9, v9, v0
74 ; CHECK-NEXT: vmand.mm v8, v8, v0
75 ; CHECK-NEXT: vmor.mm v0, v8, v9
77 %v = call <16 x i1> @llvm.vp.select.v16i1(<16 x i1> %a, <16 x i1> %b, <16 x i1> %c, i32 %evl)
81 declare <8 x i7> @llvm.vp.select.v8i7(<8 x i1>, <8 x i7>, <8 x i7>, i32)
83 define <8 x i7> @select_v8i7(<8 x i1> %a, <8 x i7> %b, <8 x i7> %c, i32 zeroext %evl) {
84 ; CHECK-LABEL: select_v8i7:
86 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
87 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
89 %v = call <8 x i7> @llvm.vp.select.v8i7(<8 x i1> %a, <8 x i7> %b, <8 x i7> %c, i32 %evl)
93 declare <2 x i8> @llvm.vp.select.v2i8(<2 x i1>, <2 x i8>, <2 x i8>, i32)
95 define <2 x i8> @select_v2i8(<2 x i1> %a, <2 x i8> %b, <2 x i8> %c, i32 zeroext %evl) {
96 ; CHECK-LABEL: select_v2i8:
98 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
99 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
101 %v = call <2 x i8> @llvm.vp.select.v2i8(<2 x i1> %a, <2 x i8> %b, <2 x i8> %c, i32 %evl)
105 declare <4 x i8> @llvm.vp.select.v4i8(<4 x i1>, <4 x i8>, <4 x i8>, i32)
107 define <4 x i8> @select_v4i8(<4 x i1> %a, <4 x i8> %b, <4 x i8> %c, i32 zeroext %evl) {
108 ; CHECK-LABEL: select_v4i8:
110 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
111 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
113 %v = call <4 x i8> @llvm.vp.select.v4i8(<4 x i1> %a, <4 x i8> %b, <4 x i8> %c, i32 %evl)
117 declare <5 x i8> @llvm.vp.select.v5i8(<5 x i1>, <5 x i8>, <5 x i8>, i32)
119 define <5 x i8> @select_v5i8(<5 x i1> %a, <5 x i8> %b, <5 x i8> %c, i32 zeroext %evl) {
120 ; CHECK-LABEL: select_v5i8:
122 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
123 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
125 %v = call <5 x i8> @llvm.vp.select.v5i8(<5 x i1> %a, <5 x i8> %b, <5 x i8> %c, i32 %evl)
129 declare <8 x i8> @llvm.vp.select.v8i8(<8 x i1>, <8 x i8>, <8 x i8>, i32)
131 define <8 x i8> @select_v8i8(<8 x i1> %a, <8 x i8> %b, <8 x i8> %c, i32 zeroext %evl) {
132 ; CHECK-LABEL: select_v8i8:
134 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
135 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
137 %v = call <8 x i8> @llvm.vp.select.v8i8(<8 x i1> %a, <8 x i8> %b, <8 x i8> %c, i32 %evl)
141 declare <16 x i8> @llvm.vp.select.v16i8(<16 x i1>, <16 x i8>, <16 x i8>, i32)
143 define <16 x i8> @select_v16i8(<16 x i1> %a, <16 x i8> %b, <16 x i8> %c, i32 zeroext %evl) {
144 ; CHECK-LABEL: select_v16i8:
146 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
147 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
149 %v = call <16 x i8> @llvm.vp.select.v16i8(<16 x i1> %a, <16 x i8> %b, <16 x i8> %c, i32 %evl)
153 declare <256 x i8> @llvm.vp.select.v256i8(<256 x i1>, <256 x i8>, <256 x i8>, i32)
155 define <256 x i8> @select_v256i8(<256 x i1> %a, <256 x i8> %b, <256 x i8> %c, i32 zeroext %evl) {
156 ; CHECK-LABEL: select_v256i8:
158 ; CHECK-NEXT: addi sp, sp, -16
159 ; CHECK-NEXT: .cfi_def_cfa_offset 16
160 ; CHECK-NEXT: csrr a2, vlenb
161 ; CHECK-NEXT: slli a2, a2, 4
162 ; CHECK-NEXT: sub sp, sp, a2
163 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x10, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 16 * vlenb
164 ; CHECK-NEXT: csrr a2, vlenb
165 ; CHECK-NEXT: slli a2, a2, 3
166 ; CHECK-NEXT: add a2, sp, a2
167 ; CHECK-NEXT: addi a2, a2, 16
168 ; CHECK-NEXT: vs8r.v v16, (a2) # Unknown-size Folded Spill
169 ; CHECK-NEXT: vmv1r.v v9, v8
170 ; CHECK-NEXT: vmv1r.v v8, v0
171 ; CHECK-NEXT: li a2, 128
172 ; CHECK-NEXT: vsetvli zero, a2, e8, m8, ta, ma
173 ; CHECK-NEXT: vle8.v v24, (a0)
174 ; CHECK-NEXT: addi a0, a1, 128
175 ; CHECK-NEXT: vle8.v v16, (a0)
176 ; CHECK-NEXT: addi a0, a3, -128
177 ; CHECK-NEXT: sltu a4, a3, a0
178 ; CHECK-NEXT: vle8.v v0, (a1)
179 ; CHECK-NEXT: addi a1, sp, 16
180 ; CHECK-NEXT: vs8r.v v0, (a1) # Unknown-size Folded Spill
181 ; CHECK-NEXT: addi a4, a4, -1
182 ; CHECK-NEXT: and a0, a4, a0
183 ; CHECK-NEXT: vmv1r.v v0, v9
184 ; CHECK-NEXT: vsetvli zero, a0, e8, m8, ta, ma
185 ; CHECK-NEXT: vmerge.vvm v24, v16, v24, v0
186 ; CHECK-NEXT: bltu a3, a2, .LBB11_2
187 ; CHECK-NEXT: # %bb.1:
188 ; CHECK-NEXT: li a3, 128
189 ; CHECK-NEXT: .LBB11_2:
190 ; CHECK-NEXT: vmv1r.v v0, v8
191 ; CHECK-NEXT: csrr a0, vlenb
192 ; CHECK-NEXT: slli a0, a0, 3
193 ; CHECK-NEXT: add a0, sp, a0
194 ; CHECK-NEXT: addi a0, a0, 16
195 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
196 ; CHECK-NEXT: addi a0, sp, 16
197 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
198 ; CHECK-NEXT: vsetvli zero, a3, e8, m8, ta, ma
199 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
200 ; CHECK-NEXT: vmv8r.v v16, v24
201 ; CHECK-NEXT: csrr a0, vlenb
202 ; CHECK-NEXT: slli a0, a0, 4
203 ; CHECK-NEXT: add sp, sp, a0
204 ; CHECK-NEXT: addi sp, sp, 16
206 %v = call <256 x i8> @llvm.vp.select.v256i8(<256 x i1> %a, <256 x i8> %b, <256 x i8> %c, i32 %evl)
210 define <256 x i8> @select_evl_v256i8(<256 x i1> %a, <256 x i8> %b, <256 x i8> %c) {
211 ; CHECK-LABEL: select_evl_v256i8:
213 ; CHECK-NEXT: addi sp, sp, -16
214 ; CHECK-NEXT: .cfi_def_cfa_offset 16
215 ; CHECK-NEXT: csrr a2, vlenb
216 ; CHECK-NEXT: li a3, 24
217 ; CHECK-NEXT: mul a2, a2, a3
218 ; CHECK-NEXT: sub sp, sp, a2
219 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x18, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 24 * vlenb
220 ; CHECK-NEXT: li a2, 128
221 ; CHECK-NEXT: vsetvli zero, a2, e8, m8, ta, ma
222 ; CHECK-NEXT: vle8.v v24, (a0)
223 ; CHECK-NEXT: csrr a0, vlenb
224 ; CHECK-NEXT: slli a0, a0, 4
225 ; CHECK-NEXT: add a0, sp, a0
226 ; CHECK-NEXT: addi a0, a0, 16
227 ; CHECK-NEXT: vs8r.v v24, (a0) # Unknown-size Folded Spill
228 ; CHECK-NEXT: addi a0, a1, 128
229 ; CHECK-NEXT: vle8.v v24, (a0)
230 ; CHECK-NEXT: addi a0, sp, 16
231 ; CHECK-NEXT: vs8r.v v24, (a0) # Unknown-size Folded Spill
232 ; CHECK-NEXT: vle8.v v24, (a1)
233 ; CHECK-NEXT: csrr a0, vlenb
234 ; CHECK-NEXT: slli a0, a0, 3
235 ; CHECK-NEXT: add a0, sp, a0
236 ; CHECK-NEXT: addi a0, a0, 16
237 ; CHECK-NEXT: vs8r.v v24, (a0) # Unknown-size Folded Spill
238 ; CHECK-NEXT: vmv1r.v v7, v0
239 ; CHECK-NEXT: vmv1r.v v0, v8
240 ; CHECK-NEXT: csrr a0, vlenb
241 ; CHECK-NEXT: slli a0, a0, 4
242 ; CHECK-NEXT: add a0, sp, a0
243 ; CHECK-NEXT: addi a0, a0, 16
244 ; CHECK-NEXT: vl8r.v v24, (a0) # Unknown-size Folded Reload
245 ; CHECK-NEXT: addi a0, sp, 16
246 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
247 ; CHECK-NEXT: vsetivli zero, 1, e8, m8, ta, ma
248 ; CHECK-NEXT: vmerge.vvm v24, v8, v24, v0
249 ; CHECK-NEXT: vmv1r.v v0, v7
250 ; CHECK-NEXT: csrr a0, vlenb
251 ; CHECK-NEXT: slli a0, a0, 3
252 ; CHECK-NEXT: add a0, sp, a0
253 ; CHECK-NEXT: addi a0, a0, 16
254 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
255 ; CHECK-NEXT: vsetvli zero, a2, e8, m8, ta, ma
256 ; CHECK-NEXT: vmerge.vvm v8, v8, v16, v0
257 ; CHECK-NEXT: vmv8r.v v16, v24
258 ; CHECK-NEXT: csrr a0, vlenb
259 ; CHECK-NEXT: li a1, 24
260 ; CHECK-NEXT: mul a0, a0, a1
261 ; CHECK-NEXT: add sp, sp, a0
262 ; CHECK-NEXT: addi sp, sp, 16
264 %v = call <256 x i8> @llvm.vp.select.v256i8(<256 x i1> %a, <256 x i8> %b, <256 x i8> %c, i32 129)
268 declare <2 x i16> @llvm.vp.select.v2i16(<2 x i1>, <2 x i16>, <2 x i16>, i32)
270 define <2 x i16> @select_v2i16(<2 x i1> %a, <2 x i16> %b, <2 x i16> %c, i32 zeroext %evl) {
271 ; CHECK-LABEL: select_v2i16:
273 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
274 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
276 %v = call <2 x i16> @llvm.vp.select.v2i16(<2 x i1> %a, <2 x i16> %b, <2 x i16> %c, i32 %evl)
280 declare <4 x i16> @llvm.vp.select.v4i16(<4 x i1>, <4 x i16>, <4 x i16>, i32)
282 define <4 x i16> @select_v4i16(<4 x i1> %a, <4 x i16> %b, <4 x i16> %c, i32 zeroext %evl) {
283 ; CHECK-LABEL: select_v4i16:
285 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
286 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
288 %v = call <4 x i16> @llvm.vp.select.v4i16(<4 x i1> %a, <4 x i16> %b, <4 x i16> %c, i32 %evl)
292 declare <8 x i16> @llvm.vp.select.v8i16(<8 x i1>, <8 x i16>, <8 x i16>, i32)
294 define <8 x i16> @select_v8i16(<8 x i1> %a, <8 x i16> %b, <8 x i16> %c, i32 zeroext %evl) {
295 ; CHECK-LABEL: select_v8i16:
297 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
298 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
300 %v = call <8 x i16> @llvm.vp.select.v8i16(<8 x i1> %a, <8 x i16> %b, <8 x i16> %c, i32 %evl)
304 declare <16 x i16> @llvm.vp.select.v16i16(<16 x i1>, <16 x i16>, <16 x i16>, i32)
306 define <16 x i16> @select_v16i16(<16 x i1> %a, <16 x i16> %b, <16 x i16> %c, i32 zeroext %evl) {
307 ; CHECK-LABEL: select_v16i16:
309 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
310 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
312 %v = call <16 x i16> @llvm.vp.select.v16i16(<16 x i1> %a, <16 x i16> %b, <16 x i16> %c, i32 %evl)
316 declare <2 x i32> @llvm.vp.select.v2i32(<2 x i1>, <2 x i32>, <2 x i32>, i32)
318 define <2 x i32> @select_v2i32(<2 x i1> %a, <2 x i32> %b, <2 x i32> %c, i32 zeroext %evl) {
319 ; CHECK-LABEL: select_v2i32:
321 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
322 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
324 %v = call <2 x i32> @llvm.vp.select.v2i32(<2 x i1> %a, <2 x i32> %b, <2 x i32> %c, i32 %evl)
328 declare <4 x i32> @llvm.vp.select.v4i32(<4 x i1>, <4 x i32>, <4 x i32>, i32)
330 define <4 x i32> @select_v4i32(<4 x i1> %a, <4 x i32> %b, <4 x i32> %c, i32 zeroext %evl) {
331 ; CHECK-LABEL: select_v4i32:
333 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
334 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
336 %v = call <4 x i32> @llvm.vp.select.v4i32(<4 x i1> %a, <4 x i32> %b, <4 x i32> %c, i32 %evl)
340 declare <8 x i32> @llvm.vp.select.v8i32(<8 x i1>, <8 x i32>, <8 x i32>, i32)
342 define <8 x i32> @select_v8i32(<8 x i1> %a, <8 x i32> %b, <8 x i32> %c, i32 zeroext %evl) {
343 ; CHECK-LABEL: select_v8i32:
345 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
346 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
348 %v = call <8 x i32> @llvm.vp.select.v8i32(<8 x i1> %a, <8 x i32> %b, <8 x i32> %c, i32 %evl)
352 declare <16 x i32> @llvm.vp.select.v16i32(<16 x i1>, <16 x i32>, <16 x i32>, i32)
354 define <16 x i32> @select_v16i32(<16 x i1> %a, <16 x i32> %b, <16 x i32> %c, i32 zeroext %evl) {
355 ; CHECK-LABEL: select_v16i32:
357 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
358 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
360 %v = call <16 x i32> @llvm.vp.select.v16i32(<16 x i1> %a, <16 x i32> %b, <16 x i32> %c, i32 %evl)
364 declare <2 x i64> @llvm.vp.select.v2i64(<2 x i1>, <2 x i64>, <2 x i64>, i32)
366 define <2 x i64> @select_v2i64(<2 x i1> %a, <2 x i64> %b, <2 x i64> %c, i32 zeroext %evl) {
367 ; CHECK-LABEL: select_v2i64:
369 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
370 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
372 %v = call <2 x i64> @llvm.vp.select.v2i64(<2 x i1> %a, <2 x i64> %b, <2 x i64> %c, i32 %evl)
376 declare <4 x i64> @llvm.vp.select.v4i64(<4 x i1>, <4 x i64>, <4 x i64>, i32)
378 define <4 x i64> @select_v4i64(<4 x i1> %a, <4 x i64> %b, <4 x i64> %c, i32 zeroext %evl) {
379 ; CHECK-LABEL: select_v4i64:
381 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
382 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
384 %v = call <4 x i64> @llvm.vp.select.v4i64(<4 x i1> %a, <4 x i64> %b, <4 x i64> %c, i32 %evl)
388 declare <8 x i64> @llvm.vp.select.v8i64(<8 x i1>, <8 x i64>, <8 x i64>, i32)
390 define <8 x i64> @select_v8i64(<8 x i1> %a, <8 x i64> %b, <8 x i64> %c, i32 zeroext %evl) {
391 ; CHECK-LABEL: select_v8i64:
393 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
394 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
396 %v = call <8 x i64> @llvm.vp.select.v8i64(<8 x i1> %a, <8 x i64> %b, <8 x i64> %c, i32 %evl)
400 declare <16 x i64> @llvm.vp.select.v16i64(<16 x i1>, <16 x i64>, <16 x i64>, i32)
402 define <16 x i64> @select_v16i64(<16 x i1> %a, <16 x i64> %b, <16 x i64> %c, i32 zeroext %evl) {
403 ; CHECK-LABEL: select_v16i64:
405 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
406 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
408 %v = call <16 x i64> @llvm.vp.select.v16i64(<16 x i1> %a, <16 x i64> %b, <16 x i64> %c, i32 %evl)
412 declare <32 x i64> @llvm.vp.select.v32i64(<32 x i1>, <32 x i64>, <32 x i64>, i32)
414 define <32 x i64> @select_v32i64(<32 x i1> %a, <32 x i64> %b, <32 x i64> %c, i32 zeroext %evl) {
415 ; CHECK-LABEL: select_v32i64:
417 ; CHECK-NEXT: addi sp, sp, -16
418 ; CHECK-NEXT: .cfi_def_cfa_offset 16
419 ; CHECK-NEXT: csrr a1, vlenb
420 ; CHECK-NEXT: slli a1, a1, 3
421 ; CHECK-NEXT: sub sp, sp, a1
422 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 8 * vlenb
423 ; CHECK-NEXT: addi a1, a0, 128
424 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
425 ; CHECK-NEXT: vle64.v v24, (a1)
426 ; CHECK-NEXT: addi a1, sp, 16
427 ; CHECK-NEXT: vs8r.v v24, (a1) # Unknown-size Folded Spill
428 ; CHECK-NEXT: vle64.v v24, (a0)
429 ; CHECK-NEXT: li a1, 16
430 ; CHECK-NEXT: mv a0, a2
431 ; CHECK-NEXT: bltu a2, a1, .LBB25_2
432 ; CHECK-NEXT: # %bb.1:
433 ; CHECK-NEXT: li a0, 16
434 ; CHECK-NEXT: .LBB25_2:
435 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
436 ; CHECK-NEXT: vmerge.vvm v8, v24, v8, v0
437 ; CHECK-NEXT: addi a0, a2, -16
438 ; CHECK-NEXT: sltu a1, a2, a0
439 ; CHECK-NEXT: addi a1, a1, -1
440 ; CHECK-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
441 ; CHECK-NEXT: vslidedown.vi v0, v0, 2
442 ; CHECK-NEXT: and a0, a1, a0
443 ; CHECK-NEXT: addi a1, sp, 16
444 ; CHECK-NEXT: vl8r.v v24, (a1) # Unknown-size Folded Reload
445 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
446 ; CHECK-NEXT: vmerge.vvm v16, v24, v16, v0
447 ; CHECK-NEXT: csrr a0, vlenb
448 ; CHECK-NEXT: slli a0, a0, 3
449 ; CHECK-NEXT: add sp, sp, a0
450 ; CHECK-NEXT: addi sp, sp, 16
452 %v = call <32 x i64> @llvm.vp.select.v32i64(<32 x i1> %a, <32 x i64> %b, <32 x i64> %c, i32 %evl)
456 define <32 x i64> @select_evl_v32i64(<32 x i1> %a, <32 x i64> %b, <32 x i64> %c) {
457 ; CHECK-LABEL: select_evl_v32i64:
459 ; CHECK-NEXT: addi sp, sp, -16
460 ; CHECK-NEXT: .cfi_def_cfa_offset 16
461 ; CHECK-NEXT: csrr a1, vlenb
462 ; CHECK-NEXT: slli a1, a1, 4
463 ; CHECK-NEXT: sub sp, sp, a1
464 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x10, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 16 * vlenb
465 ; CHECK-NEXT: addi a1, a0, 128
466 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
467 ; CHECK-NEXT: vle64.v v24, (a0)
468 ; CHECK-NEXT: addi a0, sp, 16
469 ; CHECK-NEXT: vs8r.v v24, (a0) # Unknown-size Folded Spill
470 ; CHECK-NEXT: vle64.v v24, (a1)
471 ; CHECK-NEXT: csrr a0, vlenb
472 ; CHECK-NEXT: slli a0, a0, 3
473 ; CHECK-NEXT: add a0, sp, a0
474 ; CHECK-NEXT: addi a0, a0, 16
475 ; CHECK-NEXT: vs8r.v v24, (a0) # Unknown-size Folded Spill
476 ; CHECK-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
477 ; CHECK-NEXT: vslidedown.vi v7, v0, 2
478 ; CHECK-NEXT: addi a0, sp, 16
479 ; CHECK-NEXT: vl8r.v v24, (a0) # Unknown-size Folded Reload
480 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
481 ; CHECK-NEXT: vmerge.vvm v8, v24, v8, v0
482 ; CHECK-NEXT: vmv1r.v v0, v7
483 ; CHECK-NEXT: csrr a0, vlenb
484 ; CHECK-NEXT: slli a0, a0, 3
485 ; CHECK-NEXT: add a0, sp, a0
486 ; CHECK-NEXT: addi a0, a0, 16
487 ; CHECK-NEXT: vl8r.v v24, (a0) # Unknown-size Folded Reload
488 ; CHECK-NEXT: vsetivli zero, 1, e64, m8, ta, ma
489 ; CHECK-NEXT: vmerge.vvm v16, v24, v16, v0
490 ; CHECK-NEXT: csrr a0, vlenb
491 ; CHECK-NEXT: slli a0, a0, 4
492 ; CHECK-NEXT: add sp, sp, a0
493 ; CHECK-NEXT: addi sp, sp, 16
495 %v = call <32 x i64> @llvm.vp.select.v32i64(<32 x i1> %a, <32 x i64> %b, <32 x i64> %c, i32 17)
499 declare <2 x half> @llvm.vp.select.v2f16(<2 x i1>, <2 x half>, <2 x half>, i32)
501 define <2 x half> @select_v2f16(<2 x i1> %a, <2 x half> %b, <2 x half> %c, i32 zeroext %evl) {
502 ; CHECK-LABEL: select_v2f16:
504 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
505 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
507 %v = call <2 x half> @llvm.vp.select.v2f16(<2 x i1> %a, <2 x half> %b, <2 x half> %c, i32 %evl)
511 declare <4 x half> @llvm.vp.select.v4f16(<4 x i1>, <4 x half>, <4 x half>, i32)
513 define <4 x half> @select_v4f16(<4 x i1> %a, <4 x half> %b, <4 x half> %c, i32 zeroext %evl) {
514 ; CHECK-LABEL: select_v4f16:
516 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
517 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
519 %v = call <4 x half> @llvm.vp.select.v4f16(<4 x i1> %a, <4 x half> %b, <4 x half> %c, i32 %evl)
523 declare <8 x half> @llvm.vp.select.v8f16(<8 x i1>, <8 x half>, <8 x half>, i32)
525 define <8 x half> @select_v8f16(<8 x i1> %a, <8 x half> %b, <8 x half> %c, i32 zeroext %evl) {
526 ; CHECK-LABEL: select_v8f16:
528 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
529 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
531 %v = call <8 x half> @llvm.vp.select.v8f16(<8 x i1> %a, <8 x half> %b, <8 x half> %c, i32 %evl)
535 declare <16 x half> @llvm.vp.select.v16f16(<16 x i1>, <16 x half>, <16 x half>, i32)
537 define <16 x half> @select_v16f16(<16 x i1> %a, <16 x half> %b, <16 x half> %c, i32 zeroext %evl) {
538 ; CHECK-LABEL: select_v16f16:
540 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
541 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
543 %v = call <16 x half> @llvm.vp.select.v16f16(<16 x i1> %a, <16 x half> %b, <16 x half> %c, i32 %evl)
547 declare <2 x float> @llvm.vp.select.v2f32(<2 x i1>, <2 x float>, <2 x float>, i32)
549 define <2 x float> @select_v2f32(<2 x i1> %a, <2 x float> %b, <2 x float> %c, i32 zeroext %evl) {
550 ; CHECK-LABEL: select_v2f32:
552 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
553 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
555 %v = call <2 x float> @llvm.vp.select.v2f32(<2 x i1> %a, <2 x float> %b, <2 x float> %c, i32 %evl)
559 declare <4 x float> @llvm.vp.select.v4f32(<4 x i1>, <4 x float>, <4 x float>, i32)
561 define <4 x float> @select_v4f32(<4 x i1> %a, <4 x float> %b, <4 x float> %c, i32 zeroext %evl) {
562 ; CHECK-LABEL: select_v4f32:
564 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
565 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
567 %v = call <4 x float> @llvm.vp.select.v4f32(<4 x i1> %a, <4 x float> %b, <4 x float> %c, i32 %evl)
571 declare <8 x float> @llvm.vp.select.v8f32(<8 x i1>, <8 x float>, <8 x float>, i32)
573 define <8 x float> @select_v8f32(<8 x i1> %a, <8 x float> %b, <8 x float> %c, i32 zeroext %evl) {
574 ; CHECK-LABEL: select_v8f32:
576 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
577 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
579 %v = call <8 x float> @llvm.vp.select.v8f32(<8 x i1> %a, <8 x float> %b, <8 x float> %c, i32 %evl)
583 declare <16 x float> @llvm.vp.select.v16f32(<16 x i1>, <16 x float>, <16 x float>, i32)
585 define <16 x float> @select_v16f32(<16 x i1> %a, <16 x float> %b, <16 x float> %c, i32 zeroext %evl) {
586 ; CHECK-LABEL: select_v16f32:
588 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
589 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
591 %v = call <16 x float> @llvm.vp.select.v16f32(<16 x i1> %a, <16 x float> %b, <16 x float> %c, i32 %evl)
595 declare <64 x float> @llvm.vp.select.v64f32(<64 x i1>, <64 x float>, <64 x float>, i32)
597 define <64 x float> @select_v64f32(<64 x i1> %a, <64 x float> %b, <64 x float> %c, i32 zeroext %evl) {
598 ; CHECK-LABEL: select_v64f32:
600 ; CHECK-NEXT: addi sp, sp, -16
601 ; CHECK-NEXT: .cfi_def_cfa_offset 16
602 ; CHECK-NEXT: csrr a1, vlenb
603 ; CHECK-NEXT: slli a1, a1, 3
604 ; CHECK-NEXT: sub sp, sp, a1
605 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 8 * vlenb
606 ; CHECK-NEXT: addi a1, a0, 128
607 ; CHECK-NEXT: li a3, 32
608 ; CHECK-NEXT: vsetvli zero, a3, e32, m8, ta, ma
609 ; CHECK-NEXT: vle32.v v24, (a1)
610 ; CHECK-NEXT: addi a1, sp, 16
611 ; CHECK-NEXT: vs8r.v v24, (a1) # Unknown-size Folded Spill
612 ; CHECK-NEXT: vle32.v v24, (a0)
613 ; CHECK-NEXT: mv a0, a2
614 ; CHECK-NEXT: bltu a2, a3, .LBB35_2
615 ; CHECK-NEXT: # %bb.1:
616 ; CHECK-NEXT: li a0, 32
617 ; CHECK-NEXT: .LBB35_2:
618 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
619 ; CHECK-NEXT: vmerge.vvm v8, v24, v8, v0
620 ; CHECK-NEXT: addi a0, a2, -32
621 ; CHECK-NEXT: sltu a1, a2, a0
622 ; CHECK-NEXT: addi a1, a1, -1
623 ; CHECK-NEXT: vsetivli zero, 4, e8, mf2, ta, ma
624 ; CHECK-NEXT: vslidedown.vi v0, v0, 4
625 ; CHECK-NEXT: and a0, a1, a0
626 ; CHECK-NEXT: addi a1, sp, 16
627 ; CHECK-NEXT: vl8r.v v24, (a1) # Unknown-size Folded Reload
628 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
629 ; CHECK-NEXT: vmerge.vvm v16, v24, v16, v0
630 ; CHECK-NEXT: csrr a0, vlenb
631 ; CHECK-NEXT: slli a0, a0, 3
632 ; CHECK-NEXT: add sp, sp, a0
633 ; CHECK-NEXT: addi sp, sp, 16
635 %v = call <64 x float> @llvm.vp.select.v64f32(<64 x i1> %a, <64 x float> %b, <64 x float> %c, i32 %evl)
639 declare <2 x double> @llvm.vp.select.v2f64(<2 x i1>, <2 x double>, <2 x double>, i32)
641 define <2 x double> @select_v2f64(<2 x i1> %a, <2 x double> %b, <2 x double> %c, i32 zeroext %evl) {
642 ; CHECK-LABEL: select_v2f64:
644 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
645 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
647 %v = call <2 x double> @llvm.vp.select.v2f64(<2 x i1> %a, <2 x double> %b, <2 x double> %c, i32 %evl)
651 declare <4 x double> @llvm.vp.select.v4f64(<4 x i1>, <4 x double>, <4 x double>, i32)
653 define <4 x double> @select_v4f64(<4 x i1> %a, <4 x double> %b, <4 x double> %c, i32 zeroext %evl) {
654 ; CHECK-LABEL: select_v4f64:
656 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
657 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
659 %v = call <4 x double> @llvm.vp.select.v4f64(<4 x i1> %a, <4 x double> %b, <4 x double> %c, i32 %evl)
663 declare <8 x double> @llvm.vp.select.v8f64(<8 x i1>, <8 x double>, <8 x double>, i32)
665 define <8 x double> @select_v8f64(<8 x i1> %a, <8 x double> %b, <8 x double> %c, i32 zeroext %evl) {
666 ; CHECK-LABEL: select_v8f64:
668 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
669 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
671 %v = call <8 x double> @llvm.vp.select.v8f64(<8 x i1> %a, <8 x double> %b, <8 x double> %c, i32 %evl)
675 declare <16 x double> @llvm.vp.select.v16f64(<16 x i1>, <16 x double>, <16 x double>, i32)
677 define <16 x double> @select_v16f64(<16 x i1> %a, <16 x double> %b, <16 x double> %c, i32 zeroext %evl) {
678 ; CHECK-LABEL: select_v16f64:
680 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
681 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
683 %v = call <16 x double> @llvm.vp.select.v16f64(<16 x i1> %a, <16 x double> %b, <16 x double> %c, i32 %evl)