1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+m,+zfh,+zvfh,+v -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+m,+zfh,+zvfh,+v -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s
6 ; RUN: llc -mtriple=riscv32 -mattr=+d,+m,+zfh,+zvfhmin,+v -target-abi=ilp32d \
7 ; RUN: -verify-machineinstrs < %s | FileCheck %s
8 ; RUN: llc -mtriple=riscv64 -mattr=+d,+m,+zfh,+zvfhmin,+v -target-abi=lp64d \
9 ; RUN: -verify-machineinstrs < %s | FileCheck %s
11 declare <vscale x 1 x i1> @llvm.vp.select.nxv1i1(<vscale x 1 x i1>, <vscale x 1 x i1>, <vscale x 1 x i1>, i32)
13 define <vscale x 1 x i1> @select_nxv1i1(<vscale x 1 x i1> %a, <vscale x 1 x i1> %b, <vscale x 1 x i1> %c, i32 zeroext %evl) {
14 ; CHECK-LABEL: select_nxv1i1:
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 <vscale x 1 x i1> @llvm.vp.select.nxv1i1(<vscale x 1 x i1> %a, <vscale x 1 x i1> %b, <vscale x 1 x i1> %c, i32 %evl)
22 ret <vscale x 1 x i1> %v
25 declare <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1>, <vscale x 2 x i1>, <vscale x 2 x i1>, i32)
27 define <vscale x 2 x i1> @select_nxv2i1(<vscale x 2 x i1> %a, <vscale x 2 x i1> %b, <vscale x 2 x i1> %c, i32 zeroext %evl) {
28 ; CHECK-LABEL: select_nxv2i1:
30 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, 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 <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> %a, <vscale x 2 x i1> %b, <vscale x 2 x i1> %c, i32 %evl)
36 ret <vscale x 2 x i1> %v
39 declare <vscale x 4 x i1> @llvm.vp.select.nxv4i1(<vscale x 4 x i1>, <vscale x 4 x i1>, <vscale x 4 x i1>, i32)
41 define <vscale x 4 x i1> @select_nxv4i1(<vscale x 4 x i1> %a, <vscale x 4 x i1> %b, <vscale x 4 x i1> %c, i32 zeroext %evl) {
42 ; CHECK-LABEL: select_nxv4i1:
44 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, 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 <vscale x 4 x i1> @llvm.vp.select.nxv4i1(<vscale x 4 x i1> %a, <vscale x 4 x i1> %b, <vscale x 4 x i1> %c, i32 %evl)
50 ret <vscale x 4 x i1> %v
53 declare <vscale x 8 x i1> @llvm.vp.select.nxv8i1(<vscale x 8 x i1>, <vscale x 8 x i1>, <vscale x 8 x i1>, i32)
55 define <vscale x 8 x i1> @select_nxv8i1(<vscale x 8 x i1> %a, <vscale x 8 x i1> %b, <vscale x 8 x i1> %c, i32 zeroext %evl) {
56 ; CHECK-LABEL: select_nxv8i1:
58 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, 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 <vscale x 8 x i1> @llvm.vp.select.nxv8i1(<vscale x 8 x i1> %a, <vscale x 8 x i1> %b, <vscale x 8 x i1> %c, i32 %evl)
64 ret <vscale x 8 x i1> %v
67 declare <vscale x 16 x i1> @llvm.vp.select.nxv16i1(<vscale x 16 x i1>, <vscale x 16 x i1>, <vscale x 16 x i1>, i32)
69 define <vscale x 16 x i1> @select_nxv16i1(<vscale x 16 x i1> %a, <vscale x 16 x i1> %b, <vscale x 16 x i1> %c, i32 zeroext %evl) {
70 ; CHECK-LABEL: select_nxv16i1:
72 ; CHECK-NEXT: vsetvli zero, a0, e8, m2, 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 <vscale x 16 x i1> @llvm.vp.select.nxv16i1(<vscale x 16 x i1> %a, <vscale x 16 x i1> %b, <vscale x 16 x i1> %c, i32 %evl)
78 ret <vscale x 16 x i1> %v
81 declare <vscale x 32 x i1> @llvm.vp.select.nxv32i1(<vscale x 32 x i1>, <vscale x 32 x i1>, <vscale x 32 x i1>, i32)
83 define <vscale x 32 x i1> @select_nxv32i1(<vscale x 32 x i1> %a, <vscale x 32 x i1> %b, <vscale x 32 x i1> %c, i32 zeroext %evl) {
84 ; CHECK-LABEL: select_nxv32i1:
86 ; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, ma
87 ; CHECK-NEXT: vmandn.mm v9, v9, v0
88 ; CHECK-NEXT: vmand.mm v8, v8, v0
89 ; CHECK-NEXT: vmor.mm v0, v8, v9
91 %v = call <vscale x 32 x i1> @llvm.vp.select.nxv32i1(<vscale x 32 x i1> %a, <vscale x 32 x i1> %b, <vscale x 32 x i1> %c, i32 %evl)
92 ret <vscale x 32 x i1> %v
95 declare <vscale x 64 x i1> @llvm.vp.select.nxv64i1(<vscale x 64 x i1>, <vscale x 64 x i1>, <vscale x 64 x i1>, i32)
97 define <vscale x 64 x i1> @select_nxv64i1(<vscale x 64 x i1> %a, <vscale x 64 x i1> %b, <vscale x 64 x i1> %c, i32 zeroext %evl) {
98 ; CHECK-LABEL: select_nxv64i1:
100 ; CHECK-NEXT: vsetvli zero, a0, e8, m8, ta, ma
101 ; CHECK-NEXT: vmandn.mm v9, v9, v0
102 ; CHECK-NEXT: vmand.mm v8, v8, v0
103 ; CHECK-NEXT: vmor.mm v0, v8, v9
105 %v = call <vscale x 64 x i1> @llvm.vp.select.nxv64i1(<vscale x 64 x i1> %a, <vscale x 64 x i1> %b, <vscale x 64 x i1> %c, i32 %evl)
106 ret <vscale x 64 x i1> %v
109 declare <vscale x 8 x i7> @llvm.vp.select.nxv8i7(<vscale x 8 x i1>, <vscale x 8 x i7>, <vscale x 8 x i7>, i32)
111 define <vscale x 8 x i7> @select_nxv8i7(<vscale x 8 x i1> %a, <vscale x 8 x i7> %b, <vscale x 8 x i7> %c, i32 zeroext %evl) {
112 ; CHECK-LABEL: select_nxv8i7:
114 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
115 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
117 %v = call <vscale x 8 x i7> @llvm.vp.select.nxv8i7(<vscale x 8 x i1> %a, <vscale x 8 x i7> %b, <vscale x 8 x i7> %c, i32 %evl)
118 ret <vscale x 8 x i7> %v
121 declare <vscale x 1 x i8> @llvm.vp.select.nxv1i8(<vscale x 1 x i1>, <vscale x 1 x i8>, <vscale x 1 x i8>, i32)
123 define <vscale x 1 x i8> @select_nxv1i8(<vscale x 1 x i1> %a, <vscale x 1 x i8> %b, <vscale x 1 x i8> %c, i32 zeroext %evl) {
124 ; CHECK-LABEL: select_nxv1i8:
126 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
127 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
129 %v = call <vscale x 1 x i8> @llvm.vp.select.nxv1i8(<vscale x 1 x i1> %a, <vscale x 1 x i8> %b, <vscale x 1 x i8> %c, i32 %evl)
130 ret <vscale x 1 x i8> %v
133 declare <vscale x 2 x i8> @llvm.vp.select.nxv2i8(<vscale x 2 x i1>, <vscale x 2 x i8>, <vscale x 2 x i8>, i32)
135 define <vscale x 2 x i8> @select_nxv2i8(<vscale x 2 x i1> %a, <vscale x 2 x i8> %b, <vscale x 2 x i8> %c, i32 zeroext %evl) {
136 ; CHECK-LABEL: select_nxv2i8:
138 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
139 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
141 %v = call <vscale x 2 x i8> @llvm.vp.select.nxv2i8(<vscale x 2 x i1> %a, <vscale x 2 x i8> %b, <vscale x 2 x i8> %c, i32 %evl)
142 ret <vscale x 2 x i8> %v
145 declare <vscale x 4 x i8> @llvm.vp.select.nxv4i8(<vscale x 4 x i1>, <vscale x 4 x i8>, <vscale x 4 x i8>, i32)
147 define <vscale x 4 x i8> @select_nxv4i8(<vscale x 4 x i1> %a, <vscale x 4 x i8> %b, <vscale x 4 x i8> %c, i32 zeroext %evl) {
148 ; CHECK-LABEL: select_nxv4i8:
150 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
151 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
153 %v = call <vscale x 4 x i8> @llvm.vp.select.nxv4i8(<vscale x 4 x i1> %a, <vscale x 4 x i8> %b, <vscale x 4 x i8> %c, i32 %evl)
154 ret <vscale x 4 x i8> %v
157 declare <vscale x 8 x i8> @llvm.vp.select.nxv8i8(<vscale x 8 x i1>, <vscale x 8 x i8>, <vscale x 8 x i8>, i32)
159 define <vscale x 8 x i8> @select_nxv8i8(<vscale x 8 x i1> %a, <vscale x 8 x i8> %b, <vscale x 8 x i8> %c, i32 zeroext %evl) {
160 ; CHECK-LABEL: select_nxv8i8:
162 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
163 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
165 %v = call <vscale x 8 x i8> @llvm.vp.select.nxv8i8(<vscale x 8 x i1> %a, <vscale x 8 x i8> %b, <vscale x 8 x i8> %c, i32 %evl)
166 ret <vscale x 8 x i8> %v
169 declare <vscale x 14 x i8> @llvm.vp.select.nxv14i8(<vscale x 14 x i1>, <vscale x 14 x i8>, <vscale x 14 x i8>, i32)
171 define <vscale x 14 x i8> @select_nxv14i8(<vscale x 14 x i1> %a, <vscale x 14 x i8> %b, <vscale x 14 x i8> %c, i32 zeroext %evl) {
172 ; CHECK-LABEL: select_nxv14i8:
174 ; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, ma
175 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
177 %v = call <vscale x 14 x i8> @llvm.vp.select.nxv14i8(<vscale x 14 x i1> %a, <vscale x 14 x i8> %b, <vscale x 14 x i8> %c, i32 %evl)
178 ret <vscale x 14 x i8> %v
181 declare <vscale x 16 x i8> @llvm.vp.select.nxv16i8(<vscale x 16 x i1>, <vscale x 16 x i8>, <vscale x 16 x i8>, i32)
183 define <vscale x 16 x i8> @select_nxv16i8(<vscale x 16 x i1> %a, <vscale x 16 x i8> %b, <vscale x 16 x i8> %c, i32 zeroext %evl) {
184 ; CHECK-LABEL: select_nxv16i8:
186 ; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, ma
187 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
189 %v = call <vscale x 16 x i8> @llvm.vp.select.nxv16i8(<vscale x 16 x i1> %a, <vscale x 16 x i8> %b, <vscale x 16 x i8> %c, i32 %evl)
190 ret <vscale x 16 x i8> %v
193 declare <vscale x 32 x i8> @llvm.vp.select.nxv32i8(<vscale x 32 x i1>, <vscale x 32 x i8>, <vscale x 32 x i8>, i32)
195 define <vscale x 32 x i8> @select_nxv32i8(<vscale x 32 x i1> %a, <vscale x 32 x i8> %b, <vscale x 32 x i8> %c, i32 zeroext %evl) {
196 ; CHECK-LABEL: select_nxv32i8:
198 ; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, ma
199 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
201 %v = call <vscale x 32 x i8> @llvm.vp.select.nxv32i8(<vscale x 32 x i1> %a, <vscale x 32 x i8> %b, <vscale x 32 x i8> %c, i32 %evl)
202 ret <vscale x 32 x i8> %v
205 declare <vscale x 64 x i8> @llvm.vp.select.nxv64i8(<vscale x 64 x i1>, <vscale x 64 x i8>, <vscale x 64 x i8>, i32)
207 define <vscale x 64 x i8> @select_nxv64i8(<vscale x 64 x i1> %a, <vscale x 64 x i8> %b, <vscale x 64 x i8> %c, i32 zeroext %evl) {
208 ; CHECK-LABEL: select_nxv64i8:
210 ; CHECK-NEXT: vsetvli zero, a0, e8, m8, ta, ma
211 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
213 %v = call <vscale x 64 x i8> @llvm.vp.select.nxv64i8(<vscale x 64 x i1> %a, <vscale x 64 x i8> %b, <vscale x 64 x i8> %c, i32 %evl)
214 ret <vscale x 64 x i8> %v
217 declare <vscale x 1 x i16> @llvm.vp.select.nxv1i16(<vscale x 1 x i1>, <vscale x 1 x i16>, <vscale x 1 x i16>, i32)
219 define <vscale x 1 x i16> @select_nxv1i16(<vscale x 1 x i1> %a, <vscale x 1 x i16> %b, <vscale x 1 x i16> %c, i32 zeroext %evl) {
220 ; CHECK-LABEL: select_nxv1i16:
222 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
223 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
225 %v = call <vscale x 1 x i16> @llvm.vp.select.nxv1i16(<vscale x 1 x i1> %a, <vscale x 1 x i16> %b, <vscale x 1 x i16> %c, i32 %evl)
226 ret <vscale x 1 x i16> %v
229 declare <vscale x 2 x i16> @llvm.vp.select.nxv2i16(<vscale x 2 x i1>, <vscale x 2 x i16>, <vscale x 2 x i16>, i32)
231 define <vscale x 2 x i16> @select_nxv2i16(<vscale x 2 x i1> %a, <vscale x 2 x i16> %b, <vscale x 2 x i16> %c, i32 zeroext %evl) {
232 ; CHECK-LABEL: select_nxv2i16:
234 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
235 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
237 %v = call <vscale x 2 x i16> @llvm.vp.select.nxv2i16(<vscale x 2 x i1> %a, <vscale x 2 x i16> %b, <vscale x 2 x i16> %c, i32 %evl)
238 ret <vscale x 2 x i16> %v
241 declare <vscale x 4 x i16> @llvm.vp.select.nxv4i16(<vscale x 4 x i1>, <vscale x 4 x i16>, <vscale x 4 x i16>, i32)
243 define <vscale x 4 x i16> @select_nxv4i16(<vscale x 4 x i1> %a, <vscale x 4 x i16> %b, <vscale x 4 x i16> %c, i32 zeroext %evl) {
244 ; CHECK-LABEL: select_nxv4i16:
246 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
247 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
249 %v = call <vscale x 4 x i16> @llvm.vp.select.nxv4i16(<vscale x 4 x i1> %a, <vscale x 4 x i16> %b, <vscale x 4 x i16> %c, i32 %evl)
250 ret <vscale x 4 x i16> %v
253 declare <vscale x 8 x i16> @llvm.vp.select.nxv8i16(<vscale x 8 x i1>, <vscale x 8 x i16>, <vscale x 8 x i16>, i32)
255 define <vscale x 8 x i16> @select_nxv8i16(<vscale x 8 x i1> %a, <vscale x 8 x i16> %b, <vscale x 8 x i16> %c, i32 zeroext %evl) {
256 ; CHECK-LABEL: select_nxv8i16:
258 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
259 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
261 %v = call <vscale x 8 x i16> @llvm.vp.select.nxv8i16(<vscale x 8 x i1> %a, <vscale x 8 x i16> %b, <vscale x 8 x i16> %c, i32 %evl)
262 ret <vscale x 8 x i16> %v
265 declare <vscale x 16 x i16> @llvm.vp.select.nxv16i16(<vscale x 16 x i1>, <vscale x 16 x i16>, <vscale x 16 x i16>, i32)
267 define <vscale x 16 x i16> @select_nxv16i16(<vscale x 16 x i1> %a, <vscale x 16 x i16> %b, <vscale x 16 x i16> %c, i32 zeroext %evl) {
268 ; CHECK-LABEL: select_nxv16i16:
270 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
271 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
273 %v = call <vscale x 16 x i16> @llvm.vp.select.nxv16i16(<vscale x 16 x i1> %a, <vscale x 16 x i16> %b, <vscale x 16 x i16> %c, i32 %evl)
274 ret <vscale x 16 x i16> %v
277 declare <vscale x 32 x i16> @llvm.vp.select.nxv32i16(<vscale x 32 x i1>, <vscale x 32 x i16>, <vscale x 32 x i16>, i32)
279 define <vscale x 32 x i16> @select_nxv32i16(<vscale x 32 x i1> %a, <vscale x 32 x i16> %b, <vscale x 32 x i16> %c, i32 zeroext %evl) {
280 ; CHECK-LABEL: select_nxv32i16:
282 ; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, ma
283 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
285 %v = call <vscale x 32 x i16> @llvm.vp.select.nxv32i16(<vscale x 32 x i1> %a, <vscale x 32 x i16> %b, <vscale x 32 x i16> %c, i32 %evl)
286 ret <vscale x 32 x i16> %v
289 declare <vscale x 1 x i32> @llvm.vp.select.nxv1i32(<vscale x 1 x i1>, <vscale x 1 x i32>, <vscale x 1 x i32>, i32)
291 define <vscale x 1 x i32> @select_nxv1i32(<vscale x 1 x i1> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c, i32 zeroext %evl) {
292 ; CHECK-LABEL: select_nxv1i32:
294 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
295 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
297 %v = call <vscale x 1 x i32> @llvm.vp.select.nxv1i32(<vscale x 1 x i1> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c, i32 %evl)
298 ret <vscale x 1 x i32> %v
301 declare <vscale x 2 x i32> @llvm.vp.select.nxv2i32(<vscale x 2 x i1>, <vscale x 2 x i32>, <vscale x 2 x i32>, i32)
303 define <vscale x 2 x i32> @select_nxv2i32(<vscale x 2 x i1> %a, <vscale x 2 x i32> %b, <vscale x 2 x i32> %c, i32 zeroext %evl) {
304 ; CHECK-LABEL: select_nxv2i32:
306 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
307 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
309 %v = call <vscale x 2 x i32> @llvm.vp.select.nxv2i32(<vscale x 2 x i1> %a, <vscale x 2 x i32> %b, <vscale x 2 x i32> %c, i32 %evl)
310 ret <vscale x 2 x i32> %v
313 declare <vscale x 4 x i32> @llvm.vp.select.nxv4i32(<vscale x 4 x i1>, <vscale x 4 x i32>, <vscale x 4 x i32>, i32)
315 define <vscale x 4 x i32> @select_nxv4i32(<vscale x 4 x i1> %a, <vscale x 4 x i32> %b, <vscale x 4 x i32> %c, i32 zeroext %evl) {
316 ; CHECK-LABEL: select_nxv4i32:
318 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
319 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
321 %v = call <vscale x 4 x i32> @llvm.vp.select.nxv4i32(<vscale x 4 x i1> %a, <vscale x 4 x i32> %b, <vscale x 4 x i32> %c, i32 %evl)
322 ret <vscale x 4 x i32> %v
325 declare <vscale x 8 x i32> @llvm.vp.select.nxv8i32(<vscale x 8 x i1>, <vscale x 8 x i32>, <vscale x 8 x i32>, i32)
327 define <vscale x 8 x i32> @select_nxv8i32(<vscale x 8 x i1> %a, <vscale x 8 x i32> %b, <vscale x 8 x i32> %c, i32 zeroext %evl) {
328 ; CHECK-LABEL: select_nxv8i32:
330 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
331 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
333 %v = call <vscale x 8 x i32> @llvm.vp.select.nxv8i32(<vscale x 8 x i1> %a, <vscale x 8 x i32> %b, <vscale x 8 x i32> %c, i32 %evl)
334 ret <vscale x 8 x i32> %v
337 declare <vscale x 16 x i32> @llvm.vp.select.nxv16i32(<vscale x 16 x i1>, <vscale x 16 x i32>, <vscale x 16 x i32>, i32)
339 define <vscale x 16 x i32> @select_nxv16i32(<vscale x 16 x i1> %a, <vscale x 16 x i32> %b, <vscale x 16 x i32> %c, i32 zeroext %evl) {
340 ; CHECK-LABEL: select_nxv16i32:
342 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
343 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
345 %v = call <vscale x 16 x i32> @llvm.vp.select.nxv16i32(<vscale x 16 x i1> %a, <vscale x 16 x i32> %b, <vscale x 16 x i32> %c, i32 %evl)
346 ret <vscale x 16 x i32> %v
349 declare <vscale x 32 x i32> @llvm.vp.select.nxv32i32(<vscale x 32 x i1>, <vscale x 32 x i32>, <vscale x 32 x i32>, i32)
351 define <vscale x 32 x i32> @select_nxv32i32(<vscale x 32 x i1> %a, <vscale x 32 x i32> %b, <vscale x 32 x i32> %c, i32 zeroext %evl) {
352 ; CHECK-LABEL: select_nxv32i32:
354 ; CHECK-NEXT: addi sp, sp, -16
355 ; CHECK-NEXT: .cfi_def_cfa_offset 16
356 ; CHECK-NEXT: csrr a1, vlenb
357 ; CHECK-NEXT: slli a1, a1, 5
358 ; CHECK-NEXT: sub sp, sp, a1
359 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x20, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 32 * vlenb
360 ; CHECK-NEXT: csrr a1, vlenb
361 ; CHECK-NEXT: slli a1, a1, 4
362 ; CHECK-NEXT: add a1, sp, a1
363 ; CHECK-NEXT: addi a1, a1, 16
364 ; CHECK-NEXT: vs8r.v v16, (a1) # Unknown-size Folded Spill
365 ; CHECK-NEXT: csrr a1, vlenb
366 ; CHECK-NEXT: li a3, 24
367 ; CHECK-NEXT: mul a1, a1, a3
368 ; CHECK-NEXT: add a1, sp, a1
369 ; CHECK-NEXT: addi a1, a1, 16
370 ; CHECK-NEXT: vs8r.v v8, (a1) # Unknown-size Folded Spill
371 ; CHECK-NEXT: vmv1r.v v24, v0
372 ; CHECK-NEXT: csrr a3, vlenb
373 ; CHECK-NEXT: slli a1, a3, 3
374 ; CHECK-NEXT: add a1, a0, a1
375 ; CHECK-NEXT: vl8re32.v v8, (a1)
376 ; CHECK-NEXT: csrr a1, vlenb
377 ; CHECK-NEXT: slli a1, a1, 3
378 ; CHECK-NEXT: add a1, sp, a1
379 ; CHECK-NEXT: addi a1, a1, 16
380 ; CHECK-NEXT: vs8r.v v8, (a1) # Unknown-size Folded Spill
381 ; CHECK-NEXT: slli a1, a3, 1
382 ; CHECK-NEXT: sub a4, a2, a1
383 ; CHECK-NEXT: sltu a5, a2, a4
384 ; CHECK-NEXT: addi a5, a5, -1
385 ; CHECK-NEXT: srli a3, a3, 2
386 ; CHECK-NEXT: vl8re32.v v8, (a0)
387 ; CHECK-NEXT: addi a0, sp, 16
388 ; CHECK-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
389 ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
390 ; CHECK-NEXT: vslidedown.vx v0, v0, a3
391 ; CHECK-NEXT: and a4, a5, a4
392 ; CHECK-NEXT: csrr a0, vlenb
393 ; CHECK-NEXT: slli a0, a0, 4
394 ; CHECK-NEXT: add a0, sp, a0
395 ; CHECK-NEXT: addi a0, a0, 16
396 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
397 ; CHECK-NEXT: csrr a0, vlenb
398 ; CHECK-NEXT: slli a0, a0, 3
399 ; CHECK-NEXT: add a0, sp, a0
400 ; CHECK-NEXT: addi a0, a0, 16
401 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
402 ; CHECK-NEXT: vsetvli zero, a4, e32, m8, ta, ma
403 ; CHECK-NEXT: vmerge.vvm v16, v8, v16, v0
404 ; CHECK-NEXT: bltu a2, a1, .LBB27_2
405 ; CHECK-NEXT: # %bb.1:
406 ; CHECK-NEXT: mv a2, a1
407 ; CHECK-NEXT: .LBB27_2:
408 ; CHECK-NEXT: vmv1r.v v0, v24
409 ; CHECK-NEXT: csrr a0, vlenb
410 ; CHECK-NEXT: li a1, 24
411 ; CHECK-NEXT: mul a0, a0, a1
412 ; CHECK-NEXT: add a0, sp, a0
413 ; CHECK-NEXT: addi a0, a0, 16
414 ; CHECK-NEXT: vl8r.v v24, (a0) # Unknown-size Folded Reload
415 ; CHECK-NEXT: addi a0, sp, 16
416 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
417 ; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, ma
418 ; CHECK-NEXT: vmerge.vvm v8, v8, v24, v0
419 ; CHECK-NEXT: csrr a0, vlenb
420 ; CHECK-NEXT: slli a0, a0, 5
421 ; CHECK-NEXT: add sp, sp, a0
422 ; CHECK-NEXT: addi sp, sp, 16
424 %v = call <vscale x 32 x i32> @llvm.vp.select.nxv32i32(<vscale x 32 x i1> %a, <vscale x 32 x i32> %b, <vscale x 32 x i32> %c, i32 %evl)
425 ret <vscale x 32 x i32> %v
428 declare i32 @llvm.vscale.i32()
430 define <vscale x 32 x i32> @select_evl_nxv32i32(<vscale x 32 x i1> %a, <vscale x 32 x i32> %b, <vscale x 32 x i32> %c) {
431 ; CHECK-LABEL: select_evl_nxv32i32:
433 ; CHECK-NEXT: addi sp, sp, -16
434 ; CHECK-NEXT: .cfi_def_cfa_offset 16
435 ; CHECK-NEXT: csrr a1, vlenb
436 ; CHECK-NEXT: slli a1, a1, 5
437 ; CHECK-NEXT: sub sp, sp, a1
438 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x20, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 32 * vlenb
439 ; CHECK-NEXT: csrr a1, vlenb
440 ; CHECK-NEXT: slli a1, a1, 4
441 ; CHECK-NEXT: add a1, sp, a1
442 ; CHECK-NEXT: addi a1, a1, 16
443 ; CHECK-NEXT: vs8r.v v16, (a1) # Unknown-size Folded Spill
444 ; CHECK-NEXT: csrr a1, vlenb
445 ; CHECK-NEXT: li a2, 24
446 ; CHECK-NEXT: mul a1, a1, a2
447 ; CHECK-NEXT: add a1, sp, a1
448 ; CHECK-NEXT: addi a1, a1, 16
449 ; CHECK-NEXT: vs8r.v v8, (a1) # Unknown-size Folded Spill
450 ; CHECK-NEXT: vmv1r.v v24, v0
451 ; CHECK-NEXT: csrr a1, vlenb
452 ; CHECK-NEXT: slli a2, a1, 3
453 ; CHECK-NEXT: add a2, a0, a2
454 ; CHECK-NEXT: vl8re32.v v8, (a2)
455 ; CHECK-NEXT: csrr a2, vlenb
456 ; CHECK-NEXT: slli a2, a2, 3
457 ; CHECK-NEXT: add a2, sp, a2
458 ; CHECK-NEXT: addi a2, a2, 16
459 ; CHECK-NEXT: vs8r.v v8, (a2) # Unknown-size Folded Spill
460 ; CHECK-NEXT: slli a2, a1, 1
461 ; CHECK-NEXT: sub a3, a1, a2
462 ; CHECK-NEXT: sltu a4, a1, a3
463 ; CHECK-NEXT: addi a4, a4, -1
464 ; CHECK-NEXT: srli a5, a1, 2
465 ; CHECK-NEXT: vl8re32.v v8, (a0)
466 ; CHECK-NEXT: addi a0, sp, 16
467 ; CHECK-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
468 ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
469 ; CHECK-NEXT: vslidedown.vx v0, v0, a5
470 ; CHECK-NEXT: and a3, a4, a3
471 ; CHECK-NEXT: csrr a0, vlenb
472 ; CHECK-NEXT: slli a0, a0, 4
473 ; CHECK-NEXT: add a0, sp, a0
474 ; CHECK-NEXT: addi a0, a0, 16
475 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
476 ; CHECK-NEXT: csrr a0, vlenb
477 ; CHECK-NEXT: slli a0, a0, 3
478 ; CHECK-NEXT: add a0, sp, a0
479 ; CHECK-NEXT: addi a0, a0, 16
480 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
481 ; CHECK-NEXT: vsetvli zero, a3, e32, m8, ta, ma
482 ; CHECK-NEXT: vmerge.vvm v16, v8, v16, v0
483 ; CHECK-NEXT: bltu a1, a2, .LBB28_2
484 ; CHECK-NEXT: # %bb.1:
485 ; CHECK-NEXT: mv a1, a2
486 ; CHECK-NEXT: .LBB28_2:
487 ; CHECK-NEXT: vmv1r.v v0, v24
488 ; CHECK-NEXT: csrr a0, vlenb
489 ; CHECK-NEXT: li a2, 24
490 ; CHECK-NEXT: mul a0, a0, a2
491 ; CHECK-NEXT: add a0, sp, a0
492 ; CHECK-NEXT: addi a0, a0, 16
493 ; CHECK-NEXT: vl8r.v v24, (a0) # Unknown-size Folded Reload
494 ; CHECK-NEXT: addi a0, sp, 16
495 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
496 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
497 ; CHECK-NEXT: vmerge.vvm v8, v8, v24, v0
498 ; CHECK-NEXT: csrr a0, vlenb
499 ; CHECK-NEXT: slli a0, a0, 5
500 ; CHECK-NEXT: add sp, sp, a0
501 ; CHECK-NEXT: addi sp, sp, 16
503 %evl = call i32 @llvm.vscale.i32()
504 %evl0 = mul i32 %evl, 8
505 %v = call <vscale x 32 x i32> @llvm.vp.select.nxv32i32(<vscale x 32 x i1> %a, <vscale x 32 x i32> %b, <vscale x 32 x i32> %c, i32 %evl0)
506 ret <vscale x 32 x i32> %v
509 declare <vscale x 1 x i64> @llvm.vp.select.nxv1i64(<vscale x 1 x i1>, <vscale x 1 x i64>, <vscale x 1 x i64>, i32)
511 define <vscale x 1 x i64> @select_nxv1i64(<vscale x 1 x i1> %a, <vscale x 1 x i64> %b, <vscale x 1 x i64> %c, i32 zeroext %evl) {
512 ; CHECK-LABEL: select_nxv1i64:
514 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
515 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
517 %v = call <vscale x 1 x i64> @llvm.vp.select.nxv1i64(<vscale x 1 x i1> %a, <vscale x 1 x i64> %b, <vscale x 1 x i64> %c, i32 %evl)
518 ret <vscale x 1 x i64> %v
521 declare <vscale x 2 x i64> @llvm.vp.select.nxv2i64(<vscale x 2 x i1>, <vscale x 2 x i64>, <vscale x 2 x i64>, i32)
523 define <vscale x 2 x i64> @select_nxv2i64(<vscale x 2 x i1> %a, <vscale x 2 x i64> %b, <vscale x 2 x i64> %c, i32 zeroext %evl) {
524 ; CHECK-LABEL: select_nxv2i64:
526 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
527 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
529 %v = call <vscale x 2 x i64> @llvm.vp.select.nxv2i64(<vscale x 2 x i1> %a, <vscale x 2 x i64> %b, <vscale x 2 x i64> %c, i32 %evl)
530 ret <vscale x 2 x i64> %v
533 declare <vscale x 4 x i64> @llvm.vp.select.nxv4i64(<vscale x 4 x i1>, <vscale x 4 x i64>, <vscale x 4 x i64>, i32)
535 define <vscale x 4 x i64> @select_nxv4i64(<vscale x 4 x i1> %a, <vscale x 4 x i64> %b, <vscale x 4 x i64> %c, i32 zeroext %evl) {
536 ; CHECK-LABEL: select_nxv4i64:
538 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
539 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
541 %v = call <vscale x 4 x i64> @llvm.vp.select.nxv4i64(<vscale x 4 x i1> %a, <vscale x 4 x i64> %b, <vscale x 4 x i64> %c, i32 %evl)
542 ret <vscale x 4 x i64> %v
545 declare <vscale x 8 x i64> @llvm.vp.select.nxv8i64(<vscale x 8 x i1>, <vscale x 8 x i64>, <vscale x 8 x i64>, i32)
547 define <vscale x 8 x i64> @select_nxv8i64(<vscale x 8 x i1> %a, <vscale x 8 x i64> %b, <vscale x 8 x i64> %c, i32 zeroext %evl) {
548 ; CHECK-LABEL: select_nxv8i64:
550 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
551 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
553 %v = call <vscale x 8 x i64> @llvm.vp.select.nxv8i64(<vscale x 8 x i1> %a, <vscale x 8 x i64> %b, <vscale x 8 x i64> %c, i32 %evl)
554 ret <vscale x 8 x i64> %v
557 declare <vscale x 1 x half> @llvm.vp.select.nxv1f16(<vscale x 1 x i1>, <vscale x 1 x half>, <vscale x 1 x half>, i32)
559 define <vscale x 1 x half> @select_nxv1f16(<vscale x 1 x i1> %a, <vscale x 1 x half> %b, <vscale x 1 x half> %c, i32 zeroext %evl) {
560 ; CHECK-LABEL: select_nxv1f16:
562 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
563 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
565 %v = call <vscale x 1 x half> @llvm.vp.select.nxv1f16(<vscale x 1 x i1> %a, <vscale x 1 x half> %b, <vscale x 1 x half> %c, i32 %evl)
566 ret <vscale x 1 x half> %v
569 declare <vscale x 2 x half> @llvm.vp.select.nxv2f16(<vscale x 2 x i1>, <vscale x 2 x half>, <vscale x 2 x half>, i32)
571 define <vscale x 2 x half> @select_nxv2f16(<vscale x 2 x i1> %a, <vscale x 2 x half> %b, <vscale x 2 x half> %c, i32 zeroext %evl) {
572 ; CHECK-LABEL: select_nxv2f16:
574 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
575 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
577 %v = call <vscale x 2 x half> @llvm.vp.select.nxv2f16(<vscale x 2 x i1> %a, <vscale x 2 x half> %b, <vscale x 2 x half> %c, i32 %evl)
578 ret <vscale x 2 x half> %v
581 declare <vscale x 4 x half> @llvm.vp.select.nxv4f16(<vscale x 4 x i1>, <vscale x 4 x half>, <vscale x 4 x half>, i32)
583 define <vscale x 4 x half> @select_nxv4f16(<vscale x 4 x i1> %a, <vscale x 4 x half> %b, <vscale x 4 x half> %c, i32 zeroext %evl) {
584 ; CHECK-LABEL: select_nxv4f16:
586 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
587 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
589 %v = call <vscale x 4 x half> @llvm.vp.select.nxv4f16(<vscale x 4 x i1> %a, <vscale x 4 x half> %b, <vscale x 4 x half> %c, i32 %evl)
590 ret <vscale x 4 x half> %v
593 declare <vscale x 8 x half> @llvm.vp.select.nxv8f16(<vscale x 8 x i1>, <vscale x 8 x half>, <vscale x 8 x half>, i32)
595 define <vscale x 8 x half> @select_nxv8f16(<vscale x 8 x i1> %a, <vscale x 8 x half> %b, <vscale x 8 x half> %c, i32 zeroext %evl) {
596 ; CHECK-LABEL: select_nxv8f16:
598 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
599 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
601 %v = call <vscale x 8 x half> @llvm.vp.select.nxv8f16(<vscale x 8 x i1> %a, <vscale x 8 x half> %b, <vscale x 8 x half> %c, i32 %evl)
602 ret <vscale x 8 x half> %v
605 declare <vscale x 16 x half> @llvm.vp.select.nxv16f16(<vscale x 16 x i1>, <vscale x 16 x half>, <vscale x 16 x half>, i32)
607 define <vscale x 16 x half> @select_nxv16f16(<vscale x 16 x i1> %a, <vscale x 16 x half> %b, <vscale x 16 x half> %c, i32 zeroext %evl) {
608 ; CHECK-LABEL: select_nxv16f16:
610 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
611 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
613 %v = call <vscale x 16 x half> @llvm.vp.select.nxv16f16(<vscale x 16 x i1> %a, <vscale x 16 x half> %b, <vscale x 16 x half> %c, i32 %evl)
614 ret <vscale x 16 x half> %v
617 declare <vscale x 32 x half> @llvm.vp.select.nxv32f16(<vscale x 32 x i1>, <vscale x 32 x half>, <vscale x 32 x half>, i32)
619 define <vscale x 32 x half> @select_nxv32f16(<vscale x 32 x i1> %a, <vscale x 32 x half> %b, <vscale x 32 x half> %c, i32 zeroext %evl) {
620 ; CHECK-LABEL: select_nxv32f16:
622 ; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, ma
623 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
625 %v = call <vscale x 32 x half> @llvm.vp.select.nxv32f16(<vscale x 32 x i1> %a, <vscale x 32 x half> %b, <vscale x 32 x half> %c, i32 %evl)
626 ret <vscale x 32 x half> %v
629 declare <vscale x 1 x float> @llvm.vp.select.nxv1f32(<vscale x 1 x i1>, <vscale x 1 x float>, <vscale x 1 x float>, i32)
631 define <vscale x 1 x float> @select_nxv1f32(<vscale x 1 x i1> %a, <vscale x 1 x float> %b, <vscale x 1 x float> %c, i32 zeroext %evl) {
632 ; CHECK-LABEL: select_nxv1f32:
634 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
635 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
637 %v = call <vscale x 1 x float> @llvm.vp.select.nxv1f32(<vscale x 1 x i1> %a, <vscale x 1 x float> %b, <vscale x 1 x float> %c, i32 %evl)
638 ret <vscale x 1 x float> %v
641 declare <vscale x 2 x float> @llvm.vp.select.nxv2f32(<vscale x 2 x i1>, <vscale x 2 x float>, <vscale x 2 x float>, i32)
643 define <vscale x 2 x float> @select_nxv2f32(<vscale x 2 x i1> %a, <vscale x 2 x float> %b, <vscale x 2 x float> %c, i32 zeroext %evl) {
644 ; CHECK-LABEL: select_nxv2f32:
646 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
647 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
649 %v = call <vscale x 2 x float> @llvm.vp.select.nxv2f32(<vscale x 2 x i1> %a, <vscale x 2 x float> %b, <vscale x 2 x float> %c, i32 %evl)
650 ret <vscale x 2 x float> %v
653 declare <vscale x 4 x float> @llvm.vp.select.nxv4f32(<vscale x 4 x i1>, <vscale x 4 x float>, <vscale x 4 x float>, i32)
655 define <vscale x 4 x float> @select_nxv4f32(<vscale x 4 x i1> %a, <vscale x 4 x float> %b, <vscale x 4 x float> %c, i32 zeroext %evl) {
656 ; CHECK-LABEL: select_nxv4f32:
658 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
659 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
661 %v = call <vscale x 4 x float> @llvm.vp.select.nxv4f32(<vscale x 4 x i1> %a, <vscale x 4 x float> %b, <vscale x 4 x float> %c, i32 %evl)
662 ret <vscale x 4 x float> %v
665 declare <vscale x 8 x float> @llvm.vp.select.nxv8f32(<vscale x 8 x i1>, <vscale x 8 x float>, <vscale x 8 x float>, i32)
667 define <vscale x 8 x float> @select_nxv8f32(<vscale x 8 x i1> %a, <vscale x 8 x float> %b, <vscale x 8 x float> %c, i32 zeroext %evl) {
668 ; CHECK-LABEL: select_nxv8f32:
670 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
671 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
673 %v = call <vscale x 8 x float> @llvm.vp.select.nxv8f32(<vscale x 8 x i1> %a, <vscale x 8 x float> %b, <vscale x 8 x float> %c, i32 %evl)
674 ret <vscale x 8 x float> %v
677 declare <vscale x 16 x float> @llvm.vp.select.nxv16f32(<vscale x 16 x i1>, <vscale x 16 x float>, <vscale x 16 x float>, i32)
679 define <vscale x 16 x float> @select_nxv16f32(<vscale x 16 x i1> %a, <vscale x 16 x float> %b, <vscale x 16 x float> %c, i32 zeroext %evl) {
680 ; CHECK-LABEL: select_nxv16f32:
682 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
683 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
685 %v = call <vscale x 16 x float> @llvm.vp.select.nxv16f32(<vscale x 16 x i1> %a, <vscale x 16 x float> %b, <vscale x 16 x float> %c, i32 %evl)
686 ret <vscale x 16 x float> %v
689 declare <vscale x 1 x double> @llvm.vp.select.nxv1f64(<vscale x 1 x i1>, <vscale x 1 x double>, <vscale x 1 x double>, i32)
691 define <vscale x 1 x double> @select_nxv1f64(<vscale x 1 x i1> %a, <vscale x 1 x double> %b, <vscale x 1 x double> %c, i32 zeroext %evl) {
692 ; CHECK-LABEL: select_nxv1f64:
694 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
695 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
697 %v = call <vscale x 1 x double> @llvm.vp.select.nxv1f64(<vscale x 1 x i1> %a, <vscale x 1 x double> %b, <vscale x 1 x double> %c, i32 %evl)
698 ret <vscale x 1 x double> %v
701 declare <vscale x 2 x double> @llvm.vp.select.nxv2f64(<vscale x 2 x i1>, <vscale x 2 x double>, <vscale x 2 x double>, i32)
703 define <vscale x 2 x double> @select_nxv2f64(<vscale x 2 x i1> %a, <vscale x 2 x double> %b, <vscale x 2 x double> %c, i32 zeroext %evl) {
704 ; CHECK-LABEL: select_nxv2f64:
706 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
707 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
709 %v = call <vscale x 2 x double> @llvm.vp.select.nxv2f64(<vscale x 2 x i1> %a, <vscale x 2 x double> %b, <vscale x 2 x double> %c, i32 %evl)
710 ret <vscale x 2 x double> %v
713 declare <vscale x 4 x double> @llvm.vp.select.nxv4f64(<vscale x 4 x i1>, <vscale x 4 x double>, <vscale x 4 x double>, i32)
715 define <vscale x 4 x double> @select_nxv4f64(<vscale x 4 x i1> %a, <vscale x 4 x double> %b, <vscale x 4 x double> %c, i32 zeroext %evl) {
716 ; CHECK-LABEL: select_nxv4f64:
718 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
719 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
721 %v = call <vscale x 4 x double> @llvm.vp.select.nxv4f64(<vscale x 4 x i1> %a, <vscale x 4 x double> %b, <vscale x 4 x double> %c, i32 %evl)
722 ret <vscale x 4 x double> %v
725 declare <vscale x 8 x double> @llvm.vp.select.nxv8f64(<vscale x 8 x i1>, <vscale x 8 x double>, <vscale x 8 x double>, i32)
727 define <vscale x 8 x double> @select_nxv8f64(<vscale x 8 x i1> %a, <vscale x 8 x double> %b, <vscale x 8 x double> %c, i32 zeroext %evl) {
728 ; CHECK-LABEL: select_nxv8f64:
730 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
731 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
733 %v = call <vscale x 8 x double> @llvm.vp.select.nxv8f64(<vscale x 8 x i1> %a, <vscale x 8 x double> %b, <vscale x 8 x double> %c, i32 %evl)
734 ret <vscale x 8 x double> %v
737 declare <vscale x 16 x double> @llvm.vp.select.nxv16f64(<vscale x 16 x i1>, <vscale x 16 x double>, <vscale x 16 x double>, i32)
739 define <vscale x 16 x double> @select_nxv16f64(<vscale x 16 x i1> %a, <vscale x 16 x double> %b, <vscale x 16 x double> %c, i32 zeroext %evl) {
740 ; CHECK-LABEL: select_nxv16f64:
742 ; CHECK-NEXT: addi sp, sp, -16
743 ; CHECK-NEXT: .cfi_def_cfa_offset 16
744 ; CHECK-NEXT: csrr a1, vlenb
745 ; CHECK-NEXT: slli a1, a1, 4
746 ; CHECK-NEXT: sub sp, sp, a1
747 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x10, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 16 * vlenb
748 ; CHECK-NEXT: csrr a1, vlenb
749 ; CHECK-NEXT: slli a1, a1, 3
750 ; CHECK-NEXT: add a1, sp, a1
751 ; CHECK-NEXT: addi a1, a1, 16
752 ; CHECK-NEXT: vs8r.v v8, (a1) # Unknown-size Folded Spill
753 ; CHECK-NEXT: vmv1r.v v24, v0
754 ; CHECK-NEXT: csrr a1, vlenb
755 ; CHECK-NEXT: slli a3, a1, 3
756 ; CHECK-NEXT: add a3, a0, a3
757 ; CHECK-NEXT: vl8re64.v v8, (a3)
758 ; CHECK-NEXT: sub a3, a2, a1
759 ; CHECK-NEXT: sltu a4, a2, a3
760 ; CHECK-NEXT: addi a4, a4, -1
761 ; CHECK-NEXT: srli a5, a1, 3
762 ; CHECK-NEXT: vl8re64.v v0, (a0)
763 ; CHECK-NEXT: addi a0, sp, 16
764 ; CHECK-NEXT: vs8r.v v0, (a0) # Unknown-size Folded Spill
765 ; CHECK-NEXT: vsetvli a0, zero, e8, mf4, ta, ma
766 ; CHECK-NEXT: vslidedown.vx v0, v24, a5
767 ; CHECK-NEXT: and a3, a4, a3
768 ; CHECK-NEXT: vsetvli zero, a3, e64, m8, ta, ma
769 ; CHECK-NEXT: vmerge.vvm v16, v8, v16, v0
770 ; CHECK-NEXT: bltu a2, a1, .LBB48_2
771 ; CHECK-NEXT: # %bb.1:
772 ; CHECK-NEXT: mv a2, a1
773 ; CHECK-NEXT: .LBB48_2:
774 ; CHECK-NEXT: vmv1r.v v0, v24
775 ; CHECK-NEXT: csrr a0, vlenb
776 ; CHECK-NEXT: slli a0, a0, 3
777 ; CHECK-NEXT: add a0, sp, a0
778 ; CHECK-NEXT: addi a0, a0, 16
779 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
780 ; CHECK-NEXT: addi a0, sp, 16
781 ; CHECK-NEXT: vl8r.v v24, (a0) # Unknown-size Folded Reload
782 ; CHECK-NEXT: vsetvli zero, a2, e64, m8, ta, ma
783 ; CHECK-NEXT: vmerge.vvm v8, v24, v8, v0
784 ; CHECK-NEXT: csrr a0, vlenb
785 ; CHECK-NEXT: slli a0, a0, 4
786 ; CHECK-NEXT: add sp, sp, a0
787 ; CHECK-NEXT: addi sp, sp, 16
789 %v = call <vscale x 16 x double> @llvm.vp.select.nxv16f64(<vscale x 16 x i1> %a, <vscale x 16 x double> %b, <vscale x 16 x double> %c, i32 %evl)
790 ret <vscale x 16 x double> %v
793 define <vscale x 2 x i1> @select_zero(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, <vscale x 2 x i1> %m, i32 zeroext %evl) {
794 ; CHECK-LABEL: select_zero:
796 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
797 ; CHECK-NEXT: vmand.mm v0, v0, v8
799 %a = call <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, <vscale x 2 x i1> zeroinitializer, i32 %evl)
800 ret <vscale x 2 x i1> %a
803 define <vscale x 2 x i1> @select_one(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, <vscale x 2 x i1> %m, i32 zeroext %evl) {
804 ; CHECK-LABEL: select_one:
806 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
807 ; CHECK-NEXT: vmorn.mm v0, v8, v0
809 %a = call <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, <vscale x 2 x i1> splat (i1 true), i32 %evl)
810 ret <vscale x 2 x i1> %a
813 define <vscale x 2 x i1> @select_x_zero(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, i32 zeroext %evl) {
814 ; CHECK-LABEL: select_x_zero:
816 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
817 ; CHECK-NEXT: vmand.mm v0, v0, v8
819 %a = call <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, <vscale x 2 x i1> zeroinitializer, i32 %evl)
820 ret <vscale x 2 x i1> %a
823 define <vscale x 2 x i1> @select_x_one(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, i32 zeroext %evl) {
824 ; CHECK-LABEL: select_x_one:
826 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
827 ; CHECK-NEXT: vmorn.mm v0, v8, v0
829 %a = call <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, <vscale x 2 x i1> splat (i1 true), i32 %evl)
830 ret <vscale x 2 x i1> %a
833 define <vscale x 2 x i1> @select_zero_x(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, i32 zeroext %evl) {
834 ; CHECK-LABEL: select_zero_x:
836 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
837 ; CHECK-NEXT: vmandn.mm v0, v8, v0
839 %a = call <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> %x, <vscale x 2 x i1> zeroinitializer, <vscale x 2 x i1> %y, i32 %evl)
840 ret <vscale x 2 x i1> %a
843 define <vscale x 2 x i1> @select_one_x(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, i32 zeroext %evl) {
844 ; CHECK-LABEL: select_one_x:
846 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
847 ; CHECK-NEXT: vmor.mm v0, v0, v8
849 %a = call <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> %x, <vscale x 2 x i1> splat (i1 true), <vscale x 2 x i1> %y, i32 %evl)
850 ret <vscale x 2 x i1> %a
853 define <vscale x 2 x i1> @select_cond_cond_x(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, <vscale x 2 x i1> %m, i32 zeroext %evl) {
854 ; CHECK-LABEL: select_cond_cond_x:
856 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
857 ; CHECK-NEXT: vmor.mm v0, v0, v8
859 %a = call <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> %x, <vscale x 2 x i1> %x, <vscale x 2 x i1> %y, i32 %evl)
860 ret <vscale x 2 x i1> %a
863 define <vscale x 2 x i1> @select_cond_x_cond(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, <vscale x 2 x i1> %m, i32 zeroext %evl) {
864 ; CHECK-LABEL: select_cond_x_cond:
866 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
867 ; CHECK-NEXT: vmand.mm v0, v0, v8
869 %a = call <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, <vscale x 2 x i1> %x, i32 %evl)
870 ret <vscale x 2 x i1> %a
873 define <vscale x 2 x i1> @select_undef_T_F(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, i32 zeroext %evl) {
874 ; CHECK-LABEL: select_undef_T_F:
876 ; CHECK-NEXT: vmv1r.v v0, v8
878 %a = call <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> poison, <vscale x 2 x i1> %x, <vscale x 2 x i1> %y, i32 %evl)
879 ret <vscale x 2 x i1> %a
882 define <vscale x 2 x i1> @select_undef_undef_F(<vscale x 2 x i1> %x, i32 zeroext %evl) {
883 ; CHECK-LABEL: select_undef_undef_F:
886 %a = call <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> poison, <vscale x 2 x i1> undef, <vscale x 2 x i1> %x, i32 %evl)
887 ret <vscale x 2 x i1> %a
890 define <vscale x 2 x i1> @select_unknown_undef_F(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, i32 zeroext %evl) {
891 ; CHECK-LABEL: select_unknown_undef_F:
893 ; CHECK-NEXT: vmv1r.v v0, v8
895 %a = call <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> %x, <vscale x 2 x i1> undef, <vscale x 2 x i1> %y, i32 %evl)
896 ret <vscale x 2 x i1> %a
899 define <vscale x 2 x i1> @select_unknown_T_undef(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, i32 zeroext %evl) {
900 ; CHECK-LABEL: select_unknown_T_undef:
902 ; CHECK-NEXT: vmv1r.v v0, v8
904 %a = call <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, <vscale x 2 x i1> poison, i32 %evl)
905 ret <vscale x 2 x i1> %a
908 define <vscale x 2 x i1> @select_false_T_F(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, <vscale x 2 x i1> %z, i32 zeroext %evl) {
909 ; CHECK-LABEL: select_false_T_F:
911 ; CHECK-NEXT: vmv1r.v v0, v9
913 %a = call <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> zeroinitializer, <vscale x 2 x i1> %y, <vscale x 2 x i1> %z, i32 %evl)
914 ret <vscale x 2 x i1> %a
917 define <vscale x 2 x i1> @select_unknown_T_T(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, i32 zeroext %evl) {
918 ; CHECK-LABEL: select_unknown_T_T:
920 ; CHECK-NEXT: vmv1r.v v0, v8
922 %a = call <vscale x 2 x i1> @llvm.vp.select.nxv2i1(<vscale x 2 x i1> %x, <vscale x 2 x i1> %y, <vscale x 2 x i1> %y, i32 %evl)
923 ret <vscale x 2 x i1> %a