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,RV32-V
3 ; RUN: llc -mtriple=riscv32 -mattr=+zve64x -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV32,ZVE64X
4 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV64,RV64-V
5 ; RUN: llc -mtriple=riscv64 -mattr=+zve64x -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV64,ZVE64X
7 define <vscale x 1 x i8> @vdiv_vv_nxv1i8(<vscale x 1 x i8> %va, <vscale x 1 x i8> %vb) {
8 ; CHECK-LABEL: vdiv_vv_nxv1i8:
10 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
11 ; CHECK-NEXT: vdiv.vv v8, v8, v9
13 %vc = sdiv <vscale x 1 x i8> %va, %vb
14 ret <vscale x 1 x i8> %vc
17 define <vscale x 1 x i8> @vdiv_vx_nxv1i8(<vscale x 1 x i8> %va, i8 signext %b) {
18 ; CHECK-LABEL: vdiv_vx_nxv1i8:
20 ; CHECK-NEXT: vsetvli a1, zero, e8, mf8, ta, ma
21 ; CHECK-NEXT: vdiv.vx v8, v8, a0
23 %head = insertelement <vscale x 1 x i8> poison, i8 %b, i32 0
24 %splat = shufflevector <vscale x 1 x i8> %head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
25 %vc = sdiv <vscale x 1 x i8> %va, %splat
26 ret <vscale x 1 x i8> %vc
29 define <vscale x 1 x i8> @vdiv_vi_nxv1i8_0(<vscale x 1 x i8> %va) {
30 ; CHECK-LABEL: vdiv_vi_nxv1i8_0:
32 ; CHECK-NEXT: li a0, 109
33 ; CHECK-NEXT: vsetvli a1, zero, e8, mf8, ta, ma
34 ; CHECK-NEXT: vmulh.vx v9, v8, a0
35 ; CHECK-NEXT: vsub.vv v8, v9, v8
36 ; CHECK-NEXT: vsra.vi v8, v8, 2
37 ; CHECK-NEXT: vsrl.vi v9, v8, 7
38 ; CHECK-NEXT: vadd.vv v8, v8, v9
40 %head = insertelement <vscale x 1 x i8> poison, i8 -7, i32 0
41 %splat = shufflevector <vscale x 1 x i8> %head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
42 %vc = sdiv <vscale x 1 x i8> %va, %splat
43 ret <vscale x 1 x i8> %vc
46 ; Test V/1 to see if we can optimize it away for scalable vectors.
47 define <vscale x 1 x i8> @vdiv_vi_nxv1i8_1(<vscale x 1 x i8> %va) {
48 ; CHECK-LABEL: vdiv_vi_nxv1i8_1:
51 %head = insertelement <vscale x 1 x i8> poison, i8 1, i32 0
52 %splat = shufflevector <vscale x 1 x i8> %head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
53 %vc = sdiv <vscale x 1 x i8> %va, %splat
54 ret <vscale x 1 x i8> %vc
57 ; Test 0/V to see if we can optimize it away for scalable vectors.
58 define <vscale x 1 x i8> @vdiv_iv_nxv1i8_0(<vscale x 1 x i8> %va) {
59 ; CHECK-LABEL: vdiv_iv_nxv1i8_0:
61 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
62 ; CHECK-NEXT: vmv.v.i v8, 0
64 %head = insertelement <vscale x 1 x i8> poison, i8 0, i32 0
65 %splat = shufflevector <vscale x 1 x i8> %head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
66 %vc = sdiv <vscale x 1 x i8> %splat, %va
67 ret <vscale x 1 x i8> %vc
70 define <vscale x 2 x i8> @vdiv_vv_nxv2i8(<vscale x 2 x i8> %va, <vscale x 2 x i8> %vb) {
71 ; CHECK-LABEL: vdiv_vv_nxv2i8:
73 ; CHECK-NEXT: vsetvli a0, zero, e8, mf4, ta, ma
74 ; CHECK-NEXT: vdiv.vv v8, v8, v9
76 %vc = sdiv <vscale x 2 x i8> %va, %vb
77 ret <vscale x 2 x i8> %vc
80 define <vscale x 2 x i8> @vdiv_vx_nxv2i8(<vscale x 2 x i8> %va, i8 signext %b) {
81 ; CHECK-LABEL: vdiv_vx_nxv2i8:
83 ; CHECK-NEXT: vsetvli a1, zero, e8, mf4, ta, ma
84 ; CHECK-NEXT: vdiv.vx v8, v8, a0
86 %head = insertelement <vscale x 2 x i8> poison, i8 %b, i32 0
87 %splat = shufflevector <vscale x 2 x i8> %head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
88 %vc = sdiv <vscale x 2 x i8> %va, %splat
89 ret <vscale x 2 x i8> %vc
92 define <vscale x 2 x i8> @vdiv_vi_nxv2i8_0(<vscale x 2 x i8> %va) {
93 ; CHECK-LABEL: vdiv_vi_nxv2i8_0:
95 ; CHECK-NEXT: li a0, 109
96 ; CHECK-NEXT: vsetvli a1, zero, e8, mf4, ta, ma
97 ; CHECK-NEXT: vmulh.vx v9, v8, a0
98 ; CHECK-NEXT: vsub.vv v8, v9, v8
99 ; CHECK-NEXT: vsra.vi v8, v8, 2
100 ; CHECK-NEXT: vsrl.vi v9, v8, 7
101 ; CHECK-NEXT: vadd.vv v8, v8, v9
103 %head = insertelement <vscale x 2 x i8> poison, i8 -7, i32 0
104 %splat = shufflevector <vscale x 2 x i8> %head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
105 %vc = sdiv <vscale x 2 x i8> %va, %splat
106 ret <vscale x 2 x i8> %vc
109 define <vscale x 4 x i8> @vdiv_vv_nxv4i8(<vscale x 4 x i8> %va, <vscale x 4 x i8> %vb) {
110 ; CHECK-LABEL: vdiv_vv_nxv4i8:
112 ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
113 ; CHECK-NEXT: vdiv.vv v8, v8, v9
115 %vc = sdiv <vscale x 4 x i8> %va, %vb
116 ret <vscale x 4 x i8> %vc
119 define <vscale x 4 x i8> @vdiv_vx_nxv4i8(<vscale x 4 x i8> %va, i8 signext %b) {
120 ; CHECK-LABEL: vdiv_vx_nxv4i8:
122 ; CHECK-NEXT: vsetvli a1, zero, e8, mf2, ta, ma
123 ; CHECK-NEXT: vdiv.vx v8, v8, a0
125 %head = insertelement <vscale x 4 x i8> poison, i8 %b, i32 0
126 %splat = shufflevector <vscale x 4 x i8> %head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
127 %vc = sdiv <vscale x 4 x i8> %va, %splat
128 ret <vscale x 4 x i8> %vc
131 define <vscale x 4 x i8> @vdiv_vi_nxv4i8_0(<vscale x 4 x i8> %va) {
132 ; CHECK-LABEL: vdiv_vi_nxv4i8_0:
134 ; CHECK-NEXT: li a0, 109
135 ; CHECK-NEXT: vsetvli a1, zero, e8, mf2, ta, ma
136 ; CHECK-NEXT: vmulh.vx v9, v8, a0
137 ; CHECK-NEXT: vsub.vv v8, v9, v8
138 ; CHECK-NEXT: vsra.vi v8, v8, 2
139 ; CHECK-NEXT: vsrl.vi v9, v8, 7
140 ; CHECK-NEXT: vadd.vv v8, v8, v9
142 %head = insertelement <vscale x 4 x i8> poison, i8 -7, i32 0
143 %splat = shufflevector <vscale x 4 x i8> %head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
144 %vc = sdiv <vscale x 4 x i8> %va, %splat
145 ret <vscale x 4 x i8> %vc
148 define <vscale x 8 x i8> @vdiv_vv_nxv8i8(<vscale x 8 x i8> %va, <vscale x 8 x i8> %vb) {
149 ; CHECK-LABEL: vdiv_vv_nxv8i8:
151 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
152 ; CHECK-NEXT: vdiv.vv v8, v8, v9
154 %vc = sdiv <vscale x 8 x i8> %va, %vb
155 ret <vscale x 8 x i8> %vc
158 define <vscale x 8 x i8> @vdiv_vx_nxv8i8(<vscale x 8 x i8> %va, i8 signext %b) {
159 ; CHECK-LABEL: vdiv_vx_nxv8i8:
161 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
162 ; CHECK-NEXT: vdiv.vx v8, v8, a0
164 %head = insertelement <vscale x 8 x i8> poison, i8 %b, i32 0
165 %splat = shufflevector <vscale x 8 x i8> %head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
166 %vc = sdiv <vscale x 8 x i8> %va, %splat
167 ret <vscale x 8 x i8> %vc
170 define <vscale x 8 x i8> @vdiv_vi_nxv8i8_0(<vscale x 8 x i8> %va) {
171 ; CHECK-LABEL: vdiv_vi_nxv8i8_0:
173 ; CHECK-NEXT: li a0, 109
174 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
175 ; CHECK-NEXT: vmulh.vx v9, v8, a0
176 ; CHECK-NEXT: vsub.vv v8, v9, v8
177 ; CHECK-NEXT: vsra.vi v8, v8, 2
178 ; CHECK-NEXT: vsrl.vi v9, v8, 7
179 ; CHECK-NEXT: vadd.vv v8, v8, v9
181 %head = insertelement <vscale x 8 x i8> poison, i8 -7, i32 0
182 %splat = shufflevector <vscale x 8 x i8> %head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
183 %vc = sdiv <vscale x 8 x i8> %va, %splat
184 ret <vscale x 8 x i8> %vc
187 define <vscale x 16 x i8> @vdiv_vv_nxv16i8(<vscale x 16 x i8> %va, <vscale x 16 x i8> %vb) {
188 ; CHECK-LABEL: vdiv_vv_nxv16i8:
190 ; CHECK-NEXT: vsetvli a0, zero, e8, m2, ta, ma
191 ; CHECK-NEXT: vdiv.vv v8, v8, v10
193 %vc = sdiv <vscale x 16 x i8> %va, %vb
194 ret <vscale x 16 x i8> %vc
197 define <vscale x 16 x i8> @vdiv_vx_nxv16i8(<vscale x 16 x i8> %va, i8 signext %b) {
198 ; CHECK-LABEL: vdiv_vx_nxv16i8:
200 ; CHECK-NEXT: vsetvli a1, zero, e8, m2, ta, ma
201 ; CHECK-NEXT: vdiv.vx v8, v8, a0
203 %head = insertelement <vscale x 16 x i8> poison, i8 %b, i32 0
204 %splat = shufflevector <vscale x 16 x i8> %head, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
205 %vc = sdiv <vscale x 16 x i8> %va, %splat
206 ret <vscale x 16 x i8> %vc
209 define <vscale x 16 x i8> @vdiv_vi_nxv16i8_0(<vscale x 16 x i8> %va) {
210 ; CHECK-LABEL: vdiv_vi_nxv16i8_0:
212 ; CHECK-NEXT: li a0, 109
213 ; CHECK-NEXT: vsetvli a1, zero, e8, m2, ta, ma
214 ; CHECK-NEXT: vmulh.vx v10, v8, a0
215 ; CHECK-NEXT: vsub.vv v8, v10, v8
216 ; CHECK-NEXT: vsra.vi v8, v8, 2
217 ; CHECK-NEXT: vsrl.vi v10, v8, 7
218 ; CHECK-NEXT: vadd.vv v8, v8, v10
220 %head = insertelement <vscale x 16 x i8> poison, i8 -7, i32 0
221 %splat = shufflevector <vscale x 16 x i8> %head, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
222 %vc = sdiv <vscale x 16 x i8> %va, %splat
223 ret <vscale x 16 x i8> %vc
226 define <vscale x 32 x i8> @vdiv_vv_nxv32i8(<vscale x 32 x i8> %va, <vscale x 32 x i8> %vb) {
227 ; CHECK-LABEL: vdiv_vv_nxv32i8:
229 ; CHECK-NEXT: vsetvli a0, zero, e8, m4, ta, ma
230 ; CHECK-NEXT: vdiv.vv v8, v8, v12
232 %vc = sdiv <vscale x 32 x i8> %va, %vb
233 ret <vscale x 32 x i8> %vc
236 define <vscale x 32 x i8> @vdiv_vx_nxv32i8(<vscale x 32 x i8> %va, i8 signext %b) {
237 ; CHECK-LABEL: vdiv_vx_nxv32i8:
239 ; CHECK-NEXT: vsetvli a1, zero, e8, m4, ta, ma
240 ; CHECK-NEXT: vdiv.vx v8, v8, a0
242 %head = insertelement <vscale x 32 x i8> poison, i8 %b, i32 0
243 %splat = shufflevector <vscale x 32 x i8> %head, <vscale x 32 x i8> poison, <vscale x 32 x i32> zeroinitializer
244 %vc = sdiv <vscale x 32 x i8> %va, %splat
245 ret <vscale x 32 x i8> %vc
248 define <vscale x 32 x i8> @vdiv_vi_nxv32i8_0(<vscale x 32 x i8> %va) {
249 ; CHECK-LABEL: vdiv_vi_nxv32i8_0:
251 ; CHECK-NEXT: li a0, 109
252 ; CHECK-NEXT: vsetvli a1, zero, e8, m4, ta, ma
253 ; CHECK-NEXT: vmulh.vx v12, v8, a0
254 ; CHECK-NEXT: vsub.vv v8, v12, v8
255 ; CHECK-NEXT: vsra.vi v8, v8, 2
256 ; CHECK-NEXT: vsrl.vi v12, v8, 7
257 ; CHECK-NEXT: vadd.vv v8, v8, v12
259 %head = insertelement <vscale x 32 x i8> poison, i8 -7, i32 0
260 %splat = shufflevector <vscale x 32 x i8> %head, <vscale x 32 x i8> poison, <vscale x 32 x i32> zeroinitializer
261 %vc = sdiv <vscale x 32 x i8> %va, %splat
262 ret <vscale x 32 x i8> %vc
265 define <vscale x 64 x i8> @vdiv_vv_nxv64i8(<vscale x 64 x i8> %va, <vscale x 64 x i8> %vb) {
266 ; CHECK-LABEL: vdiv_vv_nxv64i8:
268 ; CHECK-NEXT: vsetvli a0, zero, e8, m8, ta, ma
269 ; CHECK-NEXT: vdiv.vv v8, v8, v16
271 %vc = sdiv <vscale x 64 x i8> %va, %vb
272 ret <vscale x 64 x i8> %vc
275 define <vscale x 64 x i8> @vdiv_vx_nxv64i8(<vscale x 64 x i8> %va, i8 signext %b) {
276 ; CHECK-LABEL: vdiv_vx_nxv64i8:
278 ; CHECK-NEXT: vsetvli a1, zero, e8, m8, ta, ma
279 ; CHECK-NEXT: vdiv.vx v8, v8, a0
281 %head = insertelement <vscale x 64 x i8> poison, i8 %b, i32 0
282 %splat = shufflevector <vscale x 64 x i8> %head, <vscale x 64 x i8> poison, <vscale x 64 x i32> zeroinitializer
283 %vc = sdiv <vscale x 64 x i8> %va, %splat
284 ret <vscale x 64 x i8> %vc
287 define <vscale x 64 x i8> @vdiv_vi_nxv64i8_0(<vscale x 64 x i8> %va) {
288 ; CHECK-LABEL: vdiv_vi_nxv64i8_0:
290 ; CHECK-NEXT: li a0, 109
291 ; CHECK-NEXT: vsetvli a1, zero, e8, m8, ta, ma
292 ; CHECK-NEXT: vmulh.vx v16, v8, a0
293 ; CHECK-NEXT: vsub.vv v8, v16, v8
294 ; CHECK-NEXT: vsra.vi v8, v8, 2
295 ; CHECK-NEXT: vsrl.vi v16, v8, 7
296 ; CHECK-NEXT: vadd.vv v8, v8, v16
298 %head = insertelement <vscale x 64 x i8> poison, i8 -7, i32 0
299 %splat = shufflevector <vscale x 64 x i8> %head, <vscale x 64 x i8> poison, <vscale x 64 x i32> zeroinitializer
300 %vc = sdiv <vscale x 64 x i8> %va, %splat
301 ret <vscale x 64 x i8> %vc
304 define <vscale x 1 x i16> @vdiv_vv_nxv1i16(<vscale x 1 x i16> %va, <vscale x 1 x i16> %vb) {
305 ; CHECK-LABEL: vdiv_vv_nxv1i16:
307 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
308 ; CHECK-NEXT: vdiv.vv v8, v8, v9
310 %vc = sdiv <vscale x 1 x i16> %va, %vb
311 ret <vscale x 1 x i16> %vc
314 define <vscale x 1 x i16> @vdiv_vx_nxv1i16(<vscale x 1 x i16> %va, i16 signext %b) {
315 ; CHECK-LABEL: vdiv_vx_nxv1i16:
317 ; CHECK-NEXT: vsetvli a1, zero, e16, mf4, ta, ma
318 ; CHECK-NEXT: vdiv.vx v8, v8, a0
320 %head = insertelement <vscale x 1 x i16> poison, i16 %b, i32 0
321 %splat = shufflevector <vscale x 1 x i16> %head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
322 %vc = sdiv <vscale x 1 x i16> %va, %splat
323 ret <vscale x 1 x i16> %vc
326 define <vscale x 1 x i16> @vdiv_vi_nxv1i16_0(<vscale x 1 x i16> %va) {
327 ; CHECK-LABEL: vdiv_vi_nxv1i16_0:
329 ; CHECK-NEXT: lui a0, 1048571
330 ; CHECK-NEXT: addi a0, a0, 1755
331 ; CHECK-NEXT: vsetvli a1, zero, e16, mf4, ta, ma
332 ; CHECK-NEXT: vmulh.vx v8, v8, a0
333 ; CHECK-NEXT: vsra.vi v8, v8, 1
334 ; CHECK-NEXT: vsrl.vi v9, v8, 15
335 ; CHECK-NEXT: vadd.vv v8, v8, v9
337 %head = insertelement <vscale x 1 x i16> poison, i16 -7, i32 0
338 %splat = shufflevector <vscale x 1 x i16> %head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
339 %vc = sdiv <vscale x 1 x i16> %va, %splat
340 ret <vscale x 1 x i16> %vc
343 define <vscale x 2 x i16> @vdiv_vv_nxv2i16(<vscale x 2 x i16> %va, <vscale x 2 x i16> %vb) {
344 ; CHECK-LABEL: vdiv_vv_nxv2i16:
346 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
347 ; CHECK-NEXT: vdiv.vv v8, v8, v9
349 %vc = sdiv <vscale x 2 x i16> %va, %vb
350 ret <vscale x 2 x i16> %vc
353 define <vscale x 2 x i16> @vdiv_vx_nxv2i16(<vscale x 2 x i16> %va, i16 signext %b) {
354 ; CHECK-LABEL: vdiv_vx_nxv2i16:
356 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
357 ; CHECK-NEXT: vdiv.vx v8, v8, a0
359 %head = insertelement <vscale x 2 x i16> poison, i16 %b, i32 0
360 %splat = shufflevector <vscale x 2 x i16> %head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
361 %vc = sdiv <vscale x 2 x i16> %va, %splat
362 ret <vscale x 2 x i16> %vc
365 define <vscale x 2 x i16> @vdiv_vi_nxv2i16_0(<vscale x 2 x i16> %va) {
366 ; CHECK-LABEL: vdiv_vi_nxv2i16_0:
368 ; CHECK-NEXT: lui a0, 1048571
369 ; CHECK-NEXT: addi a0, a0, 1755
370 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
371 ; CHECK-NEXT: vmulh.vx v8, v8, a0
372 ; CHECK-NEXT: vsra.vi v8, v8, 1
373 ; CHECK-NEXT: vsrl.vi v9, v8, 15
374 ; CHECK-NEXT: vadd.vv v8, v8, v9
376 %head = insertelement <vscale x 2 x i16> poison, i16 -7, i32 0
377 %splat = shufflevector <vscale x 2 x i16> %head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
378 %vc = sdiv <vscale x 2 x i16> %va, %splat
379 ret <vscale x 2 x i16> %vc
382 define <vscale x 4 x i16> @vdiv_vv_nxv4i16(<vscale x 4 x i16> %va, <vscale x 4 x i16> %vb) {
383 ; CHECK-LABEL: vdiv_vv_nxv4i16:
385 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
386 ; CHECK-NEXT: vdiv.vv v8, v8, v9
388 %vc = sdiv <vscale x 4 x i16> %va, %vb
389 ret <vscale x 4 x i16> %vc
392 define <vscale x 4 x i16> @vdiv_vx_nxv4i16(<vscale x 4 x i16> %va, i16 signext %b) {
393 ; CHECK-LABEL: vdiv_vx_nxv4i16:
395 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
396 ; CHECK-NEXT: vdiv.vx v8, v8, a0
398 %head = insertelement <vscale x 4 x i16> poison, i16 %b, i32 0
399 %splat = shufflevector <vscale x 4 x i16> %head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
400 %vc = sdiv <vscale x 4 x i16> %va, %splat
401 ret <vscale x 4 x i16> %vc
404 define <vscale x 4 x i16> @vdiv_vi_nxv4i16_0(<vscale x 4 x i16> %va) {
405 ; CHECK-LABEL: vdiv_vi_nxv4i16_0:
407 ; CHECK-NEXT: lui a0, 1048571
408 ; CHECK-NEXT: addi a0, a0, 1755
409 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
410 ; CHECK-NEXT: vmulh.vx v8, v8, a0
411 ; CHECK-NEXT: vsra.vi v8, v8, 1
412 ; CHECK-NEXT: vsrl.vi v9, v8, 15
413 ; CHECK-NEXT: vadd.vv v8, v8, v9
415 %head = insertelement <vscale x 4 x i16> poison, i16 -7, i32 0
416 %splat = shufflevector <vscale x 4 x i16> %head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
417 %vc = sdiv <vscale x 4 x i16> %va, %splat
418 ret <vscale x 4 x i16> %vc
421 define <vscale x 8 x i16> @vdiv_vv_nxv8i16(<vscale x 8 x i16> %va, <vscale x 8 x i16> %vb) {
422 ; CHECK-LABEL: vdiv_vv_nxv8i16:
424 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
425 ; CHECK-NEXT: vdiv.vv v8, v8, v10
427 %vc = sdiv <vscale x 8 x i16> %va, %vb
428 ret <vscale x 8 x i16> %vc
431 define <vscale x 8 x i16> @vdiv_vx_nxv8i16(<vscale x 8 x i16> %va, i16 signext %b) {
432 ; CHECK-LABEL: vdiv_vx_nxv8i16:
434 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
435 ; CHECK-NEXT: vdiv.vx v8, v8, a0
437 %head = insertelement <vscale x 8 x i16> poison, i16 %b, i32 0
438 %splat = shufflevector <vscale x 8 x i16> %head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
439 %vc = sdiv <vscale x 8 x i16> %va, %splat
440 ret <vscale x 8 x i16> %vc
443 define <vscale x 8 x i16> @vdiv_vi_nxv8i16_0(<vscale x 8 x i16> %va) {
444 ; CHECK-LABEL: vdiv_vi_nxv8i16_0:
446 ; CHECK-NEXT: lui a0, 1048571
447 ; CHECK-NEXT: addi a0, a0, 1755
448 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
449 ; CHECK-NEXT: vmulh.vx v8, v8, a0
450 ; CHECK-NEXT: vsra.vi v8, v8, 1
451 ; CHECK-NEXT: vsrl.vi v10, v8, 15
452 ; CHECK-NEXT: vadd.vv v8, v8, v10
454 %head = insertelement <vscale x 8 x i16> poison, i16 -7, i32 0
455 %splat = shufflevector <vscale x 8 x i16> %head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
456 %vc = sdiv <vscale x 8 x i16> %va, %splat
457 ret <vscale x 8 x i16> %vc
460 define <vscale x 16 x i16> @vdiv_vv_nxv16i16(<vscale x 16 x i16> %va, <vscale x 16 x i16> %vb) {
461 ; CHECK-LABEL: vdiv_vv_nxv16i16:
463 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
464 ; CHECK-NEXT: vdiv.vv v8, v8, v12
466 %vc = sdiv <vscale x 16 x i16> %va, %vb
467 ret <vscale x 16 x i16> %vc
470 define <vscale x 16 x i16> @vdiv_vx_nxv16i16(<vscale x 16 x i16> %va, i16 signext %b) {
471 ; CHECK-LABEL: vdiv_vx_nxv16i16:
473 ; CHECK-NEXT: vsetvli a1, zero, e16, m4, ta, ma
474 ; CHECK-NEXT: vdiv.vx v8, v8, a0
476 %head = insertelement <vscale x 16 x i16> poison, i16 %b, i32 0
477 %splat = shufflevector <vscale x 16 x i16> %head, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
478 %vc = sdiv <vscale x 16 x i16> %va, %splat
479 ret <vscale x 16 x i16> %vc
482 define <vscale x 16 x i16> @vdiv_vi_nxv16i16_0(<vscale x 16 x i16> %va) {
483 ; CHECK-LABEL: vdiv_vi_nxv16i16_0:
485 ; CHECK-NEXT: lui a0, 1048571
486 ; CHECK-NEXT: addi a0, a0, 1755
487 ; CHECK-NEXT: vsetvli a1, zero, e16, m4, ta, ma
488 ; CHECK-NEXT: vmulh.vx v8, v8, a0
489 ; CHECK-NEXT: vsra.vi v8, v8, 1
490 ; CHECK-NEXT: vsrl.vi v12, v8, 15
491 ; CHECK-NEXT: vadd.vv v8, v8, v12
493 %head = insertelement <vscale x 16 x i16> poison, i16 -7, i32 0
494 %splat = shufflevector <vscale x 16 x i16> %head, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
495 %vc = sdiv <vscale x 16 x i16> %va, %splat
496 ret <vscale x 16 x i16> %vc
499 define <vscale x 32 x i16> @vdiv_vv_nxv32i16(<vscale x 32 x i16> %va, <vscale x 32 x i16> %vb) {
500 ; CHECK-LABEL: vdiv_vv_nxv32i16:
502 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
503 ; CHECK-NEXT: vdiv.vv v8, v8, v16
505 %vc = sdiv <vscale x 32 x i16> %va, %vb
506 ret <vscale x 32 x i16> %vc
509 define <vscale x 32 x i16> @vdiv_vx_nxv32i16(<vscale x 32 x i16> %va, i16 signext %b) {
510 ; CHECK-LABEL: vdiv_vx_nxv32i16:
512 ; CHECK-NEXT: vsetvli a1, zero, e16, m8, ta, ma
513 ; CHECK-NEXT: vdiv.vx v8, v8, a0
515 %head = insertelement <vscale x 32 x i16> poison, i16 %b, i32 0
516 %splat = shufflevector <vscale x 32 x i16> %head, <vscale x 32 x i16> poison, <vscale x 32 x i32> zeroinitializer
517 %vc = sdiv <vscale x 32 x i16> %va, %splat
518 ret <vscale x 32 x i16> %vc
521 define <vscale x 32 x i16> @vdiv_vi_nxv32i16_0(<vscale x 32 x i16> %va) {
522 ; CHECK-LABEL: vdiv_vi_nxv32i16_0:
524 ; CHECK-NEXT: lui a0, 1048571
525 ; CHECK-NEXT: addi a0, a0, 1755
526 ; CHECK-NEXT: vsetvli a1, zero, e16, m8, ta, ma
527 ; CHECK-NEXT: vmulh.vx v8, v8, a0
528 ; CHECK-NEXT: vsra.vi v8, v8, 1
529 ; CHECK-NEXT: vsrl.vi v16, v8, 15
530 ; CHECK-NEXT: vadd.vv v8, v8, v16
532 %head = insertelement <vscale x 32 x i16> poison, i16 -7, i32 0
533 %splat = shufflevector <vscale x 32 x i16> %head, <vscale x 32 x i16> poison, <vscale x 32 x i32> zeroinitializer
534 %vc = sdiv <vscale x 32 x i16> %va, %splat
535 ret <vscale x 32 x i16> %vc
538 define <vscale x 1 x i32> @vdiv_vv_nxv1i32(<vscale x 1 x i32> %va, <vscale x 1 x i32> %vb) {
539 ; CHECK-LABEL: vdiv_vv_nxv1i32:
541 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
542 ; CHECK-NEXT: vdiv.vv v8, v8, v9
544 %vc = sdiv <vscale x 1 x i32> %va, %vb
545 ret <vscale x 1 x i32> %vc
548 define <vscale x 1 x i32> @vdiv_vx_nxv1i32(<vscale x 1 x i32> %va, i32 signext %b) {
549 ; CHECK-LABEL: vdiv_vx_nxv1i32:
551 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
552 ; CHECK-NEXT: vdiv.vx v8, v8, a0
554 %head = insertelement <vscale x 1 x i32> poison, i32 %b, i32 0
555 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
556 %vc = sdiv <vscale x 1 x i32> %va, %splat
557 ret <vscale x 1 x i32> %vc
560 define <vscale x 1 x i32> @vdiv_vi_nxv1i32_0(<vscale x 1 x i32> %va) {
561 ; RV32-LABEL: vdiv_vi_nxv1i32_0:
563 ; RV32-NEXT: lui a0, 449390
564 ; RV32-NEXT: addi a0, a0, -1171
565 ; RV32-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
566 ; RV32-NEXT: vmulh.vx v9, v8, a0
567 ; RV32-NEXT: vsub.vv v8, v9, v8
568 ; RV32-NEXT: vsrl.vi v9, v8, 31
569 ; RV32-NEXT: vsra.vi v8, v8, 2
570 ; RV32-NEXT: vadd.vv v8, v8, v9
573 ; RV64-LABEL: vdiv_vi_nxv1i32_0:
575 ; RV64-NEXT: lui a0, 449390
576 ; RV64-NEXT: addi a0, a0, -1171
577 ; RV64-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
578 ; RV64-NEXT: vmulh.vx v9, v8, a0
579 ; RV64-NEXT: vsub.vv v8, v9, v8
580 ; RV64-NEXT: vsra.vi v8, v8, 2
581 ; RV64-NEXT: vsrl.vi v9, v8, 31
582 ; RV64-NEXT: vadd.vv v8, v8, v9
584 %head = insertelement <vscale x 1 x i32> poison, i32 -7, i32 0
585 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
586 %vc = sdiv <vscale x 1 x i32> %va, %splat
587 ret <vscale x 1 x i32> %vc
590 define <vscale x 2 x i32> @vdiv_vv_nxv2i32(<vscale x 2 x i32> %va, <vscale x 2 x i32> %vb) {
591 ; CHECK-LABEL: vdiv_vv_nxv2i32:
593 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
594 ; CHECK-NEXT: vdiv.vv v8, v8, v9
596 %vc = sdiv <vscale x 2 x i32> %va, %vb
597 ret <vscale x 2 x i32> %vc
600 define <vscale x 2 x i32> @vdiv_vx_nxv2i32(<vscale x 2 x i32> %va, i32 signext %b) {
601 ; CHECK-LABEL: vdiv_vx_nxv2i32:
603 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
604 ; CHECK-NEXT: vdiv.vx v8, v8, a0
606 %head = insertelement <vscale x 2 x i32> poison, i32 %b, i32 0
607 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
608 %vc = sdiv <vscale x 2 x i32> %va, %splat
609 ret <vscale x 2 x i32> %vc
612 define <vscale x 2 x i32> @vdiv_vi_nxv2i32_0(<vscale x 2 x i32> %va) {
613 ; RV32-LABEL: vdiv_vi_nxv2i32_0:
615 ; RV32-NEXT: lui a0, 449390
616 ; RV32-NEXT: addi a0, a0, -1171
617 ; RV32-NEXT: vsetvli a1, zero, e32, m1, ta, ma
618 ; RV32-NEXT: vmulh.vx v9, v8, a0
619 ; RV32-NEXT: vsub.vv v8, v9, v8
620 ; RV32-NEXT: vsrl.vi v9, v8, 31
621 ; RV32-NEXT: vsra.vi v8, v8, 2
622 ; RV32-NEXT: vadd.vv v8, v8, v9
625 ; RV64-LABEL: vdiv_vi_nxv2i32_0:
627 ; RV64-NEXT: lui a0, 449390
628 ; RV64-NEXT: addi a0, a0, -1171
629 ; RV64-NEXT: vsetvli a1, zero, e32, m1, ta, ma
630 ; RV64-NEXT: vmulh.vx v9, v8, a0
631 ; RV64-NEXT: vsub.vv v8, v9, v8
632 ; RV64-NEXT: vsra.vi v8, v8, 2
633 ; RV64-NEXT: vsrl.vi v9, v8, 31
634 ; RV64-NEXT: vadd.vv v8, v8, v9
636 %head = insertelement <vscale x 2 x i32> poison, i32 -7, i32 0
637 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
638 %vc = sdiv <vscale x 2 x i32> %va, %splat
639 ret <vscale x 2 x i32> %vc
642 define <vscale x 4 x i32> @vdiv_vv_nxv4i32(<vscale x 4 x i32> %va, <vscale x 4 x i32> %vb) {
643 ; CHECK-LABEL: vdiv_vv_nxv4i32:
645 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
646 ; CHECK-NEXT: vdiv.vv v8, v8, v10
648 %vc = sdiv <vscale x 4 x i32> %va, %vb
649 ret <vscale x 4 x i32> %vc
652 define <vscale x 4 x i32> @vdiv_vx_nxv4i32(<vscale x 4 x i32> %va, i32 signext %b) {
653 ; CHECK-LABEL: vdiv_vx_nxv4i32:
655 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
656 ; CHECK-NEXT: vdiv.vx v8, v8, a0
658 %head = insertelement <vscale x 4 x i32> poison, i32 %b, i32 0
659 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
660 %vc = sdiv <vscale x 4 x i32> %va, %splat
661 ret <vscale x 4 x i32> %vc
664 define <vscale x 4 x i32> @vdiv_vi_nxv4i32_0(<vscale x 4 x i32> %va) {
665 ; RV32-LABEL: vdiv_vi_nxv4i32_0:
667 ; RV32-NEXT: lui a0, 449390
668 ; RV32-NEXT: addi a0, a0, -1171
669 ; RV32-NEXT: vsetvli a1, zero, e32, m2, ta, ma
670 ; RV32-NEXT: vmulh.vx v10, v8, a0
671 ; RV32-NEXT: vsub.vv v8, v10, v8
672 ; RV32-NEXT: vsrl.vi v10, v8, 31
673 ; RV32-NEXT: vsra.vi v8, v8, 2
674 ; RV32-NEXT: vadd.vv v8, v8, v10
677 ; RV64-LABEL: vdiv_vi_nxv4i32_0:
679 ; RV64-NEXT: lui a0, 449390
680 ; RV64-NEXT: addi a0, a0, -1171
681 ; RV64-NEXT: vsetvli a1, zero, e32, m2, ta, ma
682 ; RV64-NEXT: vmulh.vx v10, v8, a0
683 ; RV64-NEXT: vsub.vv v8, v10, v8
684 ; RV64-NEXT: vsra.vi v8, v8, 2
685 ; RV64-NEXT: vsrl.vi v10, v8, 31
686 ; RV64-NEXT: vadd.vv v8, v8, v10
688 %head = insertelement <vscale x 4 x i32> poison, i32 -7, i32 0
689 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
690 %vc = sdiv <vscale x 4 x i32> %va, %splat
691 ret <vscale x 4 x i32> %vc
694 define <vscale x 8 x i32> @vdiv_vv_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %vb) {
695 ; CHECK-LABEL: vdiv_vv_nxv8i32:
697 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
698 ; CHECK-NEXT: vdiv.vv v8, v8, v12
700 %vc = sdiv <vscale x 8 x i32> %va, %vb
701 ret <vscale x 8 x i32> %vc
704 define <vscale x 8 x i32> @vdiv_vx_nxv8i32(<vscale x 8 x i32> %va, i32 signext %b) {
705 ; CHECK-LABEL: vdiv_vx_nxv8i32:
707 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
708 ; CHECK-NEXT: vdiv.vx v8, v8, a0
710 %head = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
711 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
712 %vc = sdiv <vscale x 8 x i32> %va, %splat
713 ret <vscale x 8 x i32> %vc
716 define <vscale x 8 x i32> @vdiv_vi_nxv8i32_0(<vscale x 8 x i32> %va) {
717 ; RV32-LABEL: vdiv_vi_nxv8i32_0:
719 ; RV32-NEXT: lui a0, 449390
720 ; RV32-NEXT: addi a0, a0, -1171
721 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
722 ; RV32-NEXT: vmulh.vx v12, v8, a0
723 ; RV32-NEXT: vsub.vv v8, v12, v8
724 ; RV32-NEXT: vsrl.vi v12, v8, 31
725 ; RV32-NEXT: vsra.vi v8, v8, 2
726 ; RV32-NEXT: vadd.vv v8, v8, v12
729 ; RV64-LABEL: vdiv_vi_nxv8i32_0:
731 ; RV64-NEXT: lui a0, 449390
732 ; RV64-NEXT: addi a0, a0, -1171
733 ; RV64-NEXT: vsetvli a1, zero, e32, m4, ta, ma
734 ; RV64-NEXT: vmulh.vx v12, v8, a0
735 ; RV64-NEXT: vsub.vv v8, v12, v8
736 ; RV64-NEXT: vsra.vi v8, v8, 2
737 ; RV64-NEXT: vsrl.vi v12, v8, 31
738 ; RV64-NEXT: vadd.vv v8, v8, v12
740 %head = insertelement <vscale x 8 x i32> poison, i32 -7, i32 0
741 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
742 %vc = sdiv <vscale x 8 x i32> %va, %splat
743 ret <vscale x 8 x i32> %vc
746 define <vscale x 16 x i32> @vdiv_vv_nxv16i32(<vscale x 16 x i32> %va, <vscale x 16 x i32> %vb) {
747 ; CHECK-LABEL: vdiv_vv_nxv16i32:
749 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
750 ; CHECK-NEXT: vdiv.vv v8, v8, v16
752 %vc = sdiv <vscale x 16 x i32> %va, %vb
753 ret <vscale x 16 x i32> %vc
756 define <vscale x 16 x i32> @vdiv_vx_nxv16i32(<vscale x 16 x i32> %va, i32 signext %b) {
757 ; CHECK-LABEL: vdiv_vx_nxv16i32:
759 ; CHECK-NEXT: vsetvli a1, zero, e32, m8, ta, ma
760 ; CHECK-NEXT: vdiv.vx v8, v8, a0
762 %head = insertelement <vscale x 16 x i32> poison, i32 %b, i32 0
763 %splat = shufflevector <vscale x 16 x i32> %head, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
764 %vc = sdiv <vscale x 16 x i32> %va, %splat
765 ret <vscale x 16 x i32> %vc
768 define <vscale x 16 x i32> @vdiv_vi_nxv16i32_0(<vscale x 16 x i32> %va) {
769 ; RV32-LABEL: vdiv_vi_nxv16i32_0:
771 ; RV32-NEXT: lui a0, 449390
772 ; RV32-NEXT: addi a0, a0, -1171
773 ; RV32-NEXT: vsetvli a1, zero, e32, m8, ta, ma
774 ; RV32-NEXT: vmulh.vx v16, v8, a0
775 ; RV32-NEXT: vsub.vv v8, v16, v8
776 ; RV32-NEXT: vsrl.vi v16, v8, 31
777 ; RV32-NEXT: vsra.vi v8, v8, 2
778 ; RV32-NEXT: vadd.vv v8, v8, v16
781 ; RV64-LABEL: vdiv_vi_nxv16i32_0:
783 ; RV64-NEXT: lui a0, 449390
784 ; RV64-NEXT: addi a0, a0, -1171
785 ; RV64-NEXT: vsetvli a1, zero, e32, m8, ta, ma
786 ; RV64-NEXT: vmulh.vx v16, v8, a0
787 ; RV64-NEXT: vsub.vv v8, v16, v8
788 ; RV64-NEXT: vsra.vi v8, v8, 2
789 ; RV64-NEXT: vsrl.vi v16, v8, 31
790 ; RV64-NEXT: vadd.vv v8, v8, v16
792 %head = insertelement <vscale x 16 x i32> poison, i32 -7, i32 0
793 %splat = shufflevector <vscale x 16 x i32> %head, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
794 %vc = sdiv <vscale x 16 x i32> %va, %splat
795 ret <vscale x 16 x i32> %vc
798 define <vscale x 1 x i64> @vdiv_vv_nxv1i64(<vscale x 1 x i64> %va, <vscale x 1 x i64> %vb) {
799 ; CHECK-LABEL: vdiv_vv_nxv1i64:
801 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
802 ; CHECK-NEXT: vdiv.vv v8, v8, v9
804 %vc = sdiv <vscale x 1 x i64> %va, %vb
805 ret <vscale x 1 x i64> %vc
808 define <vscale x 1 x i64> @vdiv_vx_nxv1i64(<vscale x 1 x i64> %va, i64 %b) {
809 ; RV32-LABEL: vdiv_vx_nxv1i64:
811 ; RV32-NEXT: addi sp, sp, -16
812 ; RV32-NEXT: .cfi_def_cfa_offset 16
813 ; RV32-NEXT: sw a1, 12(sp)
814 ; RV32-NEXT: sw a0, 8(sp)
815 ; RV32-NEXT: addi a0, sp, 8
816 ; RV32-NEXT: vsetvli a1, zero, e64, m1, ta, ma
817 ; RV32-NEXT: vlse64.v v9, (a0), zero
818 ; RV32-NEXT: vdiv.vv v8, v8, v9
819 ; RV32-NEXT: addi sp, sp, 16
822 ; RV64-LABEL: vdiv_vx_nxv1i64:
824 ; RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma
825 ; RV64-NEXT: vdiv.vx v8, v8, a0
827 %head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
828 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
829 %vc = sdiv <vscale x 1 x i64> %va, %splat
830 ret <vscale x 1 x i64> %vc
833 define <vscale x 1 x i64> @vdiv_vi_nxv1i64_0(<vscale x 1 x i64> %va) {
834 ; RV32-V-LABEL: vdiv_vi_nxv1i64_0:
836 ; RV32-V-NEXT: addi sp, sp, -16
837 ; RV32-V-NEXT: .cfi_def_cfa_offset 16
838 ; RV32-V-NEXT: lui a0, 748983
839 ; RV32-V-NEXT: addi a0, a0, -586
840 ; RV32-V-NEXT: sw a0, 12(sp)
841 ; RV32-V-NEXT: lui a0, 898779
842 ; RV32-V-NEXT: addi a0, a0, 1755
843 ; RV32-V-NEXT: sw a0, 8(sp)
844 ; RV32-V-NEXT: addi a0, sp, 8
845 ; RV32-V-NEXT: vsetvli a1, zero, e64, m1, ta, ma
846 ; RV32-V-NEXT: vlse64.v v9, (a0), zero
847 ; RV32-V-NEXT: vmulh.vv v8, v8, v9
848 ; RV32-V-NEXT: li a0, 63
849 ; RV32-V-NEXT: vsrl.vx v9, v8, a0
850 ; RV32-V-NEXT: vsra.vi v8, v8, 1
851 ; RV32-V-NEXT: vadd.vv v8, v8, v9
852 ; RV32-V-NEXT: addi sp, sp, 16
855 ; ZVE64X-LABEL: vdiv_vi_nxv1i64_0:
857 ; ZVE64X-NEXT: li a0, -7
858 ; ZVE64X-NEXT: vsetvli a1, zero, e64, m1, ta, ma
859 ; ZVE64X-NEXT: vdiv.vx v8, v8, a0
862 ; RV64-V-LABEL: vdiv_vi_nxv1i64_0:
864 ; RV64-V-NEXT: lui a0, %hi(.LCPI58_0)
865 ; RV64-V-NEXT: ld a0, %lo(.LCPI58_0)(a0)
866 ; RV64-V-NEXT: vsetvli a1, zero, e64, m1, ta, ma
867 ; RV64-V-NEXT: vmulh.vx v8, v8, a0
868 ; RV64-V-NEXT: li a0, 63
869 ; RV64-V-NEXT: vsrl.vx v9, v8, a0
870 ; RV64-V-NEXT: vsra.vi v8, v8, 1
871 ; RV64-V-NEXT: vadd.vv v8, v8, v9
873 %head = insertelement <vscale x 1 x i64> poison, i64 -7, i32 0
874 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
875 %vc = sdiv <vscale x 1 x i64> %va, %splat
876 ret <vscale x 1 x i64> %vc
879 define <vscale x 2 x i64> @vdiv_vv_nxv2i64(<vscale x 2 x i64> %va, <vscale x 2 x i64> %vb) {
880 ; CHECK-LABEL: vdiv_vv_nxv2i64:
882 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
883 ; CHECK-NEXT: vdiv.vv v8, v8, v10
885 %vc = sdiv <vscale x 2 x i64> %va, %vb
886 ret <vscale x 2 x i64> %vc
889 define <vscale x 2 x i64> @vdiv_vx_nxv2i64(<vscale x 2 x i64> %va, i64 %b) {
890 ; RV32-LABEL: vdiv_vx_nxv2i64:
892 ; RV32-NEXT: addi sp, sp, -16
893 ; RV32-NEXT: .cfi_def_cfa_offset 16
894 ; RV32-NEXT: sw a1, 12(sp)
895 ; RV32-NEXT: sw a0, 8(sp)
896 ; RV32-NEXT: addi a0, sp, 8
897 ; RV32-NEXT: vsetvli a1, zero, e64, m2, ta, ma
898 ; RV32-NEXT: vlse64.v v10, (a0), zero
899 ; RV32-NEXT: vdiv.vv v8, v8, v10
900 ; RV32-NEXT: addi sp, sp, 16
903 ; RV64-LABEL: vdiv_vx_nxv2i64:
905 ; RV64-NEXT: vsetvli a1, zero, e64, m2, ta, ma
906 ; RV64-NEXT: vdiv.vx v8, v8, a0
908 %head = insertelement <vscale x 2 x i64> poison, i64 %b, i32 0
909 %splat = shufflevector <vscale x 2 x i64> %head, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
910 %vc = sdiv <vscale x 2 x i64> %va, %splat
911 ret <vscale x 2 x i64> %vc
914 define <vscale x 2 x i64> @vdiv_vi_nxv2i64_0(<vscale x 2 x i64> %va) {
915 ; RV32-V-LABEL: vdiv_vi_nxv2i64_0:
917 ; RV32-V-NEXT: addi sp, sp, -16
918 ; RV32-V-NEXT: .cfi_def_cfa_offset 16
919 ; RV32-V-NEXT: lui a0, 748983
920 ; RV32-V-NEXT: addi a0, a0, -586
921 ; RV32-V-NEXT: sw a0, 12(sp)
922 ; RV32-V-NEXT: lui a0, 898779
923 ; RV32-V-NEXT: addi a0, a0, 1755
924 ; RV32-V-NEXT: sw a0, 8(sp)
925 ; RV32-V-NEXT: addi a0, sp, 8
926 ; RV32-V-NEXT: vsetvli a1, zero, e64, m2, ta, ma
927 ; RV32-V-NEXT: vlse64.v v10, (a0), zero
928 ; RV32-V-NEXT: vmulh.vv v8, v8, v10
929 ; RV32-V-NEXT: li a0, 63
930 ; RV32-V-NEXT: vsrl.vx v10, v8, a0
931 ; RV32-V-NEXT: vsra.vi v8, v8, 1
932 ; RV32-V-NEXT: vadd.vv v8, v8, v10
933 ; RV32-V-NEXT: addi sp, sp, 16
936 ; ZVE64X-LABEL: vdiv_vi_nxv2i64_0:
938 ; ZVE64X-NEXT: li a0, -7
939 ; ZVE64X-NEXT: vsetvli a1, zero, e64, m2, ta, ma
940 ; ZVE64X-NEXT: vdiv.vx v8, v8, a0
943 ; RV64-V-LABEL: vdiv_vi_nxv2i64_0:
945 ; RV64-V-NEXT: lui a0, %hi(.LCPI61_0)
946 ; RV64-V-NEXT: ld a0, %lo(.LCPI61_0)(a0)
947 ; RV64-V-NEXT: vsetvli a1, zero, e64, m2, ta, ma
948 ; RV64-V-NEXT: vmulh.vx v8, v8, a0
949 ; RV64-V-NEXT: li a0, 63
950 ; RV64-V-NEXT: vsrl.vx v10, v8, a0
951 ; RV64-V-NEXT: vsra.vi v8, v8, 1
952 ; RV64-V-NEXT: vadd.vv v8, v8, v10
954 %head = insertelement <vscale x 2 x i64> poison, i64 -7, i32 0
955 %splat = shufflevector <vscale x 2 x i64> %head, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
956 %vc = sdiv <vscale x 2 x i64> %va, %splat
957 ret <vscale x 2 x i64> %vc
960 define <vscale x 4 x i64> @vdiv_vv_nxv4i64(<vscale x 4 x i64> %va, <vscale x 4 x i64> %vb) {
961 ; CHECK-LABEL: vdiv_vv_nxv4i64:
963 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
964 ; CHECK-NEXT: vdiv.vv v8, v8, v12
966 %vc = sdiv <vscale x 4 x i64> %va, %vb
967 ret <vscale x 4 x i64> %vc
970 define <vscale x 4 x i64> @vdiv_vx_nxv4i64(<vscale x 4 x i64> %va, i64 %b) {
971 ; RV32-LABEL: vdiv_vx_nxv4i64:
973 ; RV32-NEXT: addi sp, sp, -16
974 ; RV32-NEXT: .cfi_def_cfa_offset 16
975 ; RV32-NEXT: sw a1, 12(sp)
976 ; RV32-NEXT: sw a0, 8(sp)
977 ; RV32-NEXT: addi a0, sp, 8
978 ; RV32-NEXT: vsetvli a1, zero, e64, m4, ta, ma
979 ; RV32-NEXT: vlse64.v v12, (a0), zero
980 ; RV32-NEXT: vdiv.vv v8, v8, v12
981 ; RV32-NEXT: addi sp, sp, 16
984 ; RV64-LABEL: vdiv_vx_nxv4i64:
986 ; RV64-NEXT: vsetvli a1, zero, e64, m4, ta, ma
987 ; RV64-NEXT: vdiv.vx v8, v8, a0
989 %head = insertelement <vscale x 4 x i64> poison, i64 %b, i32 0
990 %splat = shufflevector <vscale x 4 x i64> %head, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
991 %vc = sdiv <vscale x 4 x i64> %va, %splat
992 ret <vscale x 4 x i64> %vc
995 define <vscale x 4 x i64> @vdiv_vi_nxv4i64_0(<vscale x 4 x i64> %va) {
996 ; RV32-V-LABEL: vdiv_vi_nxv4i64_0:
998 ; RV32-V-NEXT: addi sp, sp, -16
999 ; RV32-V-NEXT: .cfi_def_cfa_offset 16
1000 ; RV32-V-NEXT: lui a0, 748983
1001 ; RV32-V-NEXT: addi a0, a0, -586
1002 ; RV32-V-NEXT: sw a0, 12(sp)
1003 ; RV32-V-NEXT: lui a0, 898779
1004 ; RV32-V-NEXT: addi a0, a0, 1755
1005 ; RV32-V-NEXT: sw a0, 8(sp)
1006 ; RV32-V-NEXT: addi a0, sp, 8
1007 ; RV32-V-NEXT: vsetvli a1, zero, e64, m4, ta, ma
1008 ; RV32-V-NEXT: vlse64.v v12, (a0), zero
1009 ; RV32-V-NEXT: vmulh.vv v8, v8, v12
1010 ; RV32-V-NEXT: li a0, 63
1011 ; RV32-V-NEXT: vsrl.vx v12, v8, a0
1012 ; RV32-V-NEXT: vsra.vi v8, v8, 1
1013 ; RV32-V-NEXT: vadd.vv v8, v8, v12
1014 ; RV32-V-NEXT: addi sp, sp, 16
1017 ; ZVE64X-LABEL: vdiv_vi_nxv4i64_0:
1019 ; ZVE64X-NEXT: li a0, -7
1020 ; ZVE64X-NEXT: vsetvli a1, zero, e64, m4, ta, ma
1021 ; ZVE64X-NEXT: vdiv.vx v8, v8, a0
1024 ; RV64-V-LABEL: vdiv_vi_nxv4i64_0:
1026 ; RV64-V-NEXT: lui a0, %hi(.LCPI64_0)
1027 ; RV64-V-NEXT: ld a0, %lo(.LCPI64_0)(a0)
1028 ; RV64-V-NEXT: vsetvli a1, zero, e64, m4, ta, ma
1029 ; RV64-V-NEXT: vmulh.vx v8, v8, a0
1030 ; RV64-V-NEXT: li a0, 63
1031 ; RV64-V-NEXT: vsrl.vx v12, v8, a0
1032 ; RV64-V-NEXT: vsra.vi v8, v8, 1
1033 ; RV64-V-NEXT: vadd.vv v8, v8, v12
1035 %head = insertelement <vscale x 4 x i64> poison, i64 -7, i32 0
1036 %splat = shufflevector <vscale x 4 x i64> %head, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
1037 %vc = sdiv <vscale x 4 x i64> %va, %splat
1038 ret <vscale x 4 x i64> %vc
1041 define <vscale x 8 x i64> @vdiv_vv_nxv8i64(<vscale x 8 x i64> %va, <vscale x 8 x i64> %vb) {
1042 ; CHECK-LABEL: vdiv_vv_nxv8i64:
1044 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
1045 ; CHECK-NEXT: vdiv.vv v8, v8, v16
1047 %vc = sdiv <vscale x 8 x i64> %va, %vb
1048 ret <vscale x 8 x i64> %vc
1051 define <vscale x 8 x i64> @vdiv_vx_nxv8i64(<vscale x 8 x i64> %va, i64 %b) {
1052 ; RV32-LABEL: vdiv_vx_nxv8i64:
1054 ; RV32-NEXT: addi sp, sp, -16
1055 ; RV32-NEXT: .cfi_def_cfa_offset 16
1056 ; RV32-NEXT: sw a1, 12(sp)
1057 ; RV32-NEXT: sw a0, 8(sp)
1058 ; RV32-NEXT: addi a0, sp, 8
1059 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1060 ; RV32-NEXT: vlse64.v v16, (a0), zero
1061 ; RV32-NEXT: vdiv.vv v8, v8, v16
1062 ; RV32-NEXT: addi sp, sp, 16
1065 ; RV64-LABEL: vdiv_vx_nxv8i64:
1067 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1068 ; RV64-NEXT: vdiv.vx v8, v8, a0
1070 %head = insertelement <vscale x 8 x i64> poison, i64 %b, i32 0
1071 %splat = shufflevector <vscale x 8 x i64> %head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
1072 %vc = sdiv <vscale x 8 x i64> %va, %splat
1073 ret <vscale x 8 x i64> %vc
1076 define <vscale x 8 x i64> @vdiv_vi_nxv8i64_0(<vscale x 8 x i64> %va) {
1077 ; RV32-V-LABEL: vdiv_vi_nxv8i64_0:
1079 ; RV32-V-NEXT: addi sp, sp, -16
1080 ; RV32-V-NEXT: .cfi_def_cfa_offset 16
1081 ; RV32-V-NEXT: lui a0, 748983
1082 ; RV32-V-NEXT: addi a0, a0, -586
1083 ; RV32-V-NEXT: sw a0, 12(sp)
1084 ; RV32-V-NEXT: lui a0, 898779
1085 ; RV32-V-NEXT: addi a0, a0, 1755
1086 ; RV32-V-NEXT: sw a0, 8(sp)
1087 ; RV32-V-NEXT: addi a0, sp, 8
1088 ; RV32-V-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1089 ; RV32-V-NEXT: vlse64.v v16, (a0), zero
1090 ; RV32-V-NEXT: vmulh.vv v8, v8, v16
1091 ; RV32-V-NEXT: li a0, 63
1092 ; RV32-V-NEXT: vsrl.vx v16, v8, a0
1093 ; RV32-V-NEXT: vsra.vi v8, v8, 1
1094 ; RV32-V-NEXT: vadd.vv v8, v8, v16
1095 ; RV32-V-NEXT: addi sp, sp, 16
1098 ; ZVE64X-LABEL: vdiv_vi_nxv8i64_0:
1100 ; ZVE64X-NEXT: li a0, -7
1101 ; ZVE64X-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1102 ; ZVE64X-NEXT: vdiv.vx v8, v8, a0
1105 ; RV64-V-LABEL: vdiv_vi_nxv8i64_0:
1107 ; RV64-V-NEXT: lui a0, %hi(.LCPI67_0)
1108 ; RV64-V-NEXT: ld a0, %lo(.LCPI67_0)(a0)
1109 ; RV64-V-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1110 ; RV64-V-NEXT: vmulh.vx v8, v8, a0
1111 ; RV64-V-NEXT: li a0, 63
1112 ; RV64-V-NEXT: vsrl.vx v16, v8, a0
1113 ; RV64-V-NEXT: vsra.vi v8, v8, 1
1114 ; RV64-V-NEXT: vadd.vv v8, v8, v16
1116 %head = insertelement <vscale x 8 x i64> poison, i64 -7, i32 0
1117 %splat = shufflevector <vscale x 8 x i64> %head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
1118 %vc = sdiv <vscale x 8 x i64> %va, %splat
1119 ret <vscale x 8 x i64> %vc
1122 define <vscale x 8 x i32> @vdiv_vv_mask_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %vb, <vscale x 8 x i1> %mask) {
1123 ; CHECK-LABEL: vdiv_vv_mask_nxv8i32:
1125 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
1126 ; CHECK-NEXT: vmv.v.i v16, 1
1127 ; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0
1128 ; CHECK-NEXT: vdiv.vv v8, v8, v12
1130 %head = insertelement <vscale x 8 x i32> poison, i32 1, i32 0
1131 %one = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
1132 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x i32> %vb, <vscale x 8 x i32> %one
1133 %vc = sdiv <vscale x 8 x i32> %va, %vs
1134 ret <vscale x 8 x i32> %vc
1137 define <vscale x 8 x i32> @vdiv_vx_mask_nxv8i32(<vscale x 8 x i32> %va, i32 signext %b, <vscale x 8 x i1> %mask) {
1138 ; CHECK-LABEL: vdiv_vx_mask_nxv8i32:
1140 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1141 ; CHECK-NEXT: vmv.v.i v12, 1
1142 ; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0
1143 ; CHECK-NEXT: vdiv.vv v8, v8, v12
1145 %head1 = insertelement <vscale x 8 x i32> poison, i32 1, i32 0
1146 %one = shufflevector <vscale x 8 x i32> %head1, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
1147 %head2 = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
1148 %splat = shufflevector <vscale x 8 x i32> %head2, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
1149 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x i32> %splat, <vscale x 8 x i32> %one
1150 %vc = sdiv <vscale x 8 x i32> %va, %vs
1151 ret <vscale x 8 x i32> %vc
1154 define <vscale x 8 x i32> @vdiv_vi_mask_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i1> %mask) {
1155 ; CHECK-LABEL: vdiv_vi_mask_nxv8i32:
1157 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
1158 ; CHECK-NEXT: vmv.v.i v12, 1
1159 ; CHECK-NEXT: vmerge.vim v12, v12, 7, v0
1160 ; CHECK-NEXT: vdiv.vv v8, v8, v12
1162 %head1 = insertelement <vscale x 8 x i32> poison, i32 1, i32 0
1163 %one = shufflevector <vscale x 8 x i32> %head1, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
1164 %head2 = insertelement <vscale x 8 x i32> poison, i32 7, i32 0
1165 %splat = shufflevector <vscale x 8 x i32> %head2, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
1166 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x i32> %splat, <vscale x 8 x i32> %one
1167 %vc = sdiv <vscale x 8 x i32> %va, %vs
1168 ret <vscale x 8 x i32> %vc