1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV32
3 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV64
5 define <vscale x 1 x i8> @vrsub_vx_nxv1i8(<vscale x 1 x i8> %va, i8 signext %b) {
6 ; CHECK-LABEL: vrsub_vx_nxv1i8:
8 ; CHECK-NEXT: vsetvli a1, zero, e8, mf8, ta, ma
9 ; CHECK-NEXT: vrsub.vx v8, v8, a0
11 %head = insertelement <vscale x 1 x i8> poison, i8 %b, i32 0
12 %splat = shufflevector <vscale x 1 x i8> %head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
13 %vc = sub <vscale x 1 x i8> %splat, %va
14 ret <vscale x 1 x i8> %vc
17 define <vscale x 1 x i8> @vrsub_vi_nxv1i8_0(<vscale x 1 x i8> %va) {
18 ; CHECK-LABEL: vrsub_vi_nxv1i8_0:
20 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
21 ; CHECK-NEXT: vrsub.vi v8, v8, -4
23 %vc = sub <vscale x 1 x i8> splat (i8 -4), %va
24 ret <vscale x 1 x i8> %vc
27 define <vscale x 2 x i8> @vrsub_vx_nxv2i8(<vscale x 2 x i8> %va, i8 signext %b) {
28 ; CHECK-LABEL: vrsub_vx_nxv2i8:
30 ; CHECK-NEXT: vsetvli a1, zero, e8, mf4, ta, ma
31 ; CHECK-NEXT: vrsub.vx v8, v8, a0
33 %head = insertelement <vscale x 2 x i8> poison, i8 %b, i32 0
34 %splat = shufflevector <vscale x 2 x i8> %head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
35 %vc = sub <vscale x 2 x i8> %splat, %va
36 ret <vscale x 2 x i8> %vc
39 define <vscale x 2 x i8> @vrsub_vi_nxv2i8_0(<vscale x 2 x i8> %va) {
40 ; CHECK-LABEL: vrsub_vi_nxv2i8_0:
42 ; CHECK-NEXT: vsetvli a0, zero, e8, mf4, ta, ma
43 ; CHECK-NEXT: vrsub.vi v8, v8, -4
45 %vc = sub <vscale x 2 x i8> splat (i8 -4), %va
46 ret <vscale x 2 x i8> %vc
49 define <vscale x 4 x i8> @vrsub_vx_nxv4i8(<vscale x 4 x i8> %va, i8 signext %b) {
50 ; CHECK-LABEL: vrsub_vx_nxv4i8:
52 ; CHECK-NEXT: vsetvli a1, zero, e8, mf2, ta, ma
53 ; CHECK-NEXT: vrsub.vx v8, v8, a0
55 %head = insertelement <vscale x 4 x i8> poison, i8 %b, i32 0
56 %splat = shufflevector <vscale x 4 x i8> %head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
57 %vc = sub <vscale x 4 x i8> %splat, %va
58 ret <vscale x 4 x i8> %vc
61 define <vscale x 4 x i8> @vrsub_vi_nxv4i8_0(<vscale x 4 x i8> %va) {
62 ; CHECK-LABEL: vrsub_vi_nxv4i8_0:
64 ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
65 ; CHECK-NEXT: vrsub.vi v8, v8, -4
67 %vc = sub <vscale x 4 x i8> splat (i8 -4), %va
68 ret <vscale x 4 x i8> %vc
71 define <vscale x 8 x i8> @vrsub_vx_nxv8i8(<vscale x 8 x i8> %va, i8 signext %b) {
72 ; CHECK-LABEL: vrsub_vx_nxv8i8:
74 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
75 ; CHECK-NEXT: vrsub.vx v8, v8, a0
77 %head = insertelement <vscale x 8 x i8> poison, i8 %b, i32 0
78 %splat = shufflevector <vscale x 8 x i8> %head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
79 %vc = sub <vscale x 8 x i8> %splat, %va
80 ret <vscale x 8 x i8> %vc
83 define <vscale x 8 x i8> @vrsub_vi_nxv8i8_0(<vscale x 8 x i8> %va) {
84 ; CHECK-LABEL: vrsub_vi_nxv8i8_0:
86 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
87 ; CHECK-NEXT: vrsub.vi v8, v8, -4
89 %vc = sub <vscale x 8 x i8> splat (i8 -4), %va
90 ret <vscale x 8 x i8> %vc
93 define <vscale x 16 x i8> @vrsub_vx_nxv16i8(<vscale x 16 x i8> %va, i8 signext %b) {
94 ; CHECK-LABEL: vrsub_vx_nxv16i8:
96 ; CHECK-NEXT: vsetvli a1, zero, e8, m2, ta, ma
97 ; CHECK-NEXT: vrsub.vx v8, v8, a0
99 %head = insertelement <vscale x 16 x i8> poison, i8 %b, i32 0
100 %splat = shufflevector <vscale x 16 x i8> %head, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
101 %vc = sub <vscale x 16 x i8> %splat, %va
102 ret <vscale x 16 x i8> %vc
105 define <vscale x 16 x i8> @vrsub_vi_nxv16i8_0(<vscale x 16 x i8> %va) {
106 ; CHECK-LABEL: vrsub_vi_nxv16i8_0:
108 ; CHECK-NEXT: vsetvli a0, zero, e8, m2, ta, ma
109 ; CHECK-NEXT: vrsub.vi v8, v8, -4
111 %vc = sub <vscale x 16 x i8> splat (i8 -4), %va
112 ret <vscale x 16 x i8> %vc
115 define <vscale x 32 x i8> @vrsub_vx_nxv32i8(<vscale x 32 x i8> %va, i8 signext %b) {
116 ; CHECK-LABEL: vrsub_vx_nxv32i8:
118 ; CHECK-NEXT: vsetvli a1, zero, e8, m4, ta, ma
119 ; CHECK-NEXT: vrsub.vx v8, v8, a0
121 %head = insertelement <vscale x 32 x i8> poison, i8 %b, i32 0
122 %splat = shufflevector <vscale x 32 x i8> %head, <vscale x 32 x i8> poison, <vscale x 32 x i32> zeroinitializer
123 %vc = sub <vscale x 32 x i8> %splat, %va
124 ret <vscale x 32 x i8> %vc
127 define <vscale x 32 x i8> @vrsub_vi_nxv32i8_0(<vscale x 32 x i8> %va) {
128 ; CHECK-LABEL: vrsub_vi_nxv32i8_0:
130 ; CHECK-NEXT: vsetvli a0, zero, e8, m4, ta, ma
131 ; CHECK-NEXT: vrsub.vi v8, v8, -4
133 %vc = sub <vscale x 32 x i8> splat (i8 -4), %va
134 ret <vscale x 32 x i8> %vc
137 define <vscale x 64 x i8> @vrsub_vx_nxv64i8(<vscale x 64 x i8> %va, i8 signext %b) {
138 ; CHECK-LABEL: vrsub_vx_nxv64i8:
140 ; CHECK-NEXT: vsetvli a1, zero, e8, m8, ta, ma
141 ; CHECK-NEXT: vrsub.vx v8, v8, a0
143 %head = insertelement <vscale x 64 x i8> poison, i8 %b, i32 0
144 %splat = shufflevector <vscale x 64 x i8> %head, <vscale x 64 x i8> poison, <vscale x 64 x i32> zeroinitializer
145 %vc = sub <vscale x 64 x i8> %splat, %va
146 ret <vscale x 64 x i8> %vc
149 define <vscale x 64 x i8> @vrsub_vi_nxv64i8_0(<vscale x 64 x i8> %va) {
150 ; CHECK-LABEL: vrsub_vi_nxv64i8_0:
152 ; CHECK-NEXT: vsetvli a0, zero, e8, m8, ta, ma
153 ; CHECK-NEXT: vrsub.vi v8, v8, -4
155 %vc = sub <vscale x 64 x i8> splat (i8 -4), %va
156 ret <vscale x 64 x i8> %vc
159 define <vscale x 1 x i16> @vrsub_vx_nxv1i16(<vscale x 1 x i16> %va, i16 signext %b) {
160 ; CHECK-LABEL: vrsub_vx_nxv1i16:
162 ; CHECK-NEXT: vsetvli a1, zero, e16, mf4, ta, ma
163 ; CHECK-NEXT: vrsub.vx v8, v8, a0
165 %head = insertelement <vscale x 1 x i16> poison, i16 %b, i32 0
166 %splat = shufflevector <vscale x 1 x i16> %head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
167 %vc = sub <vscale x 1 x i16> %splat, %va
168 ret <vscale x 1 x i16> %vc
171 define <vscale x 1 x i16> @vrsub_vi_nxv1i16_0(<vscale x 1 x i16> %va) {
172 ; CHECK-LABEL: vrsub_vi_nxv1i16_0:
174 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
175 ; CHECK-NEXT: vrsub.vi v8, v8, -4
177 %vc = sub <vscale x 1 x i16> splat (i16 -4), %va
178 ret <vscale x 1 x i16> %vc
181 define <vscale x 2 x i16> @vrsub_vx_nxv2i16(<vscale x 2 x i16> %va, i16 signext %b) {
182 ; CHECK-LABEL: vrsub_vx_nxv2i16:
184 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
185 ; CHECK-NEXT: vrsub.vx v8, v8, a0
187 %head = insertelement <vscale x 2 x i16> poison, i16 %b, i32 0
188 %splat = shufflevector <vscale x 2 x i16> %head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
189 %vc = sub <vscale x 2 x i16> %splat, %va
190 ret <vscale x 2 x i16> %vc
193 define <vscale x 2 x i16> @vrsub_vi_nxv2i16_0(<vscale x 2 x i16> %va) {
194 ; CHECK-LABEL: vrsub_vi_nxv2i16_0:
196 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
197 ; CHECK-NEXT: vrsub.vi v8, v8, -4
199 %vc = sub <vscale x 2 x i16> splat (i16 -4), %va
200 ret <vscale x 2 x i16> %vc
203 define <vscale x 4 x i16> @vrsub_vx_nxv4i16(<vscale x 4 x i16> %va, i16 signext %b) {
204 ; CHECK-LABEL: vrsub_vx_nxv4i16:
206 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
207 ; CHECK-NEXT: vrsub.vx v8, v8, a0
209 %head = insertelement <vscale x 4 x i16> poison, i16 %b, i32 0
210 %splat = shufflevector <vscale x 4 x i16> %head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
211 %vc = sub <vscale x 4 x i16> %splat, %va
212 ret <vscale x 4 x i16> %vc
215 define <vscale x 4 x i16> @vrsub_vi_nxv4i16_0(<vscale x 4 x i16> %va) {
216 ; CHECK-LABEL: vrsub_vi_nxv4i16_0:
218 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
219 ; CHECK-NEXT: vrsub.vi v8, v8, -4
221 %vc = sub <vscale x 4 x i16> splat (i16 -4), %va
222 ret <vscale x 4 x i16> %vc
225 define <vscale x 8 x i16> @vrsub_vx_nxv8i16(<vscale x 8 x i16> %va, i16 signext %b) {
226 ; CHECK-LABEL: vrsub_vx_nxv8i16:
228 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
229 ; CHECK-NEXT: vrsub.vx v8, v8, a0
231 %head = insertelement <vscale x 8 x i16> poison, i16 %b, i32 0
232 %splat = shufflevector <vscale x 8 x i16> %head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
233 %vc = sub <vscale x 8 x i16> %splat, %va
234 ret <vscale x 8 x i16> %vc
237 define <vscale x 8 x i16> @vrsub_vi_nxv8i16_0(<vscale x 8 x i16> %va) {
238 ; CHECK-LABEL: vrsub_vi_nxv8i16_0:
240 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
241 ; CHECK-NEXT: vrsub.vi v8, v8, -4
243 %vc = sub <vscale x 8 x i16> splat (i16 -4), %va
244 ret <vscale x 8 x i16> %vc
247 define <vscale x 16 x i16> @vrsub_vx_nxv16i16(<vscale x 16 x i16> %va, i16 signext %b) {
248 ; CHECK-LABEL: vrsub_vx_nxv16i16:
250 ; CHECK-NEXT: vsetvli a1, zero, e16, m4, ta, ma
251 ; CHECK-NEXT: vrsub.vx v8, v8, a0
253 %head = insertelement <vscale x 16 x i16> poison, i16 %b, i32 0
254 %splat = shufflevector <vscale x 16 x i16> %head, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
255 %vc = sub <vscale x 16 x i16> %splat, %va
256 ret <vscale x 16 x i16> %vc
259 define <vscale x 16 x i16> @vrsub_vi_nxv16i16_0(<vscale x 16 x i16> %va) {
260 ; CHECK-LABEL: vrsub_vi_nxv16i16_0:
262 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
263 ; CHECK-NEXT: vrsub.vi v8, v8, -4
265 %vc = sub <vscale x 16 x i16> splat (i16 -4), %va
266 ret <vscale x 16 x i16> %vc
269 define <vscale x 32 x i16> @vrsub_vx_nxv32i16(<vscale x 32 x i16> %va, i16 signext %b) {
270 ; CHECK-LABEL: vrsub_vx_nxv32i16:
272 ; CHECK-NEXT: vsetvli a1, zero, e16, m8, ta, ma
273 ; CHECK-NEXT: vrsub.vx v8, v8, a0
275 %head = insertelement <vscale x 32 x i16> poison, i16 %b, i32 0
276 %splat = shufflevector <vscale x 32 x i16> %head, <vscale x 32 x i16> poison, <vscale x 32 x i32> zeroinitializer
277 %vc = sub <vscale x 32 x i16> %splat, %va
278 ret <vscale x 32 x i16> %vc
281 define <vscale x 32 x i16> @vrsub_vi_nxv32i16_0(<vscale x 32 x i16> %va) {
282 ; CHECK-LABEL: vrsub_vi_nxv32i16_0:
284 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
285 ; CHECK-NEXT: vrsub.vi v8, v8, -4
287 %vc = sub <vscale x 32 x i16> splat (i16 -4), %va
288 ret <vscale x 32 x i16> %vc
291 define <vscale x 1 x i32> @vrsub_vx_nxv1i32(<vscale x 1 x i32> %va, i32 signext %b) {
292 ; CHECK-LABEL: vrsub_vx_nxv1i32:
294 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
295 ; CHECK-NEXT: vrsub.vx v8, v8, a0
297 %head = insertelement <vscale x 1 x i32> poison, i32 %b, i32 0
298 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
299 %vc = sub <vscale x 1 x i32> %splat, %va
300 ret <vscale x 1 x i32> %vc
303 define <vscale x 1 x i32> @vrsub_vi_nxv1i32_0(<vscale x 1 x i32> %va) {
304 ; CHECK-LABEL: vrsub_vi_nxv1i32_0:
306 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
307 ; CHECK-NEXT: vrsub.vi v8, v8, -4
309 %vc = sub <vscale x 1 x i32> splat (i32 -4), %va
310 ret <vscale x 1 x i32> %vc
313 define <vscale x 2 x i32> @vrsub_vx_nxv2i32(<vscale x 2 x i32> %va, i32 signext %b) {
314 ; CHECK-LABEL: vrsub_vx_nxv2i32:
316 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
317 ; CHECK-NEXT: vrsub.vx v8, v8, a0
319 %head = insertelement <vscale x 2 x i32> poison, i32 %b, i32 0
320 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
321 %vc = sub <vscale x 2 x i32> %splat, %va
322 ret <vscale x 2 x i32> %vc
325 define <vscale x 2 x i32> @vrsub_vi_nxv2i32_0(<vscale x 2 x i32> %va) {
326 ; CHECK-LABEL: vrsub_vi_nxv2i32_0:
328 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
329 ; CHECK-NEXT: vrsub.vi v8, v8, -4
331 %vc = sub <vscale x 2 x i32> splat (i32 -4), %va
332 ret <vscale x 2 x i32> %vc
335 define <vscale x 4 x i32> @vrsub_vx_nxv4i32(<vscale x 4 x i32> %va, i32 signext %b) {
336 ; CHECK-LABEL: vrsub_vx_nxv4i32:
338 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
339 ; CHECK-NEXT: vrsub.vx v8, v8, a0
341 %head = insertelement <vscale x 4 x i32> poison, i32 %b, i32 0
342 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
343 %vc = sub <vscale x 4 x i32> %splat, %va
344 ret <vscale x 4 x i32> %vc
347 define <vscale x 4 x i32> @vrsub_vi_nxv4i32_0(<vscale x 4 x i32> %va) {
348 ; CHECK-LABEL: vrsub_vi_nxv4i32_0:
350 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
351 ; CHECK-NEXT: vrsub.vi v8, v8, -4
353 %vc = sub <vscale x 4 x i32> splat (i32 -4), %va
354 ret <vscale x 4 x i32> %vc
357 define <vscale x 8 x i32> @vrsub_vx_nxv8i32(<vscale x 8 x i32> %va, i32 signext %b) {
358 ; CHECK-LABEL: vrsub_vx_nxv8i32:
360 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
361 ; CHECK-NEXT: vrsub.vx v8, v8, a0
363 %head = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
364 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
365 %vc = sub <vscale x 8 x i32> %splat, %va
366 ret <vscale x 8 x i32> %vc
369 define <vscale x 8 x i32> @vrsub_vi_nxv8i32_0(<vscale x 8 x i32> %va) {
370 ; CHECK-LABEL: vrsub_vi_nxv8i32_0:
372 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
373 ; CHECK-NEXT: vrsub.vi v8, v8, -4
375 %vc = sub <vscale x 8 x i32> splat (i32 -4), %va
376 ret <vscale x 8 x i32> %vc
379 define <vscale x 16 x i32> @vrsub_vx_nxv16i32(<vscale x 16 x i32> %va, i32 signext %b) {
380 ; CHECK-LABEL: vrsub_vx_nxv16i32:
382 ; CHECK-NEXT: vsetvli a1, zero, e32, m8, ta, ma
383 ; CHECK-NEXT: vrsub.vx v8, v8, a0
385 %head = insertelement <vscale x 16 x i32> poison, i32 %b, i32 0
386 %splat = shufflevector <vscale x 16 x i32> %head, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
387 %vc = sub <vscale x 16 x i32> %splat, %va
388 ret <vscale x 16 x i32> %vc
391 define <vscale x 16 x i32> @vrsub_vi_nxv16i32_0(<vscale x 16 x i32> %va) {
392 ; CHECK-LABEL: vrsub_vi_nxv16i32_0:
394 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
395 ; CHECK-NEXT: vrsub.vi v8, v8, -4
397 %vc = sub <vscale x 16 x i32> splat (i32 -4), %va
398 ret <vscale x 16 x i32> %vc
401 define <vscale x 1 x i64> @vrsub_vx_nxv1i64(<vscale x 1 x i64> %va, i64 %b) {
402 ; RV32-LABEL: vrsub_vx_nxv1i64:
404 ; RV32-NEXT: addi sp, sp, -16
405 ; RV32-NEXT: .cfi_def_cfa_offset 16
406 ; RV32-NEXT: sw a0, 8(sp)
407 ; RV32-NEXT: sw a1, 12(sp)
408 ; RV32-NEXT: addi a0, sp, 8
409 ; RV32-NEXT: vsetvli a1, zero, e64, m1, ta, ma
410 ; RV32-NEXT: vlse64.v v9, (a0), zero
411 ; RV32-NEXT: vsub.vv v8, v9, v8
412 ; RV32-NEXT: addi sp, sp, 16
413 ; RV32-NEXT: .cfi_def_cfa_offset 0
416 ; RV64-LABEL: vrsub_vx_nxv1i64:
418 ; RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma
419 ; RV64-NEXT: vrsub.vx v8, v8, a0
421 %head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
422 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
423 %vc = sub <vscale x 1 x i64> %splat, %va
424 ret <vscale x 1 x i64> %vc
427 define <vscale x 1 x i64> @vrsub_vi_nxv1i64_0(<vscale x 1 x i64> %va) {
428 ; CHECK-LABEL: vrsub_vi_nxv1i64_0:
430 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
431 ; CHECK-NEXT: vrsub.vi v8, v8, -4
433 %vc = sub <vscale x 1 x i64> splat (i64 -4), %va
434 ret <vscale x 1 x i64> %vc
437 define <vscale x 2 x i64> @vrsub_vx_nxv2i64(<vscale x 2 x i64> %va, i64 %b) {
438 ; RV32-LABEL: vrsub_vx_nxv2i64:
440 ; RV32-NEXT: addi sp, sp, -16
441 ; RV32-NEXT: .cfi_def_cfa_offset 16
442 ; RV32-NEXT: sw a0, 8(sp)
443 ; RV32-NEXT: sw a1, 12(sp)
444 ; RV32-NEXT: addi a0, sp, 8
445 ; RV32-NEXT: vsetvli a1, zero, e64, m2, ta, ma
446 ; RV32-NEXT: vlse64.v v10, (a0), zero
447 ; RV32-NEXT: vsub.vv v8, v10, v8
448 ; RV32-NEXT: addi sp, sp, 16
449 ; RV32-NEXT: .cfi_def_cfa_offset 0
452 ; RV64-LABEL: vrsub_vx_nxv2i64:
454 ; RV64-NEXT: vsetvli a1, zero, e64, m2, ta, ma
455 ; RV64-NEXT: vrsub.vx v8, v8, a0
457 %head = insertelement <vscale x 2 x i64> poison, i64 %b, i32 0
458 %splat = shufflevector <vscale x 2 x i64> %head, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
459 %vc = sub <vscale x 2 x i64> %splat, %va
460 ret <vscale x 2 x i64> %vc
463 define <vscale x 2 x i64> @vrsub_vi_nxv2i64_0(<vscale x 2 x i64> %va) {
464 ; CHECK-LABEL: vrsub_vi_nxv2i64_0:
466 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
467 ; CHECK-NEXT: vrsub.vi v8, v8, -4
469 %vc = sub <vscale x 2 x i64> splat (i64 -4), %va
470 ret <vscale x 2 x i64> %vc
473 define <vscale x 4 x i64> @vrsub_vx_nxv4i64(<vscale x 4 x i64> %va, i64 %b) {
474 ; RV32-LABEL: vrsub_vx_nxv4i64:
476 ; RV32-NEXT: addi sp, sp, -16
477 ; RV32-NEXT: .cfi_def_cfa_offset 16
478 ; RV32-NEXT: sw a0, 8(sp)
479 ; RV32-NEXT: sw a1, 12(sp)
480 ; RV32-NEXT: addi a0, sp, 8
481 ; RV32-NEXT: vsetvli a1, zero, e64, m4, ta, ma
482 ; RV32-NEXT: vlse64.v v12, (a0), zero
483 ; RV32-NEXT: vsub.vv v8, v12, v8
484 ; RV32-NEXT: addi sp, sp, 16
485 ; RV32-NEXT: .cfi_def_cfa_offset 0
488 ; RV64-LABEL: vrsub_vx_nxv4i64:
490 ; RV64-NEXT: vsetvli a1, zero, e64, m4, ta, ma
491 ; RV64-NEXT: vrsub.vx v8, v8, a0
493 %head = insertelement <vscale x 4 x i64> poison, i64 %b, i32 0
494 %splat = shufflevector <vscale x 4 x i64> %head, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
495 %vc = sub <vscale x 4 x i64> %splat, %va
496 ret <vscale x 4 x i64> %vc
499 define <vscale x 4 x i64> @vrsub_vi_nxv4i64_0(<vscale x 4 x i64> %va) {
500 ; CHECK-LABEL: vrsub_vi_nxv4i64_0:
502 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
503 ; CHECK-NEXT: vrsub.vi v8, v8, -4
505 %vc = sub <vscale x 4 x i64> splat (i64 -4), %va
506 ret <vscale x 4 x i64> %vc
509 define <vscale x 8 x i64> @vrsub_vx_nxv8i64(<vscale x 8 x i64> %va, i64 %b) {
510 ; RV32-LABEL: vrsub_vx_nxv8i64:
512 ; RV32-NEXT: addi sp, sp, -16
513 ; RV32-NEXT: .cfi_def_cfa_offset 16
514 ; RV32-NEXT: sw a0, 8(sp)
515 ; RV32-NEXT: sw a1, 12(sp)
516 ; RV32-NEXT: addi a0, sp, 8
517 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
518 ; RV32-NEXT: vlse64.v v16, (a0), zero
519 ; RV32-NEXT: vsub.vv v8, v16, v8
520 ; RV32-NEXT: addi sp, sp, 16
521 ; RV32-NEXT: .cfi_def_cfa_offset 0
524 ; RV64-LABEL: vrsub_vx_nxv8i64:
526 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
527 ; RV64-NEXT: vrsub.vx v8, v8, a0
529 %head = insertelement <vscale x 8 x i64> poison, i64 %b, i32 0
530 %splat = shufflevector <vscale x 8 x i64> %head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
531 %vc = sub <vscale x 8 x i64> %splat, %va
532 ret <vscale x 8 x i64> %vc
535 define <vscale x 8 x i64> @vrsub_vi_nxv8i64_0(<vscale x 8 x i64> %va) {
536 ; CHECK-LABEL: vrsub_vi_nxv8i64_0:
538 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
539 ; CHECK-NEXT: vrsub.vi v8, v8, -4
541 %vc = sub <vscale x 8 x i64> splat (i64 -4), %va
542 ret <vscale x 8 x i64> %vc