1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs -riscv-v-vector-bits-min=128 \
3 ; RUN: < %s | FileCheck %s
5 declare <2 x i1> @llvm.experimental.vp.splice.v2i1(<2 x i1>, <2 x i1>, i32, <2 x i1>, i32, i32)
6 declare <4 x i1> @llvm.experimental.vp.splice.v4i1(<4 x i1>, <4 x i1>, i32, <4 x i1>, i32, i32)
7 declare <8 x i1> @llvm.experimental.vp.splice.v8i1(<8 x i1>, <8 x i1>, i32, <8 x i1>, i32, i32)
8 declare <16 x i1> @llvm.experimental.vp.splice.v16i1(<16 x i1>, <16 x i1>, i32, <16 x i1>, i32, i32)
10 define <2 x i1> @test_vp_splice_v2i1(<2 x i1> %va, <2 x i1> %vb, i32 zeroext %evla, i32 zeroext %evlb) {
11 ; CHECK-LABEL: test_vp_splice_v2i1:
13 ; CHECK-NEXT: vmv1r.v v9, v0
14 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
15 ; CHECK-NEXT: vmv.v.i v10, 0
16 ; CHECK-NEXT: vmv1r.v v0, v8
17 ; CHECK-NEXT: vmerge.vim v8, v10, 1, v0
18 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
19 ; CHECK-NEXT: vmv.v.i v10, 0
20 ; CHECK-NEXT: vmv1r.v v0, v9
21 ; CHECK-NEXT: vmerge.vim v9, v10, 1, v0
22 ; CHECK-NEXT: addi a0, a0, -5
23 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
24 ; CHECK-NEXT: vslidedown.vi v9, v9, 5
25 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
26 ; CHECK-NEXT: vslideup.vx v9, v8, a0
27 ; CHECK-NEXT: vmsne.vi v0, v9, 0
29 %head = insertelement <2 x i1> undef, i1 1, i32 0
30 %allones = shufflevector <2 x i1> %head, <2 x i1> undef, <2 x i32> zeroinitializer
32 %v = call <2 x i1> @llvm.experimental.vp.splice.v2i1(<2 x i1> %va, <2 x i1> %vb, i32 5, <2 x i1> %allones, i32 %evla, i32 %evlb)
36 define <2 x i1> @test_vp_splice_v2i1_negative_offset(<2 x i1> %va, <2 x i1> %vb, i32 zeroext %evla, i32 zeroext %evlb) {
37 ; CHECK-LABEL: test_vp_splice_v2i1_negative_offset:
39 ; CHECK-NEXT: vmv1r.v v9, v0
40 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
41 ; CHECK-NEXT: vmv.v.i v10, 0
42 ; CHECK-NEXT: vmv1r.v v0, v8
43 ; CHECK-NEXT: vmerge.vim v8, v10, 1, v0
44 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
45 ; CHECK-NEXT: vmv.v.i v10, 0
46 ; CHECK-NEXT: vmv1r.v v0, v9
47 ; CHECK-NEXT: vmerge.vim v9, v10, 1, v0
48 ; CHECK-NEXT: addi a0, a0, -5
49 ; CHECK-NEXT: vsetivli zero, 5, e8, mf8, ta, ma
50 ; CHECK-NEXT: vslidedown.vx v9, v9, a0
51 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
52 ; CHECK-NEXT: vslideup.vi v9, v8, 5
53 ; CHECK-NEXT: vmsne.vi v0, v9, 0
55 %head = insertelement <2 x i1> undef, i1 1, i32 0
56 %allones = shufflevector <2 x i1> %head, <2 x i1> undef, <2 x i32> zeroinitializer
58 %v = call <2 x i1> @llvm.experimental.vp.splice.v2i1(<2 x i1> %va, <2 x i1> %vb, i32 -5, <2 x i1> %allones, i32 %evla, i32 %evlb)
62 define <2 x i1> @test_vp_splice_v2i1_masked(<2 x i1> %va, <2 x i1> %vb, <2 x i1> %mask, i32 zeroext %evla, i32 zeroext %evlb) {
63 ; CHECK-LABEL: test_vp_splice_v2i1_masked:
65 ; CHECK-NEXT: vmv1r.v v10, v0
66 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
67 ; CHECK-NEXT: vmv.v.i v11, 0
68 ; CHECK-NEXT: vmv1r.v v0, v8
69 ; CHECK-NEXT: vmerge.vim v8, v11, 1, v0
70 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
71 ; CHECK-NEXT: vmv.v.i v11, 0
72 ; CHECK-NEXT: vmv1r.v v0, v10
73 ; CHECK-NEXT: vmerge.vim v10, v11, 1, v0
74 ; CHECK-NEXT: addi a0, a0, -5
75 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
76 ; CHECK-NEXT: vmv1r.v v0, v9
77 ; CHECK-NEXT: vslidedown.vi v10, v10, 5, v0.t
78 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, mu
79 ; CHECK-NEXT: vslideup.vx v10, v8, a0, v0.t
80 ; CHECK-NEXT: vsetvli zero, zero, e8, mf8, ta, ma
81 ; CHECK-NEXT: vmsne.vi v0, v10, 0, v0.t
83 %v = call <2 x i1> @llvm.experimental.vp.splice.v2i1(<2 x i1> %va, <2 x i1> %vb, i32 5, <2 x i1> %mask, i32 %evla, i32 %evlb)
87 define <4 x i1> @test_vp_splice_v4i1(<4 x i1> %va, <4 x i1> %vb, i32 zeroext %evla, i32 zeroext %evlb) {
88 ; CHECK-LABEL: test_vp_splice_v4i1:
90 ; CHECK-NEXT: vmv1r.v v9, v0
91 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
92 ; CHECK-NEXT: vmv.v.i v10, 0
93 ; CHECK-NEXT: vmv1r.v v0, v8
94 ; CHECK-NEXT: vmerge.vim v8, v10, 1, v0
95 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
96 ; CHECK-NEXT: vmv.v.i v10, 0
97 ; CHECK-NEXT: vmv1r.v v0, v9
98 ; CHECK-NEXT: vmerge.vim v9, v10, 1, v0
99 ; CHECK-NEXT: addi a0, a0, -5
100 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
101 ; CHECK-NEXT: vslidedown.vi v9, v9, 5
102 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
103 ; CHECK-NEXT: vslideup.vx v9, v8, a0
104 ; CHECK-NEXT: vmsne.vi v0, v9, 0
106 %head = insertelement <4 x i1> undef, i1 1, i32 0
107 %allones = shufflevector <4 x i1> %head, <4 x i1> undef, <4 x i32> zeroinitializer
109 %v = call <4 x i1> @llvm.experimental.vp.splice.v4i1(<4 x i1> %va, <4 x i1> %vb, i32 5, <4 x i1> %allones, i32 %evla, i32 %evlb)
113 define <4 x i1> @test_vp_splice_v4i1_negative_offset(<4 x i1> %va, <4 x i1> %vb, i32 zeroext %evla, i32 zeroext %evlb) {
114 ; CHECK-LABEL: test_vp_splice_v4i1_negative_offset:
116 ; CHECK-NEXT: vmv1r.v v9, v0
117 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
118 ; CHECK-NEXT: vmv.v.i v10, 0
119 ; CHECK-NEXT: vmv1r.v v0, v8
120 ; CHECK-NEXT: vmerge.vim v8, v10, 1, v0
121 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
122 ; CHECK-NEXT: vmv.v.i v10, 0
123 ; CHECK-NEXT: vmv1r.v v0, v9
124 ; CHECK-NEXT: vmerge.vim v9, v10, 1, v0
125 ; CHECK-NEXT: addi a0, a0, -5
126 ; CHECK-NEXT: vsetivli zero, 5, e8, mf4, ta, ma
127 ; CHECK-NEXT: vslidedown.vx v9, v9, a0
128 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
129 ; CHECK-NEXT: vslideup.vi v9, v8, 5
130 ; CHECK-NEXT: vmsne.vi v0, v9, 0
132 %head = insertelement <4 x i1> undef, i1 1, i32 0
133 %allones = shufflevector <4 x i1> %head, <4 x i1> undef, <4 x i32> zeroinitializer
135 %v = call <4 x i1> @llvm.experimental.vp.splice.v4i1(<4 x i1> %va, <4 x i1> %vb, i32 -5, <4 x i1> %allones, i32 %evla, i32 %evlb)
139 define <4 x i1> @test_vp_splice_v4i1_masked(<4 x i1> %va, <4 x i1> %vb, <4 x i1> %mask, i32 zeroext %evla, i32 zeroext %evlb) {
140 ; CHECK-LABEL: test_vp_splice_v4i1_masked:
142 ; CHECK-NEXT: vmv1r.v v10, v0
143 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
144 ; CHECK-NEXT: vmv.v.i v11, 0
145 ; CHECK-NEXT: vmv1r.v v0, v8
146 ; CHECK-NEXT: vmerge.vim v8, v11, 1, v0
147 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
148 ; CHECK-NEXT: vmv.v.i v11, 0
149 ; CHECK-NEXT: vmv1r.v v0, v10
150 ; CHECK-NEXT: vmerge.vim v10, v11, 1, v0
151 ; CHECK-NEXT: addi a0, a0, -5
152 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
153 ; CHECK-NEXT: vmv1r.v v0, v9
154 ; CHECK-NEXT: vslidedown.vi v10, v10, 5, v0.t
155 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, mu
156 ; CHECK-NEXT: vslideup.vx v10, v8, a0, v0.t
157 ; CHECK-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
158 ; CHECK-NEXT: vmsne.vi v0, v10, 0, v0.t
160 %v = call <4 x i1> @llvm.experimental.vp.splice.v4i1(<4 x i1> %va, <4 x i1> %vb, i32 5, <4 x i1> %mask, i32 %evla, i32 %evlb)
164 define <8 x i1> @test_vp_splice_v8i1(<8 x i1> %va, <8 x i1> %vb, i32 zeroext %evla, i32 zeroext %evlb) {
165 ; CHECK-LABEL: test_vp_splice_v8i1:
167 ; CHECK-NEXT: vmv1r.v v9, v0
168 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
169 ; CHECK-NEXT: vmv.v.i v10, 0
170 ; CHECK-NEXT: vmv1r.v v0, v8
171 ; CHECK-NEXT: vmerge.vim v8, v10, 1, v0
172 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
173 ; CHECK-NEXT: vmv.v.i v10, 0
174 ; CHECK-NEXT: vmv1r.v v0, v9
175 ; CHECK-NEXT: vmerge.vim v9, v10, 1, v0
176 ; CHECK-NEXT: addi a0, a0, -5
177 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
178 ; CHECK-NEXT: vslidedown.vi v9, v9, 5
179 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
180 ; CHECK-NEXT: vslideup.vx v9, v8, a0
181 ; CHECK-NEXT: vmsne.vi v0, v9, 0
183 %head = insertelement <8 x i1> undef, i1 1, i32 0
184 %allones = shufflevector <8 x i1> %head, <8 x i1> undef, <8 x i32> zeroinitializer
186 %v = call <8 x i1> @llvm.experimental.vp.splice.v8i1(<8 x i1> %va, <8 x i1> %vb, i32 5, <8 x i1> %allones, i32 %evla, i32 %evlb)
190 define <8 x i1> @test_vp_splice_v8i1_negative_offset(<8 x i1> %va, <8 x i1> %vb, i32 zeroext %evla, i32 zeroext %evlb) {
191 ; CHECK-LABEL: test_vp_splice_v8i1_negative_offset:
193 ; CHECK-NEXT: vmv1r.v v9, v0
194 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
195 ; CHECK-NEXT: vmv.v.i v10, 0
196 ; CHECK-NEXT: vmv1r.v v0, v8
197 ; CHECK-NEXT: vmerge.vim v8, v10, 1, v0
198 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
199 ; CHECK-NEXT: vmv.v.i v10, 0
200 ; CHECK-NEXT: vmv1r.v v0, v9
201 ; CHECK-NEXT: vmerge.vim v9, v10, 1, v0
202 ; CHECK-NEXT: addi a0, a0, -5
203 ; CHECK-NEXT: vsetivli zero, 5, e8, mf2, ta, ma
204 ; CHECK-NEXT: vslidedown.vx v9, v9, a0
205 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
206 ; CHECK-NEXT: vslideup.vi v9, v8, 5
207 ; CHECK-NEXT: vmsne.vi v0, v9, 0
209 %head = insertelement <8 x i1> undef, i1 1, i32 0
210 %allones = shufflevector <8 x i1> %head, <8 x i1> undef, <8 x i32> zeroinitializer
212 %v = call <8 x i1> @llvm.experimental.vp.splice.v8i1(<8 x i1> %va, <8 x i1> %vb, i32 -5, <8 x i1> %allones, i32 %evla, i32 %evlb)
216 define <8 x i1> @test_vp_splice_v8i1_masked(<8 x i1> %va, <8 x i1> %vb, <8 x i1> %mask, i32 zeroext %evla, i32 zeroext %evlb) {
217 ; CHECK-LABEL: test_vp_splice_v8i1_masked:
219 ; CHECK-NEXT: vmv1r.v v10, v0
220 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
221 ; CHECK-NEXT: vmv.v.i v11, 0
222 ; CHECK-NEXT: vmv1r.v v0, v8
223 ; CHECK-NEXT: vmerge.vim v8, v11, 1, v0
224 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
225 ; CHECK-NEXT: vmv.v.i v11, 0
226 ; CHECK-NEXT: vmv1r.v v0, v10
227 ; CHECK-NEXT: vmerge.vim v10, v11, 1, v0
228 ; CHECK-NEXT: addi a0, a0, -5
229 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
230 ; CHECK-NEXT: vmv1r.v v0, v9
231 ; CHECK-NEXT: vslidedown.vi v10, v10, 5, v0.t
232 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, mu
233 ; CHECK-NEXT: vslideup.vx v10, v8, a0, v0.t
234 ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
235 ; CHECK-NEXT: vmsne.vi v0, v10, 0, v0.t
237 %v = call <8 x i1> @llvm.experimental.vp.splice.v8i1(<8 x i1> %va, <8 x i1> %vb, i32 5, <8 x i1> %mask, i32 %evla, i32 %evlb)
241 define <16 x i1> @test_vp_splice_v16i1(<16 x i1> %va, <16 x i1> %vb, i32 zeroext %evla, i32 zeroext %evlb) {
242 ; CHECK-LABEL: test_vp_splice_v16i1:
244 ; CHECK-NEXT: vmv1r.v v9, v0
245 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
246 ; CHECK-NEXT: vmv.v.i v10, 0
247 ; CHECK-NEXT: vmv1r.v v0, v8
248 ; CHECK-NEXT: vmerge.vim v8, v10, 1, v0
249 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
250 ; CHECK-NEXT: vmv.v.i v10, 0
251 ; CHECK-NEXT: vmv1r.v v0, v9
252 ; CHECK-NEXT: vmerge.vim v9, v10, 1, v0
253 ; CHECK-NEXT: addi a0, a0, -5
254 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
255 ; CHECK-NEXT: vslidedown.vi v9, v9, 5
256 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
257 ; CHECK-NEXT: vslideup.vx v9, v8, a0
258 ; CHECK-NEXT: vmsne.vi v0, v9, 0
260 %head = insertelement <16 x i1> undef, i1 1, i32 0
261 %allones = shufflevector <16 x i1> %head, <16 x i1> undef, <16 x i32> zeroinitializer
263 %v = call <16 x i1> @llvm.experimental.vp.splice.v16i1(<16 x i1> %va, <16 x i1> %vb, i32 5, <16 x i1> %allones, i32 %evla, i32 %evlb)
267 define <16 x i1> @test_vp_splice_v16i1_negative_offset(<16 x i1> %va, <16 x i1> %vb, i32 zeroext %evla, i32 zeroext %evlb) {
268 ; CHECK-LABEL: test_vp_splice_v16i1_negative_offset:
270 ; CHECK-NEXT: vmv1r.v v9, v0
271 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
272 ; CHECK-NEXT: vmv.v.i v10, 0
273 ; CHECK-NEXT: vmv1r.v v0, v8
274 ; CHECK-NEXT: vmerge.vim v8, v10, 1, v0
275 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
276 ; CHECK-NEXT: vmv.v.i v10, 0
277 ; CHECK-NEXT: vmv1r.v v0, v9
278 ; CHECK-NEXT: vmerge.vim v9, v10, 1, v0
279 ; CHECK-NEXT: addi a0, a0, -5
280 ; CHECK-NEXT: vsetivli zero, 5, e8, m1, ta, ma
281 ; CHECK-NEXT: vslidedown.vx v9, v9, a0
282 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
283 ; CHECK-NEXT: vslideup.vi v9, v8, 5
284 ; CHECK-NEXT: vmsne.vi v0, v9, 0
286 %head = insertelement <16 x i1> undef, i1 1, i32 0
287 %allones = shufflevector <16 x i1> %head, <16 x i1> undef, <16 x i32> zeroinitializer
289 %v = call <16 x i1> @llvm.experimental.vp.splice.v16i1(<16 x i1> %va, <16 x i1> %vb, i32 -5, <16 x i1> %allones, i32 %evla, i32 %evlb)
293 define <16 x i1> @test_vp_splice_v16i1_masked(<16 x i1> %va, <16 x i1> %vb, <16 x i1> %mask, i32 zeroext %evla, i32 zeroext %evlb) {
294 ; CHECK-LABEL: test_vp_splice_v16i1_masked:
296 ; CHECK-NEXT: vmv1r.v v10, v0
297 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
298 ; CHECK-NEXT: vmv.v.i v11, 0
299 ; CHECK-NEXT: vmv1r.v v0, v8
300 ; CHECK-NEXT: vmerge.vim v8, v11, 1, v0
301 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
302 ; CHECK-NEXT: vmv.v.i v11, 0
303 ; CHECK-NEXT: vmv1r.v v0, v10
304 ; CHECK-NEXT: vmerge.vim v10, v11, 1, v0
305 ; CHECK-NEXT: addi a0, a0, -5
306 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
307 ; CHECK-NEXT: vmv1r.v v0, v9
308 ; CHECK-NEXT: vslidedown.vi v10, v10, 5, v0.t
309 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, mu
310 ; CHECK-NEXT: vslideup.vx v10, v8, a0, v0.t
311 ; CHECK-NEXT: vsetvli zero, zero, e8, m1, ta, ma
312 ; CHECK-NEXT: vmsne.vi v0, v10, 0, v0.t
314 %v = call <16 x i1> @llvm.experimental.vp.splice.v16i1(<16 x i1> %va, <16 x i1> %vb, i32 5, <16 x i1> %mask, i32 %evla, i32 %evlb)