1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+m,+d,+zfh,+zvfh,+v -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,CHECK-ZVFH
4 ; RUN: llc -mtriple=riscv64 -mattr=+m,+d,+zfh,+zvfh,+v -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,CHECK-ZVFH
6 ; RUN: llc -mtriple=riscv32 -mattr=+m,+d,+zfh,+zvfhmin,+v -target-abi=ilp32d \
7 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,CHECK-ZVFHMIN
8 ; RUN: llc -mtriple=riscv64 -mattr=+m,+d,+zfh,+zvfhmin,+v -target-abi=lp64d \
9 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,CHECK-ZVFHMIN
11 define <vscale x 1 x half> @vfmerge_vv_nxv1f16(<vscale x 1 x half> %va, <vscale x 1 x half> %vb, <vscale x 1 x i1> %cond) {
12 ; CHECK-LABEL: vfmerge_vv_nxv1f16:
14 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
15 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
17 %vc = select <vscale x 1 x i1> %cond, <vscale x 1 x half> %va, <vscale x 1 x half> %vb
18 ret <vscale x 1 x half> %vc
21 define <vscale x 1 x half> @vfmerge_fv_nxv1f16(<vscale x 1 x half> %va, half %b, <vscale x 1 x i1> %cond) {
22 ; CHECK-ZVFH-LABEL: vfmerge_fv_nxv1f16:
23 ; CHECK-ZVFH: # %bb.0:
24 ; CHECK-ZVFH-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
25 ; CHECK-ZVFH-NEXT: vfmerge.vfm v8, v8, fa0, v0
26 ; CHECK-ZVFH-NEXT: ret
28 ; CHECK-ZVFHMIN-LABEL: vfmerge_fv_nxv1f16:
29 ; CHECK-ZVFHMIN: # %bb.0:
30 ; CHECK-ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
31 ; CHECK-ZVFHMIN-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
32 ; CHECK-ZVFHMIN-NEXT: vfmv.v.f v9, fa5
33 ; CHECK-ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf4, ta, mu
34 ; CHECK-ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9, v0.t
35 ; CHECK-ZVFHMIN-NEXT: ret
36 %head = insertelement <vscale x 1 x half> poison, half %b, i32 0
37 %splat = shufflevector <vscale x 1 x half> %head, <vscale x 1 x half> poison, <vscale x 1 x i32> zeroinitializer
38 %vc = select <vscale x 1 x i1> %cond, <vscale x 1 x half> %splat, <vscale x 1 x half> %va
39 ret <vscale x 1 x half> %vc
42 define <vscale x 2 x half> @vfmerge_vv_nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x half> %vb, <vscale x 2 x i1> %cond) {
43 ; CHECK-LABEL: vfmerge_vv_nxv2f16:
45 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
46 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
48 %vc = select <vscale x 2 x i1> %cond, <vscale x 2 x half> %va, <vscale x 2 x half> %vb
49 ret <vscale x 2 x half> %vc
52 define <vscale x 2 x half> @vfmerge_fv_nxv2f16(<vscale x 2 x half> %va, half %b, <vscale x 2 x i1> %cond) {
53 ; CHECK-ZVFH-LABEL: vfmerge_fv_nxv2f16:
54 ; CHECK-ZVFH: # %bb.0:
55 ; CHECK-ZVFH-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
56 ; CHECK-ZVFH-NEXT: vfmerge.vfm v8, v8, fa0, v0
57 ; CHECK-ZVFH-NEXT: ret
59 ; CHECK-ZVFHMIN-LABEL: vfmerge_fv_nxv2f16:
60 ; CHECK-ZVFHMIN: # %bb.0:
61 ; CHECK-ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
62 ; CHECK-ZVFHMIN-NEXT: vsetvli a0, zero, e32, m1, ta, ma
63 ; CHECK-ZVFHMIN-NEXT: vfmv.v.f v9, fa5
64 ; CHECK-ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf2, ta, mu
65 ; CHECK-ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9, v0.t
66 ; CHECK-ZVFHMIN-NEXT: ret
67 %head = insertelement <vscale x 2 x half> poison, half %b, i32 0
68 %splat = shufflevector <vscale x 2 x half> %head, <vscale x 2 x half> poison, <vscale x 2 x i32> zeroinitializer
69 %vc = select <vscale x 2 x i1> %cond, <vscale x 2 x half> %splat, <vscale x 2 x half> %va
70 ret <vscale x 2 x half> %vc
73 define <vscale x 4 x half> @vfmerge_vv_nxv4f16(<vscale x 4 x half> %va, <vscale x 4 x half> %vb, <vscale x 4 x i1> %cond) {
74 ; CHECK-LABEL: vfmerge_vv_nxv4f16:
76 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
77 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
79 %vc = select <vscale x 4 x i1> %cond, <vscale x 4 x half> %va, <vscale x 4 x half> %vb
80 ret <vscale x 4 x half> %vc
83 define <vscale x 4 x half> @vfmerge_fv_nxv4f16(<vscale x 4 x half> %va, half %b, <vscale x 4 x i1> %cond) {
84 ; CHECK-ZVFH-LABEL: vfmerge_fv_nxv4f16:
85 ; CHECK-ZVFH: # %bb.0:
86 ; CHECK-ZVFH-NEXT: vsetvli a0, zero, e16, m1, ta, ma
87 ; CHECK-ZVFH-NEXT: vfmerge.vfm v8, v8, fa0, v0
88 ; CHECK-ZVFH-NEXT: ret
90 ; CHECK-ZVFHMIN-LABEL: vfmerge_fv_nxv4f16:
91 ; CHECK-ZVFHMIN: # %bb.0:
92 ; CHECK-ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
93 ; CHECK-ZVFHMIN-NEXT: vsetvli a0, zero, e32, m2, ta, ma
94 ; CHECK-ZVFHMIN-NEXT: vfmv.v.f v10, fa5
95 ; CHECK-ZVFHMIN-NEXT: vsetvli zero, zero, e16, m1, ta, mu
96 ; CHECK-ZVFHMIN-NEXT: vfncvt.f.f.w v8, v10, v0.t
97 ; CHECK-ZVFHMIN-NEXT: ret
98 %head = insertelement <vscale x 4 x half> poison, half %b, i32 0
99 %splat = shufflevector <vscale x 4 x half> %head, <vscale x 4 x half> poison, <vscale x 4 x i32> zeroinitializer
100 %vc = select <vscale x 4 x i1> %cond, <vscale x 4 x half> %splat, <vscale x 4 x half> %va
101 ret <vscale x 4 x half> %vc
104 define <vscale x 8 x half> @vfmerge_vv_nxv8f16(<vscale x 8 x half> %va, <vscale x 8 x half> %vb, <vscale x 8 x i1> %cond) {
105 ; CHECK-LABEL: vfmerge_vv_nxv8f16:
107 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
108 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
110 %vc = select <vscale x 8 x i1> %cond, <vscale x 8 x half> %va, <vscale x 8 x half> %vb
111 ret <vscale x 8 x half> %vc
114 define <vscale x 8 x half> @vfmerge_fv_nxv8f16(<vscale x 8 x half> %va, half %b, <vscale x 8 x i1> %cond) {
115 ; CHECK-ZVFH-LABEL: vfmerge_fv_nxv8f16:
116 ; CHECK-ZVFH: # %bb.0:
117 ; CHECK-ZVFH-NEXT: vsetvli a0, zero, e16, m2, ta, ma
118 ; CHECK-ZVFH-NEXT: vfmerge.vfm v8, v8, fa0, v0
119 ; CHECK-ZVFH-NEXT: ret
121 ; CHECK-ZVFHMIN-LABEL: vfmerge_fv_nxv8f16:
122 ; CHECK-ZVFHMIN: # %bb.0:
123 ; CHECK-ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
124 ; CHECK-ZVFHMIN-NEXT: vsetvli a0, zero, e32, m4, ta, ma
125 ; CHECK-ZVFHMIN-NEXT: vfmv.v.f v12, fa5
126 ; CHECK-ZVFHMIN-NEXT: vsetvli zero, zero, e16, m2, ta, mu
127 ; CHECK-ZVFHMIN-NEXT: vfncvt.f.f.w v8, v12, v0.t
128 ; CHECK-ZVFHMIN-NEXT: ret
129 %head = insertelement <vscale x 8 x half> poison, half %b, i32 0
130 %splat = shufflevector <vscale x 8 x half> %head, <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
131 %vc = select <vscale x 8 x i1> %cond, <vscale x 8 x half> %splat, <vscale x 8 x half> %va
132 ret <vscale x 8 x half> %vc
135 define <vscale x 8 x half> @vfmerge_zv_nxv8f16(<vscale x 8 x half> %va, <vscale x 8 x i1> %cond) {
136 ; CHECK-LABEL: vfmerge_zv_nxv8f16:
138 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
139 ; CHECK-NEXT: vmerge.vim v8, v8, 0, v0
141 %head = insertelement <vscale x 8 x half> poison, half zeroinitializer, i32 0
142 %splat = shufflevector <vscale x 8 x half> %head, <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
143 %vc = select <vscale x 8 x i1> %cond, <vscale x 8 x half> %splat, <vscale x 8 x half> %va
144 ret <vscale x 8 x half> %vc
147 define <vscale x 8 x half> @vmerge_truelhs_nxv8f16_0(<vscale x 8 x half> %va, <vscale x 8 x half> %vb) {
148 ; CHECK-LABEL: vmerge_truelhs_nxv8f16_0:
151 %mhead = insertelement <vscale x 8 x i1> poison, i1 1, i32 0
152 %mtrue = shufflevector <vscale x 8 x i1> %mhead, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
153 %vc = select <vscale x 8 x i1> %mtrue, <vscale x 8 x half> %va, <vscale x 8 x half> %vb
154 ret <vscale x 8 x half> %vc
157 define <vscale x 8 x half> @vmerge_falselhs_nxv8f16_0(<vscale x 8 x half> %va, <vscale x 8 x half> %vb) {
158 ; CHECK-LABEL: vmerge_falselhs_nxv8f16_0:
160 ; CHECK-NEXT: vmv2r.v v8, v10
162 %vc = select <vscale x 8 x i1> zeroinitializer, <vscale x 8 x half> %va, <vscale x 8 x half> %vb
163 ret <vscale x 8 x half> %vc
166 define <vscale x 16 x half> @vfmerge_vv_nxv16f16(<vscale x 16 x half> %va, <vscale x 16 x half> %vb, <vscale x 16 x i1> %cond) {
167 ; CHECK-LABEL: vfmerge_vv_nxv16f16:
169 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
170 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
172 %vc = select <vscale x 16 x i1> %cond, <vscale x 16 x half> %va, <vscale x 16 x half> %vb
173 ret <vscale x 16 x half> %vc
176 define <vscale x 16 x half> @vfmerge_fv_nxv16f16(<vscale x 16 x half> %va, half %b, <vscale x 16 x i1> %cond) {
177 ; CHECK-ZVFH-LABEL: vfmerge_fv_nxv16f16:
178 ; CHECK-ZVFH: # %bb.0:
179 ; CHECK-ZVFH-NEXT: vsetvli a0, zero, e16, m4, ta, ma
180 ; CHECK-ZVFH-NEXT: vfmerge.vfm v8, v8, fa0, v0
181 ; CHECK-ZVFH-NEXT: ret
183 ; CHECK-ZVFHMIN-LABEL: vfmerge_fv_nxv16f16:
184 ; CHECK-ZVFHMIN: # %bb.0:
185 ; CHECK-ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
186 ; CHECK-ZVFHMIN-NEXT: vsetvli a0, zero, e32, m8, ta, ma
187 ; CHECK-ZVFHMIN-NEXT: vfmv.v.f v16, fa5
188 ; CHECK-ZVFHMIN-NEXT: vsetvli zero, zero, e16, m4, ta, mu
189 ; CHECK-ZVFHMIN-NEXT: vfncvt.f.f.w v8, v16, v0.t
190 ; CHECK-ZVFHMIN-NEXT: ret
191 %head = insertelement <vscale x 16 x half> poison, half %b, i32 0
192 %splat = shufflevector <vscale x 16 x half> %head, <vscale x 16 x half> poison, <vscale x 16 x i32> zeroinitializer
193 %vc = select <vscale x 16 x i1> %cond, <vscale x 16 x half> %splat, <vscale x 16 x half> %va
194 ret <vscale x 16 x half> %vc
197 define <vscale x 32 x half> @vfmerge_vv_nxv32f16(<vscale x 32 x half> %va, <vscale x 32 x half> %vb, <vscale x 32 x i1> %cond) {
198 ; CHECK-LABEL: vfmerge_vv_nxv32f16:
200 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
201 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
203 %vc = select <vscale x 32 x i1> %cond, <vscale x 32 x half> %va, <vscale x 32 x half> %vb
204 ret <vscale x 32 x half> %vc
207 define <vscale x 32 x half> @vfmerge_fv_nxv32f16(<vscale x 32 x half> %va, half %b, <vscale x 32 x i1> %cond) {
208 ; CHECK-ZVFH-LABEL: vfmerge_fv_nxv32f16:
209 ; CHECK-ZVFH: # %bb.0:
210 ; CHECK-ZVFH-NEXT: vsetvli a0, zero, e16, m8, ta, ma
211 ; CHECK-ZVFH-NEXT: vfmerge.vfm v8, v8, fa0, v0
212 ; CHECK-ZVFH-NEXT: ret
214 ; CHECK-ZVFHMIN-LABEL: vfmerge_fv_nxv32f16:
215 ; CHECK-ZVFHMIN: # %bb.0:
216 ; CHECK-ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
217 ; CHECK-ZVFHMIN-NEXT: vsetvli a0, zero, e32, m8, ta, ma
218 ; CHECK-ZVFHMIN-NEXT: vfmv.v.f v24, fa5
219 ; CHECK-ZVFHMIN-NEXT: vsetvli zero, zero, e16, m4, ta, ma
220 ; CHECK-ZVFHMIN-NEXT: vfncvt.f.f.w v16, v24
221 ; CHECK-ZVFHMIN-NEXT: vmv.v.v v20, v16
222 ; CHECK-ZVFHMIN-NEXT: vsetvli a0, zero, e16, m8, ta, ma
223 ; CHECK-ZVFHMIN-NEXT: vmerge.vvm v8, v8, v16, v0
224 ; CHECK-ZVFHMIN-NEXT: ret
225 %head = insertelement <vscale x 32 x half> poison, half %b, i32 0
226 %splat = shufflevector <vscale x 32 x half> %head, <vscale x 32 x half> poison, <vscale x 32 x i32> zeroinitializer
227 %vc = select <vscale x 32 x i1> %cond, <vscale x 32 x half> %splat, <vscale x 32 x half> %va
228 ret <vscale x 32 x half> %vc
231 define <vscale x 1 x float> @vfmerge_vv_nxv1f32(<vscale x 1 x float> %va, <vscale x 1 x float> %vb, <vscale x 1 x i1> %cond) {
232 ; CHECK-LABEL: vfmerge_vv_nxv1f32:
234 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
235 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
237 %vc = select <vscale x 1 x i1> %cond, <vscale x 1 x float> %va, <vscale x 1 x float> %vb
238 ret <vscale x 1 x float> %vc
241 define <vscale x 1 x float> @vfmerge_fv_nxv1f32(<vscale x 1 x float> %va, float %b, <vscale x 1 x i1> %cond) {
242 ; CHECK-LABEL: vfmerge_fv_nxv1f32:
244 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
245 ; CHECK-NEXT: vfmerge.vfm v8, v8, fa0, v0
247 %head = insertelement <vscale x 1 x float> poison, float %b, i32 0
248 %splat = shufflevector <vscale x 1 x float> %head, <vscale x 1 x float> poison, <vscale x 1 x i32> zeroinitializer
249 %vc = select <vscale x 1 x i1> %cond, <vscale x 1 x float> %splat, <vscale x 1 x float> %va
250 ret <vscale x 1 x float> %vc
253 define <vscale x 2 x float> @vfmerge_vv_nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x float> %vb, <vscale x 2 x i1> %cond) {
254 ; CHECK-LABEL: vfmerge_vv_nxv2f32:
256 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
257 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
259 %vc = select <vscale x 2 x i1> %cond, <vscale x 2 x float> %va, <vscale x 2 x float> %vb
260 ret <vscale x 2 x float> %vc
263 define <vscale x 2 x float> @vfmerge_fv_nxv2f32(<vscale x 2 x float> %va, float %b, <vscale x 2 x i1> %cond) {
264 ; CHECK-LABEL: vfmerge_fv_nxv2f32:
266 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
267 ; CHECK-NEXT: vfmerge.vfm v8, v8, fa0, v0
269 %head = insertelement <vscale x 2 x float> poison, float %b, i32 0
270 %splat = shufflevector <vscale x 2 x float> %head, <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer
271 %vc = select <vscale x 2 x i1> %cond, <vscale x 2 x float> %splat, <vscale x 2 x float> %va
272 ret <vscale x 2 x float> %vc
275 define <vscale x 4 x float> @vfmerge_vv_nxv4f32(<vscale x 4 x float> %va, <vscale x 4 x float> %vb, <vscale x 4 x i1> %cond) {
276 ; CHECK-LABEL: vfmerge_vv_nxv4f32:
278 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
279 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
281 %vc = select <vscale x 4 x i1> %cond, <vscale x 4 x float> %va, <vscale x 4 x float> %vb
282 ret <vscale x 4 x float> %vc
285 define <vscale x 4 x float> @vfmerge_fv_nxv4f32(<vscale x 4 x float> %va, float %b, <vscale x 4 x i1> %cond) {
286 ; CHECK-LABEL: vfmerge_fv_nxv4f32:
288 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
289 ; CHECK-NEXT: vfmerge.vfm v8, v8, fa0, v0
291 %head = insertelement <vscale x 4 x float> poison, float %b, i32 0
292 %splat = shufflevector <vscale x 4 x float> %head, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
293 %vc = select <vscale x 4 x i1> %cond, <vscale x 4 x float> %splat, <vscale x 4 x float> %va
294 ret <vscale x 4 x float> %vc
297 define <vscale x 8 x float> @vfmerge_vv_nxv8f32(<vscale x 8 x float> %va, <vscale x 8 x float> %vb, <vscale x 8 x i1> %cond) {
298 ; CHECK-LABEL: vfmerge_vv_nxv8f32:
300 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
301 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
303 %vc = select <vscale x 8 x i1> %cond, <vscale x 8 x float> %va, <vscale x 8 x float> %vb
304 ret <vscale x 8 x float> %vc
307 define <vscale x 8 x float> @vfmerge_fv_nxv8f32(<vscale x 8 x float> %va, float %b, <vscale x 8 x i1> %cond) {
308 ; CHECK-LABEL: vfmerge_fv_nxv8f32:
310 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
311 ; CHECK-NEXT: vfmerge.vfm v8, v8, fa0, v0
313 %head = insertelement <vscale x 8 x float> poison, float %b, i32 0
314 %splat = shufflevector <vscale x 8 x float> %head, <vscale x 8 x float> poison, <vscale x 8 x i32> zeroinitializer
315 %vc = select <vscale x 8 x i1> %cond, <vscale x 8 x float> %splat, <vscale x 8 x float> %va
316 ret <vscale x 8 x float> %vc
319 define <vscale x 8 x float> @vfmerge_zv_nxv8f32(<vscale x 8 x float> %va, <vscale x 8 x i1> %cond) {
320 ; CHECK-LABEL: vfmerge_zv_nxv8f32:
322 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
323 ; CHECK-NEXT: vmerge.vim v8, v8, 0, v0
325 %head = insertelement <vscale x 8 x float> poison, float zeroinitializer, i32 0
326 %splat = shufflevector <vscale x 8 x float> %head, <vscale x 8 x float> poison, <vscale x 8 x i32> zeroinitializer
327 %vc = select <vscale x 8 x i1> %cond, <vscale x 8 x float> %splat, <vscale x 8 x float> %va
328 ret <vscale x 8 x float> %vc
331 define <vscale x 16 x float> @vfmerge_vv_nxv16f32(<vscale x 16 x float> %va, <vscale x 16 x float> %vb, <vscale x 16 x i1> %cond) {
332 ; CHECK-LABEL: vfmerge_vv_nxv16f32:
334 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
335 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
337 %vc = select <vscale x 16 x i1> %cond, <vscale x 16 x float> %va, <vscale x 16 x float> %vb
338 ret <vscale x 16 x float> %vc
341 define <vscale x 16 x float> @vfmerge_fv_nxv16f32(<vscale x 16 x float> %va, float %b, <vscale x 16 x i1> %cond) {
342 ; CHECK-LABEL: vfmerge_fv_nxv16f32:
344 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
345 ; CHECK-NEXT: vfmerge.vfm v8, v8, fa0, v0
347 %head = insertelement <vscale x 16 x float> poison, float %b, i32 0
348 %splat = shufflevector <vscale x 16 x float> %head, <vscale x 16 x float> poison, <vscale x 16 x i32> zeroinitializer
349 %vc = select <vscale x 16 x i1> %cond, <vscale x 16 x float> %splat, <vscale x 16 x float> %va
350 ret <vscale x 16 x float> %vc
353 define <vscale x 1 x double> @vfmerge_vv_nxv1f64(<vscale x 1 x double> %va, <vscale x 1 x double> %vb, <vscale x 1 x i1> %cond) {
354 ; CHECK-LABEL: vfmerge_vv_nxv1f64:
356 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
357 ; CHECK-NEXT: vmerge.vvm v8, v9, v8, v0
359 %vc = select <vscale x 1 x i1> %cond, <vscale x 1 x double> %va, <vscale x 1 x double> %vb
360 ret <vscale x 1 x double> %vc
363 define <vscale x 1 x double> @vfmerge_fv_nxv1f64(<vscale x 1 x double> %va, double %b, <vscale x 1 x i1> %cond) {
364 ; CHECK-LABEL: vfmerge_fv_nxv1f64:
366 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
367 ; CHECK-NEXT: vfmerge.vfm v8, v8, fa0, v0
369 %head = insertelement <vscale x 1 x double> poison, double %b, i32 0
370 %splat = shufflevector <vscale x 1 x double> %head, <vscale x 1 x double> poison, <vscale x 1 x i32> zeroinitializer
371 %vc = select <vscale x 1 x i1> %cond, <vscale x 1 x double> %splat, <vscale x 1 x double> %va
372 ret <vscale x 1 x double> %vc
375 define <vscale x 2 x double> @vfmerge_vv_nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x double> %vb, <vscale x 2 x i1> %cond) {
376 ; CHECK-LABEL: vfmerge_vv_nxv2f64:
378 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
379 ; CHECK-NEXT: vmerge.vvm v8, v10, v8, v0
381 %vc = select <vscale x 2 x i1> %cond, <vscale x 2 x double> %va, <vscale x 2 x double> %vb
382 ret <vscale x 2 x double> %vc
385 define <vscale x 2 x double> @vfmerge_fv_nxv2f64(<vscale x 2 x double> %va, double %b, <vscale x 2 x i1> %cond) {
386 ; CHECK-LABEL: vfmerge_fv_nxv2f64:
388 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
389 ; CHECK-NEXT: vfmerge.vfm v8, v8, fa0, v0
391 %head = insertelement <vscale x 2 x double> poison, double %b, i32 0
392 %splat = shufflevector <vscale x 2 x double> %head, <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
393 %vc = select <vscale x 2 x i1> %cond, <vscale x 2 x double> %splat, <vscale x 2 x double> %va
394 ret <vscale x 2 x double> %vc
397 define <vscale x 4 x double> @vfmerge_vv_nxv4f64(<vscale x 4 x double> %va, <vscale x 4 x double> %vb, <vscale x 4 x i1> %cond) {
398 ; CHECK-LABEL: vfmerge_vv_nxv4f64:
400 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
401 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
403 %vc = select <vscale x 4 x i1> %cond, <vscale x 4 x double> %va, <vscale x 4 x double> %vb
404 ret <vscale x 4 x double> %vc
407 define <vscale x 4 x double> @vfmerge_fv_nxv4f64(<vscale x 4 x double> %va, double %b, <vscale x 4 x i1> %cond) {
408 ; CHECK-LABEL: vfmerge_fv_nxv4f64:
410 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
411 ; CHECK-NEXT: vfmerge.vfm v8, v8, fa0, v0
413 %head = insertelement <vscale x 4 x double> poison, double %b, i32 0
414 %splat = shufflevector <vscale x 4 x double> %head, <vscale x 4 x double> poison, <vscale x 4 x i32> zeroinitializer
415 %vc = select <vscale x 4 x i1> %cond, <vscale x 4 x double> %splat, <vscale x 4 x double> %va
416 ret <vscale x 4 x double> %vc
419 define <vscale x 8 x double> @vfmerge_vv_nxv8f64(<vscale x 8 x double> %va, <vscale x 8 x double> %vb, <vscale x 8 x i1> %cond) {
420 ; CHECK-LABEL: vfmerge_vv_nxv8f64:
422 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
423 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
425 %vc = select <vscale x 8 x i1> %cond, <vscale x 8 x double> %va, <vscale x 8 x double> %vb
426 ret <vscale x 8 x double> %vc
429 define <vscale x 8 x double> @vfmerge_fv_nxv8f64(<vscale x 8 x double> %va, double %b, <vscale x 8 x i1> %cond) {
430 ; CHECK-LABEL: vfmerge_fv_nxv8f64:
432 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
433 ; CHECK-NEXT: vfmerge.vfm v8, v8, fa0, v0
435 %head = insertelement <vscale x 8 x double> poison, double %b, i32 0
436 %splat = shufflevector <vscale x 8 x double> %head, <vscale x 8 x double> poison, <vscale x 8 x i32> zeroinitializer
437 %vc = select <vscale x 8 x i1> %cond, <vscale x 8 x double> %splat, <vscale x 8 x double> %va
438 ret <vscale x 8 x double> %vc
441 define <vscale x 8 x double> @vfmerge_zv_nxv8f64(<vscale x 8 x double> %va, <vscale x 8 x i1> %cond) {
442 ; CHECK-LABEL: vfmerge_zv_nxv8f64:
444 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
445 ; CHECK-NEXT: vmerge.vim v8, v8, 0, v0
447 %head = insertelement <vscale x 8 x double> poison, double zeroinitializer, i32 0
448 %splat = shufflevector <vscale x 8 x double> %head, <vscale x 8 x double> poison, <vscale x 8 x i32> zeroinitializer
449 %vc = select <vscale x 8 x i1> %cond, <vscale x 8 x double> %splat, <vscale x 8 x double> %va
450 ret <vscale x 8 x double> %vc
453 define <vscale x 16 x double> @vselect_combine_regression(<vscale x 16 x i64> %va, <vscale x 16 x double> %vb) {
454 ; CHECK-LABEL: vselect_combine_regression:
456 ; CHECK-NEXT: addi sp, sp, -16
457 ; CHECK-NEXT: .cfi_def_cfa_offset 16
458 ; CHECK-NEXT: csrr a1, vlenb
459 ; CHECK-NEXT: slli a1, a1, 4
460 ; CHECK-NEXT: sub sp, sp, a1
461 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x10, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 16 * vlenb
462 ; CHECK-NEXT: addi a1, sp, 16
463 ; CHECK-NEXT: vs8r.v v8, (a1) # Unknown-size Folded Spill
464 ; CHECK-NEXT: csrr a1, vlenb
465 ; CHECK-NEXT: slli a1, a1, 3
466 ; CHECK-NEXT: add a1, a0, a1
467 ; CHECK-NEXT: vl8re64.v v8, (a1)
468 ; CHECK-NEXT: csrr a1, vlenb
469 ; CHECK-NEXT: slli a1, a1, 3
470 ; CHECK-NEXT: add a1, sp, a1
471 ; CHECK-NEXT: addi a1, a1, 16
472 ; CHECK-NEXT: vs8r.v v8, (a1) # Unknown-size Folded Spill
473 ; CHECK-NEXT: vl8re64.v v8, (a0)
474 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
475 ; CHECK-NEXT: vmseq.vi v24, v16, 0
476 ; CHECK-NEXT: addi a0, sp, 16
477 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
478 ; CHECK-NEXT: vmseq.vi v0, v16, 0
479 ; CHECK-NEXT: vmv.v.i v16, 0
480 ; CHECK-NEXT: vmerge.vvm v8, v16, v8, v0
481 ; CHECK-NEXT: vmv1r.v v0, v24
482 ; CHECK-NEXT: csrr a0, vlenb
483 ; CHECK-NEXT: slli a0, a0, 3
484 ; CHECK-NEXT: add a0, sp, a0
485 ; CHECK-NEXT: addi a0, a0, 16
486 ; CHECK-NEXT: vl8r.v v24, (a0) # Unknown-size Folded Reload
487 ; CHECK-NEXT: vmerge.vvm v16, v16, v24, v0
488 ; CHECK-NEXT: csrr a0, vlenb
489 ; CHECK-NEXT: slli a0, a0, 4
490 ; CHECK-NEXT: add sp, sp, a0
491 ; CHECK-NEXT: addi sp, sp, 16
493 %cond = icmp eq <vscale x 16 x i64> %va, zeroinitializer
494 %sel = select <vscale x 16 x i1> %cond, <vscale x 16 x double> %vb, <vscale x 16 x double> zeroinitializer
495 ret <vscale x 16 x double> %sel
498 define void @vselect_legalize_regression(<vscale x 16 x double> %a, <vscale x 16 x i1> %ma, <vscale x 16 x i1> %mb, <vscale x 16 x double>* %out) {
499 ; CHECK-LABEL: vselect_legalize_regression:
501 ; CHECK-NEXT: vsetvli a2, zero, e8, m2, ta, ma
502 ; CHECK-NEXT: vlm.v v24, (a0)
503 ; CHECK-NEXT: vmand.mm v1, v0, v24
504 ; CHECK-NEXT: csrr a0, vlenb
505 ; CHECK-NEXT: srli a2, a0, 3
506 ; CHECK-NEXT: vsetvli a3, zero, e8, mf4, ta, ma
507 ; CHECK-NEXT: vslidedown.vx v0, v1, a2
508 ; CHECK-NEXT: vsetvli a2, zero, e64, m8, ta, ma
509 ; CHECK-NEXT: vmv.v.i v24, 0
510 ; CHECK-NEXT: vmerge.vvm v16, v24, v16, v0
511 ; CHECK-NEXT: vmv1r.v v0, v1
512 ; CHECK-NEXT: vmerge.vvm v8, v24, v8, v0
513 ; CHECK-NEXT: vs8r.v v8, (a1)
514 ; CHECK-NEXT: slli a0, a0, 3
515 ; CHECK-NEXT: add a0, a1, a0
516 ; CHECK-NEXT: vs8r.v v16, (a0)
518 %cond = and <vscale x 16 x i1> %ma, %mb
519 %sel = select <vscale x 16 x i1> %cond, <vscale x 16 x double> %a, <vscale x 16 x double> zeroinitializer
520 store <vscale x 16 x double> %sel, <vscale x 16 x double>* %out