1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mattr=+sve -force-streaming-compatible-sve < %s | FileCheck %s --check-prefixes=CHECK,SVE
3 ; RUN: llc -mattr=+sve2 -force-streaming-compatible-sve < %s | FileCheck %s --check-prefixes=CHECK,SVE2
4 ; RUN: llc -mattr=+sme -force-streaming-compatible-sve < %s | FileCheck %s --check-prefixes=CHECK,SVE2
6 target triple = "aarch64-unknown-linux-gnu"
12 define <4 x i8> @sdiv_v4i8(<4 x i8> %op1, <4 x i8> %op2) {
13 ; CHECK-LABEL: sdiv_v4i8:
15 ; CHECK-NEXT: ptrue p0.h, vl4
16 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
17 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
18 ; CHECK-NEXT: sxtb z0.h, p0/m, z0.h
19 ; CHECK-NEXT: sxtb z1.h, p0/m, z1.h
20 ; CHECK-NEXT: ptrue p0.s, vl4
21 ; CHECK-NEXT: sunpklo z1.s, z1.h
22 ; CHECK-NEXT: sunpklo z0.s, z0.h
23 ; CHECK-NEXT: sdiv z0.s, p0/m, z0.s, z1.s
24 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
25 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
27 %res = sdiv <4 x i8> %op1, %op2
31 define <8 x i8> @sdiv_v8i8(<8 x i8> %op1, <8 x i8> %op2) {
32 ; CHECK-LABEL: sdiv_v8i8:
34 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
35 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
36 ; CHECK-NEXT: ptrue p0.s, vl4
37 ; CHECK-NEXT: sunpklo z1.h, z1.b
38 ; CHECK-NEXT: sunpklo z0.h, z0.b
39 ; CHECK-NEXT: sunpklo z2.s, z1.h
40 ; CHECK-NEXT: sunpklo z3.s, z0.h
41 ; CHECK-NEXT: ext z1.b, z1.b, z1.b, #8
42 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
43 ; CHECK-NEXT: sunpklo z1.s, z1.h
44 ; CHECK-NEXT: sunpklo z0.s, z0.h
45 ; CHECK-NEXT: sdivr z2.s, p0/m, z2.s, z3.s
46 ; CHECK-NEXT: sdiv z0.s, p0/m, z0.s, z1.s
47 ; CHECK-NEXT: ptrue p0.h, vl4
48 ; CHECK-NEXT: uzp1 z1.h, z2.h, z2.h
49 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
50 ; CHECK-NEXT: splice z1.h, p0, z1.h, z0.h
51 ; CHECK-NEXT: uzp1 z0.b, z1.b, z1.b
52 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
54 %res = sdiv <8 x i8> %op1, %op2
58 define <16 x i8> @sdiv_v16i8(<16 x i8> %op1, <16 x i8> %op2) {
59 ; CHECK-LABEL: sdiv_v16i8:
61 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
62 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
63 ; CHECK-NEXT: mov z2.d, z1.d
64 ; CHECK-NEXT: mov z3.d, z0.d
65 ; CHECK-NEXT: ptrue p0.s, vl4
66 ; CHECK-NEXT: ext z2.b, z2.b, z1.b, #8
67 ; CHECK-NEXT: ext z3.b, z3.b, z0.b, #8
68 ; CHECK-NEXT: sunpklo z1.h, z1.b
69 ; CHECK-NEXT: sunpklo z0.h, z0.b
70 ; CHECK-NEXT: sunpklo z2.h, z2.b
71 ; CHECK-NEXT: sunpklo z3.h, z3.b
72 ; CHECK-NEXT: sunpklo z4.s, z2.h
73 ; CHECK-NEXT: sunpklo z5.s, z3.h
74 ; CHECK-NEXT: ext z2.b, z2.b, z2.b, #8
75 ; CHECK-NEXT: ext z3.b, z3.b, z3.b, #8
76 ; CHECK-NEXT: sunpklo z2.s, z2.h
77 ; CHECK-NEXT: sunpklo z3.s, z3.h
78 ; CHECK-NEXT: sdivr z4.s, p0/m, z4.s, z5.s
79 ; CHECK-NEXT: sunpklo z5.s, z0.h
80 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
81 ; CHECK-NEXT: sunpklo z0.s, z0.h
82 ; CHECK-NEXT: sdivr z2.s, p0/m, z2.s, z3.s
83 ; CHECK-NEXT: sunpklo z3.s, z1.h
84 ; CHECK-NEXT: ext z1.b, z1.b, z1.b, #8
85 ; CHECK-NEXT: sunpklo z1.s, z1.h
86 ; CHECK-NEXT: sdivr z3.s, p0/m, z3.s, z5.s
87 ; CHECK-NEXT: uzp1 z2.h, z2.h, z2.h
88 ; CHECK-NEXT: sdiv z0.s, p0/m, z0.s, z1.s
89 ; CHECK-NEXT: ptrue p0.h, vl4
90 ; CHECK-NEXT: uzp1 z1.h, z4.h, z4.h
91 ; CHECK-NEXT: uzp1 z3.h, z3.h, z3.h
92 ; CHECK-NEXT: splice z1.h, p0, z1.h, z2.h
93 ; CHECK-NEXT: uzp1 z1.b, z1.b, z1.b
94 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
95 ; CHECK-NEXT: splice z3.h, p0, z3.h, z0.h
96 ; CHECK-NEXT: ptrue p0.b, vl8
97 ; CHECK-NEXT: uzp1 z0.b, z3.b, z3.b
98 ; CHECK-NEXT: splice z0.b, p0, z0.b, z1.b
99 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
101 %res = sdiv <16 x i8> %op1, %op2
105 define void @sdiv_v32i8(ptr %a, ptr %b) {
106 ; CHECK-LABEL: sdiv_v32i8:
108 ; CHECK-NEXT: ldp q6, q2, [x0]
109 ; CHECK-NEXT: ptrue p0.s, vl4
110 ; CHECK-NEXT: ldp q7, q3, [x1]
111 ; CHECK-NEXT: mov z1.d, z2.d
112 ; CHECK-NEXT: mov z16.d, z6.d
113 ; CHECK-NEXT: mov z0.d, z3.d
114 ; CHECK-NEXT: ext z1.b, z1.b, z2.b, #8
115 ; CHECK-NEXT: ext z16.b, z16.b, z6.b, #8
116 ; CHECK-NEXT: sunpklo z6.h, z6.b
117 ; CHECK-NEXT: ext z0.b, z0.b, z3.b, #8
118 ; CHECK-NEXT: sunpklo z3.h, z3.b
119 ; CHECK-NEXT: sunpklo z1.h, z1.b
120 ; CHECK-NEXT: sunpklo z16.h, z16.b
121 ; CHECK-NEXT: sunpklo z4.h, z0.b
122 ; CHECK-NEXT: sunpklo z5.s, z1.h
123 ; CHECK-NEXT: ext z1.b, z1.b, z1.b, #8
124 ; CHECK-NEXT: sunpklo z18.s, z16.h
125 ; CHECK-NEXT: sunpklo z0.s, z4.h
126 ; CHECK-NEXT: ext z4.b, z4.b, z4.b, #8
127 ; CHECK-NEXT: ext z16.b, z16.b, z16.b, #8
128 ; CHECK-NEXT: sunpklo z1.s, z1.h
129 ; CHECK-NEXT: sunpklo z4.s, z4.h
130 ; CHECK-NEXT: sunpklo z16.s, z16.h
131 ; CHECK-NEXT: sdivr z0.s, p0/m, z0.s, z5.s
132 ; CHECK-NEXT: sdiv z1.s, p0/m, z1.s, z4.s
133 ; CHECK-NEXT: sunpklo z4.h, z2.b
134 ; CHECK-NEXT: sunpklo z2.s, z3.h
135 ; CHECK-NEXT: ext z3.b, z3.b, z3.b, #8
136 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
137 ; CHECK-NEXT: sunpklo z5.s, z4.h
138 ; CHECK-NEXT: ext z4.b, z4.b, z4.b, #8
139 ; CHECK-NEXT: sunpklo z3.s, z3.h
140 ; CHECK-NEXT: sunpklo z4.s, z4.h
141 ; CHECK-NEXT: sdivr z2.s, p0/m, z2.s, z5.s
142 ; CHECK-NEXT: mov z5.d, z7.d
143 ; CHECK-NEXT: ext z5.b, z5.b, z7.b, #8
144 ; CHECK-NEXT: sunpklo z7.h, z7.b
145 ; CHECK-NEXT: uzp1 z1.h, z1.h, z1.h
146 ; CHECK-NEXT: sunpklo z5.h, z5.b
147 ; CHECK-NEXT: sunpklo z17.s, z5.h
148 ; CHECK-NEXT: ext z5.b, z5.b, z5.b, #8
149 ; CHECK-NEXT: sdivr z3.s, p0/m, z3.s, z4.s
150 ; CHECK-NEXT: sunpklo z5.s, z5.h
151 ; CHECK-NEXT: uzp1 z2.h, z2.h, z2.h
152 ; CHECK-NEXT: sdivr z17.s, p0/m, z17.s, z18.s
153 ; CHECK-NEXT: sunpklo z18.s, z6.h
154 ; CHECK-NEXT: ext z6.b, z6.b, z6.b, #8
155 ; CHECK-NEXT: sunpklo z6.s, z6.h
156 ; CHECK-NEXT: uzp1 z3.h, z3.h, z3.h
157 ; CHECK-NEXT: sdivr z5.s, p0/m, z5.s, z16.s
158 ; CHECK-NEXT: sunpklo z16.s, z7.h
159 ; CHECK-NEXT: ext z7.b, z7.b, z7.b, #8
160 ; CHECK-NEXT: sunpklo z7.s, z7.h
161 ; CHECK-NEXT: uzp1 z4.h, z17.h, z17.h
162 ; CHECK-NEXT: sdivr z16.s, p0/m, z16.s, z18.s
163 ; CHECK-NEXT: uzp1 z5.h, z5.h, z5.h
164 ; CHECK-NEXT: sdiv z6.s, p0/m, z6.s, z7.s
165 ; CHECK-NEXT: ptrue p0.h, vl4
166 ; CHECK-NEXT: uzp1 z7.h, z16.h, z16.h
167 ; CHECK-NEXT: splice z4.h, p0, z4.h, z5.h
168 ; CHECK-NEXT: splice z0.h, p0, z0.h, z1.h
169 ; CHECK-NEXT: splice z2.h, p0, z2.h, z3.h
170 ; CHECK-NEXT: uzp1 z1.b, z4.b, z4.b
171 ; CHECK-NEXT: uzp1 z0.b, z0.b, z0.b
172 ; CHECK-NEXT: uzp1 z2.b, z2.b, z2.b
173 ; CHECK-NEXT: uzp1 z6.h, z6.h, z6.h
174 ; CHECK-NEXT: splice z7.h, p0, z7.h, z6.h
175 ; CHECK-NEXT: ptrue p0.b, vl8
176 ; CHECK-NEXT: uzp1 z3.b, z7.b, z7.b
177 ; CHECK-NEXT: splice z2.b, p0, z2.b, z0.b
178 ; CHECK-NEXT: splice z3.b, p0, z3.b, z1.b
179 ; CHECK-NEXT: stp q3, q2, [x0]
181 %op1 = load <32 x i8>, ptr %a
182 %op2 = load <32 x i8>, ptr %b
183 %res = sdiv <32 x i8> %op1, %op2
184 store <32 x i8> %res, ptr %a
188 define <2 x i16> @sdiv_v2i16(<2 x i16> %op1, <2 x i16> %op2) {
189 ; CHECK-LABEL: sdiv_v2i16:
191 ; CHECK-NEXT: ptrue p0.s, vl2
192 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
193 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
194 ; CHECK-NEXT: sxth z1.s, p0/m, z1.s
195 ; CHECK-NEXT: sxth z0.s, p0/m, z0.s
196 ; CHECK-NEXT: sdiv z0.s, p0/m, z0.s, z1.s
197 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
199 %res = sdiv <2 x i16> %op1, %op2
203 define <4 x i16> @sdiv_v4i16(<4 x i16> %op1, <4 x i16> %op2) {
204 ; CHECK-LABEL: sdiv_v4i16:
206 ; CHECK-NEXT: ptrue p0.s, vl4
207 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
208 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
209 ; CHECK-NEXT: sunpklo z1.s, z1.h
210 ; CHECK-NEXT: sunpklo z0.s, z0.h
211 ; CHECK-NEXT: sdiv z0.s, p0/m, z0.s, z1.s
212 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
213 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
215 %res = sdiv <4 x i16> %op1, %op2
219 define <8 x i16> @sdiv_v8i16(<8 x i16> %op1, <8 x i16> %op2) {
220 ; CHECK-LABEL: sdiv_v8i16:
222 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
223 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
224 ; CHECK-NEXT: mov z2.d, z1.d
225 ; CHECK-NEXT: mov z3.d, z0.d
226 ; CHECK-NEXT: ptrue p0.s, vl4
227 ; CHECK-NEXT: ext z2.b, z2.b, z1.b, #8
228 ; CHECK-NEXT: ext z3.b, z3.b, z0.b, #8
229 ; CHECK-NEXT: sunpklo z1.s, z1.h
230 ; CHECK-NEXT: sunpklo z0.s, z0.h
231 ; CHECK-NEXT: sunpklo z2.s, z2.h
232 ; CHECK-NEXT: sunpklo z3.s, z3.h
233 ; CHECK-NEXT: sdiv z0.s, p0/m, z0.s, z1.s
234 ; CHECK-NEXT: sdivr z2.s, p0/m, z2.s, z3.s
235 ; CHECK-NEXT: ptrue p0.h, vl4
236 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
237 ; CHECK-NEXT: uzp1 z1.h, z2.h, z2.h
238 ; CHECK-NEXT: splice z0.h, p0, z0.h, z1.h
239 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
241 %res = sdiv <8 x i16> %op1, %op2
245 define void @sdiv_v16i16(ptr %a, ptr %b) {
246 ; CHECK-LABEL: sdiv_v16i16:
248 ; CHECK-NEXT: ldp q4, q1, [x1]
249 ; CHECK-NEXT: ptrue p0.s, vl4
250 ; CHECK-NEXT: ldr q0, [x0, #16]
251 ; CHECK-NEXT: mov z2.d, z1.d
252 ; CHECK-NEXT: mov z3.d, z0.d
253 ; CHECK-NEXT: mov z5.d, z4.d
254 ; CHECK-NEXT: ext z2.b, z2.b, z1.b, #8
255 ; CHECK-NEXT: ext z3.b, z3.b, z0.b, #8
256 ; CHECK-NEXT: ext z5.b, z5.b, z4.b, #8
257 ; CHECK-NEXT: sunpklo z4.s, z4.h
258 ; CHECK-NEXT: sunpklo z1.s, z1.h
259 ; CHECK-NEXT: sunpklo z0.s, z0.h
260 ; CHECK-NEXT: sunpklo z2.s, z2.h
261 ; CHECK-NEXT: sunpklo z3.s, z3.h
262 ; CHECK-NEXT: sunpklo z5.s, z5.h
263 ; CHECK-NEXT: sdiv z0.s, p0/m, z0.s, z1.s
264 ; CHECK-NEXT: sdivr z2.s, p0/m, z2.s, z3.s
265 ; CHECK-NEXT: ldr q3, [x0]
266 ; CHECK-NEXT: mov z6.d, z3.d
267 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
268 ; CHECK-NEXT: ext z6.b, z6.b, z3.b, #8
269 ; CHECK-NEXT: sunpklo z3.s, z3.h
270 ; CHECK-NEXT: sunpklo z6.s, z6.h
271 ; CHECK-NEXT: sdivr z5.s, p0/m, z5.s, z6.s
272 ; CHECK-NEXT: uzp1 z2.h, z2.h, z2.h
273 ; CHECK-NEXT: sdiv z3.s, p0/m, z3.s, z4.s
274 ; CHECK-NEXT: ptrue p0.h, vl4
275 ; CHECK-NEXT: uzp1 z1.h, z5.h, z5.h
276 ; CHECK-NEXT: splice z0.h, p0, z0.h, z2.h
277 ; CHECK-NEXT: uzp1 z3.h, z3.h, z3.h
278 ; CHECK-NEXT: splice z3.h, p0, z3.h, z1.h
279 ; CHECK-NEXT: stp q3, q0, [x0]
281 %op1 = load <16 x i16>, ptr %a
282 %op2 = load <16 x i16>, ptr %b
283 %res = sdiv <16 x i16> %op1, %op2
284 store <16 x i16> %res, ptr %a
288 define <2 x i32> @sdiv_v2i32(<2 x i32> %op1, <2 x i32> %op2) {
289 ; CHECK-LABEL: sdiv_v2i32:
291 ; CHECK-NEXT: ptrue p0.s, vl2
292 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
293 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
294 ; CHECK-NEXT: sdiv z0.s, p0/m, z0.s, z1.s
295 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
297 %res = sdiv <2 x i32> %op1, %op2
301 define <4 x i32> @sdiv_v4i32(<4 x i32> %op1, <4 x i32> %op2) {
302 ; CHECK-LABEL: sdiv_v4i32:
304 ; CHECK-NEXT: ptrue p0.s, vl4
305 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
306 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
307 ; CHECK-NEXT: sdiv z0.s, p0/m, z0.s, z1.s
308 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
310 %res = sdiv <4 x i32> %op1, %op2
314 define void @sdiv_v8i32(ptr %a, ptr %b) {
315 ; CHECK-LABEL: sdiv_v8i32:
317 ; CHECK-NEXT: ptrue p0.s, vl4
318 ; CHECK-NEXT: ldp q0, q3, [x1]
319 ; CHECK-NEXT: ldp q1, q2, [x0]
320 ; CHECK-NEXT: sdivr z0.s, p0/m, z0.s, z1.s
321 ; CHECK-NEXT: movprfx z1, z2
322 ; CHECK-NEXT: sdiv z1.s, p0/m, z1.s, z3.s
323 ; CHECK-NEXT: stp q0, q1, [x0]
325 %op1 = load <8 x i32>, ptr %a
326 %op2 = load <8 x i32>, ptr %b
327 %res = sdiv <8 x i32> %op1, %op2
328 store <8 x i32> %res, ptr %a
332 define <1 x i64> @sdiv_v1i64(<1 x i64> %op1, <1 x i64> %op2) {
333 ; CHECK-LABEL: sdiv_v1i64:
335 ; CHECK-NEXT: ptrue p0.d, vl1
336 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
337 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
338 ; CHECK-NEXT: sdiv z0.d, p0/m, z0.d, z1.d
339 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
341 %res = sdiv <1 x i64> %op1, %op2
345 define <2 x i64> @sdiv_v2i64(<2 x i64> %op1, <2 x i64> %op2) {
346 ; CHECK-LABEL: sdiv_v2i64:
348 ; CHECK-NEXT: ptrue p0.d, vl2
349 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
350 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
351 ; CHECK-NEXT: sdiv z0.d, p0/m, z0.d, z1.d
352 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
354 %res = sdiv <2 x i64> %op1, %op2
358 define void @sdiv_v4i64(ptr %a, ptr %b) {
359 ; CHECK-LABEL: sdiv_v4i64:
361 ; CHECK-NEXT: ptrue p0.d, vl2
362 ; CHECK-NEXT: ldp q0, q3, [x1]
363 ; CHECK-NEXT: ldp q1, q2, [x0]
364 ; CHECK-NEXT: sdivr z0.d, p0/m, z0.d, z1.d
365 ; CHECK-NEXT: movprfx z1, z2
366 ; CHECK-NEXT: sdiv z1.d, p0/m, z1.d, z3.d
367 ; CHECK-NEXT: stp q0, q1, [x0]
369 %op1 = load <4 x i64>, ptr %a
370 %op2 = load <4 x i64>, ptr %b
371 %res = sdiv <4 x i64> %op1, %op2
372 store <4 x i64> %res, ptr %a
380 define <4 x i8> @udiv_v4i8(<4 x i8> %op1, <4 x i8> %op2) {
381 ; CHECK-LABEL: udiv_v4i8:
383 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
384 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
385 ; CHECK-NEXT: ptrue p0.s, vl4
386 ; CHECK-NEXT: and z0.h, z0.h, #0xff
387 ; CHECK-NEXT: and z1.h, z1.h, #0xff
388 ; CHECK-NEXT: uunpklo z1.s, z1.h
389 ; CHECK-NEXT: uunpklo z0.s, z0.h
390 ; CHECK-NEXT: udiv z0.s, p0/m, z0.s, z1.s
391 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
392 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
394 %res = udiv <4 x i8> %op1, %op2
398 define <8 x i8> @udiv_v8i8(<8 x i8> %op1, <8 x i8> %op2) {
399 ; CHECK-LABEL: udiv_v8i8:
401 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
402 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
403 ; CHECK-NEXT: ptrue p0.s, vl4
404 ; CHECK-NEXT: uunpklo z1.h, z1.b
405 ; CHECK-NEXT: uunpklo z0.h, z0.b
406 ; CHECK-NEXT: uunpklo z2.s, z1.h
407 ; CHECK-NEXT: uunpklo z3.s, z0.h
408 ; CHECK-NEXT: ext z1.b, z1.b, z1.b, #8
409 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
410 ; CHECK-NEXT: uunpklo z1.s, z1.h
411 ; CHECK-NEXT: uunpklo z0.s, z0.h
412 ; CHECK-NEXT: udivr z2.s, p0/m, z2.s, z3.s
413 ; CHECK-NEXT: udiv z0.s, p0/m, z0.s, z1.s
414 ; CHECK-NEXT: ptrue p0.h, vl4
415 ; CHECK-NEXT: uzp1 z1.h, z2.h, z2.h
416 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
417 ; CHECK-NEXT: splice z1.h, p0, z1.h, z0.h
418 ; CHECK-NEXT: uzp1 z0.b, z1.b, z1.b
419 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
421 %res = udiv <8 x i8> %op1, %op2
425 define <16 x i8> @udiv_v16i8(<16 x i8> %op1, <16 x i8> %op2) {
426 ; CHECK-LABEL: udiv_v16i8:
428 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
429 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
430 ; CHECK-NEXT: mov z2.d, z1.d
431 ; CHECK-NEXT: mov z3.d, z0.d
432 ; CHECK-NEXT: ptrue p0.s, vl4
433 ; CHECK-NEXT: ext z2.b, z2.b, z1.b, #8
434 ; CHECK-NEXT: ext z3.b, z3.b, z0.b, #8
435 ; CHECK-NEXT: uunpklo z1.h, z1.b
436 ; CHECK-NEXT: uunpklo z0.h, z0.b
437 ; CHECK-NEXT: uunpklo z2.h, z2.b
438 ; CHECK-NEXT: uunpklo z3.h, z3.b
439 ; CHECK-NEXT: uunpklo z4.s, z2.h
440 ; CHECK-NEXT: uunpklo z5.s, z3.h
441 ; CHECK-NEXT: ext z2.b, z2.b, z2.b, #8
442 ; CHECK-NEXT: ext z3.b, z3.b, z3.b, #8
443 ; CHECK-NEXT: uunpklo z2.s, z2.h
444 ; CHECK-NEXT: uunpklo z3.s, z3.h
445 ; CHECK-NEXT: udivr z4.s, p0/m, z4.s, z5.s
446 ; CHECK-NEXT: uunpklo z5.s, z0.h
447 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
448 ; CHECK-NEXT: uunpklo z0.s, z0.h
449 ; CHECK-NEXT: udivr z2.s, p0/m, z2.s, z3.s
450 ; CHECK-NEXT: uunpklo z3.s, z1.h
451 ; CHECK-NEXT: ext z1.b, z1.b, z1.b, #8
452 ; CHECK-NEXT: uunpklo z1.s, z1.h
453 ; CHECK-NEXT: udivr z3.s, p0/m, z3.s, z5.s
454 ; CHECK-NEXT: uzp1 z2.h, z2.h, z2.h
455 ; CHECK-NEXT: udiv z0.s, p0/m, z0.s, z1.s
456 ; CHECK-NEXT: ptrue p0.h, vl4
457 ; CHECK-NEXT: uzp1 z1.h, z4.h, z4.h
458 ; CHECK-NEXT: uzp1 z3.h, z3.h, z3.h
459 ; CHECK-NEXT: splice z1.h, p0, z1.h, z2.h
460 ; CHECK-NEXT: uzp1 z1.b, z1.b, z1.b
461 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
462 ; CHECK-NEXT: splice z3.h, p0, z3.h, z0.h
463 ; CHECK-NEXT: ptrue p0.b, vl8
464 ; CHECK-NEXT: uzp1 z0.b, z3.b, z3.b
465 ; CHECK-NEXT: splice z0.b, p0, z0.b, z1.b
466 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
468 %res = udiv <16 x i8> %op1, %op2
472 define void @udiv_v32i8(ptr %a, ptr %b) {
473 ; CHECK-LABEL: udiv_v32i8:
475 ; CHECK-NEXT: ldp q6, q2, [x0]
476 ; CHECK-NEXT: ptrue p0.s, vl4
477 ; CHECK-NEXT: ldp q7, q3, [x1]
478 ; CHECK-NEXT: mov z1.d, z2.d
479 ; CHECK-NEXT: mov z16.d, z6.d
480 ; CHECK-NEXT: mov z0.d, z3.d
481 ; CHECK-NEXT: ext z1.b, z1.b, z2.b, #8
482 ; CHECK-NEXT: ext z16.b, z16.b, z6.b, #8
483 ; CHECK-NEXT: uunpklo z6.h, z6.b
484 ; CHECK-NEXT: ext z0.b, z0.b, z3.b, #8
485 ; CHECK-NEXT: uunpklo z3.h, z3.b
486 ; CHECK-NEXT: uunpklo z1.h, z1.b
487 ; CHECK-NEXT: uunpklo z16.h, z16.b
488 ; CHECK-NEXT: uunpklo z4.h, z0.b
489 ; CHECK-NEXT: uunpklo z5.s, z1.h
490 ; CHECK-NEXT: ext z1.b, z1.b, z1.b, #8
491 ; CHECK-NEXT: uunpklo z18.s, z16.h
492 ; CHECK-NEXT: uunpklo z0.s, z4.h
493 ; CHECK-NEXT: ext z4.b, z4.b, z4.b, #8
494 ; CHECK-NEXT: ext z16.b, z16.b, z16.b, #8
495 ; CHECK-NEXT: uunpklo z1.s, z1.h
496 ; CHECK-NEXT: uunpklo z4.s, z4.h
497 ; CHECK-NEXT: uunpklo z16.s, z16.h
498 ; CHECK-NEXT: udivr z0.s, p0/m, z0.s, z5.s
499 ; CHECK-NEXT: udiv z1.s, p0/m, z1.s, z4.s
500 ; CHECK-NEXT: uunpklo z4.h, z2.b
501 ; CHECK-NEXT: uunpklo z2.s, z3.h
502 ; CHECK-NEXT: ext z3.b, z3.b, z3.b, #8
503 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
504 ; CHECK-NEXT: uunpklo z5.s, z4.h
505 ; CHECK-NEXT: ext z4.b, z4.b, z4.b, #8
506 ; CHECK-NEXT: uunpklo z3.s, z3.h
507 ; CHECK-NEXT: uunpklo z4.s, z4.h
508 ; CHECK-NEXT: udivr z2.s, p0/m, z2.s, z5.s
509 ; CHECK-NEXT: mov z5.d, z7.d
510 ; CHECK-NEXT: ext z5.b, z5.b, z7.b, #8
511 ; CHECK-NEXT: uunpklo z7.h, z7.b
512 ; CHECK-NEXT: uzp1 z1.h, z1.h, z1.h
513 ; CHECK-NEXT: uunpklo z5.h, z5.b
514 ; CHECK-NEXT: uunpklo z17.s, z5.h
515 ; CHECK-NEXT: ext z5.b, z5.b, z5.b, #8
516 ; CHECK-NEXT: udivr z3.s, p0/m, z3.s, z4.s
517 ; CHECK-NEXT: uunpklo z5.s, z5.h
518 ; CHECK-NEXT: uzp1 z2.h, z2.h, z2.h
519 ; CHECK-NEXT: udivr z17.s, p0/m, z17.s, z18.s
520 ; CHECK-NEXT: uunpklo z18.s, z6.h
521 ; CHECK-NEXT: ext z6.b, z6.b, z6.b, #8
522 ; CHECK-NEXT: uunpklo z6.s, z6.h
523 ; CHECK-NEXT: uzp1 z3.h, z3.h, z3.h
524 ; CHECK-NEXT: udivr z5.s, p0/m, z5.s, z16.s
525 ; CHECK-NEXT: uunpklo z16.s, z7.h
526 ; CHECK-NEXT: ext z7.b, z7.b, z7.b, #8
527 ; CHECK-NEXT: uunpklo z7.s, z7.h
528 ; CHECK-NEXT: uzp1 z4.h, z17.h, z17.h
529 ; CHECK-NEXT: udivr z16.s, p0/m, z16.s, z18.s
530 ; CHECK-NEXT: uzp1 z5.h, z5.h, z5.h
531 ; CHECK-NEXT: udiv z6.s, p0/m, z6.s, z7.s
532 ; CHECK-NEXT: ptrue p0.h, vl4
533 ; CHECK-NEXT: uzp1 z7.h, z16.h, z16.h
534 ; CHECK-NEXT: splice z4.h, p0, z4.h, z5.h
535 ; CHECK-NEXT: splice z0.h, p0, z0.h, z1.h
536 ; CHECK-NEXT: splice z2.h, p0, z2.h, z3.h
537 ; CHECK-NEXT: uzp1 z1.b, z4.b, z4.b
538 ; CHECK-NEXT: uzp1 z0.b, z0.b, z0.b
539 ; CHECK-NEXT: uzp1 z2.b, z2.b, z2.b
540 ; CHECK-NEXT: uzp1 z6.h, z6.h, z6.h
541 ; CHECK-NEXT: splice z7.h, p0, z7.h, z6.h
542 ; CHECK-NEXT: ptrue p0.b, vl8
543 ; CHECK-NEXT: uzp1 z3.b, z7.b, z7.b
544 ; CHECK-NEXT: splice z2.b, p0, z2.b, z0.b
545 ; CHECK-NEXT: splice z3.b, p0, z3.b, z1.b
546 ; CHECK-NEXT: stp q3, q2, [x0]
548 %op1 = load <32 x i8>, ptr %a
549 %op2 = load <32 x i8>, ptr %b
550 %res = udiv <32 x i8> %op1, %op2
551 store <32 x i8> %res, ptr %a
555 define <2 x i16> @udiv_v2i16(<2 x i16> %op1, <2 x i16> %op2) {
556 ; CHECK-LABEL: udiv_v2i16:
558 ; CHECK-NEXT: ptrue p0.s, vl2
559 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
560 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
561 ; CHECK-NEXT: and z1.s, z1.s, #0xffff
562 ; CHECK-NEXT: and z0.s, z0.s, #0xffff
563 ; CHECK-NEXT: udiv z0.s, p0/m, z0.s, z1.s
564 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
566 %res = udiv <2 x i16> %op1, %op2
570 define <4 x i16> @udiv_v4i16(<4 x i16> %op1, <4 x i16> %op2) {
571 ; CHECK-LABEL: udiv_v4i16:
573 ; CHECK-NEXT: ptrue p0.s, vl4
574 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
575 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
576 ; CHECK-NEXT: uunpklo z1.s, z1.h
577 ; CHECK-NEXT: uunpklo z0.s, z0.h
578 ; CHECK-NEXT: udiv z0.s, p0/m, z0.s, z1.s
579 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
580 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
582 %res = udiv <4 x i16> %op1, %op2
586 define <8 x i16> @udiv_v8i16(<8 x i16> %op1, <8 x i16> %op2) {
587 ; CHECK-LABEL: udiv_v8i16:
589 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
590 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
591 ; CHECK-NEXT: mov z2.d, z1.d
592 ; CHECK-NEXT: mov z3.d, z0.d
593 ; CHECK-NEXT: ptrue p0.s, vl4
594 ; CHECK-NEXT: ext z2.b, z2.b, z1.b, #8
595 ; CHECK-NEXT: ext z3.b, z3.b, z0.b, #8
596 ; CHECK-NEXT: uunpklo z1.s, z1.h
597 ; CHECK-NEXT: uunpklo z0.s, z0.h
598 ; CHECK-NEXT: uunpklo z2.s, z2.h
599 ; CHECK-NEXT: uunpklo z3.s, z3.h
600 ; CHECK-NEXT: udiv z0.s, p0/m, z0.s, z1.s
601 ; CHECK-NEXT: udivr z2.s, p0/m, z2.s, z3.s
602 ; CHECK-NEXT: ptrue p0.h, vl4
603 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
604 ; CHECK-NEXT: uzp1 z1.h, z2.h, z2.h
605 ; CHECK-NEXT: splice z0.h, p0, z0.h, z1.h
606 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
608 %res = udiv <8 x i16> %op1, %op2
612 define void @udiv_v16i16(ptr %a, ptr %b) {
613 ; CHECK-LABEL: udiv_v16i16:
615 ; CHECK-NEXT: ldp q4, q1, [x1]
616 ; CHECK-NEXT: ptrue p0.s, vl4
617 ; CHECK-NEXT: ldr q0, [x0, #16]
618 ; CHECK-NEXT: mov z2.d, z1.d
619 ; CHECK-NEXT: mov z3.d, z0.d
620 ; CHECK-NEXT: mov z5.d, z4.d
621 ; CHECK-NEXT: ext z2.b, z2.b, z1.b, #8
622 ; CHECK-NEXT: ext z3.b, z3.b, z0.b, #8
623 ; CHECK-NEXT: ext z5.b, z5.b, z4.b, #8
624 ; CHECK-NEXT: uunpklo z4.s, z4.h
625 ; CHECK-NEXT: uunpklo z1.s, z1.h
626 ; CHECK-NEXT: uunpklo z0.s, z0.h
627 ; CHECK-NEXT: uunpklo z2.s, z2.h
628 ; CHECK-NEXT: uunpklo z3.s, z3.h
629 ; CHECK-NEXT: uunpklo z5.s, z5.h
630 ; CHECK-NEXT: udiv z0.s, p0/m, z0.s, z1.s
631 ; CHECK-NEXT: udivr z2.s, p0/m, z2.s, z3.s
632 ; CHECK-NEXT: ldr q3, [x0]
633 ; CHECK-NEXT: mov z6.d, z3.d
634 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
635 ; CHECK-NEXT: ext z6.b, z6.b, z3.b, #8
636 ; CHECK-NEXT: uunpklo z3.s, z3.h
637 ; CHECK-NEXT: uunpklo z6.s, z6.h
638 ; CHECK-NEXT: udivr z5.s, p0/m, z5.s, z6.s
639 ; CHECK-NEXT: uzp1 z2.h, z2.h, z2.h
640 ; CHECK-NEXT: udiv z3.s, p0/m, z3.s, z4.s
641 ; CHECK-NEXT: ptrue p0.h, vl4
642 ; CHECK-NEXT: uzp1 z1.h, z5.h, z5.h
643 ; CHECK-NEXT: splice z0.h, p0, z0.h, z2.h
644 ; CHECK-NEXT: uzp1 z3.h, z3.h, z3.h
645 ; CHECK-NEXT: splice z3.h, p0, z3.h, z1.h
646 ; CHECK-NEXT: stp q3, q0, [x0]
648 %op1 = load <16 x i16>, ptr %a
649 %op2 = load <16 x i16>, ptr %b
650 %res = udiv <16 x i16> %op1, %op2
651 store <16 x i16> %res, ptr %a
655 define <2 x i32> @udiv_v2i32(<2 x i32> %op1, <2 x i32> %op2) {
656 ; CHECK-LABEL: udiv_v2i32:
658 ; CHECK-NEXT: ptrue p0.s, vl2
659 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
660 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
661 ; CHECK-NEXT: udiv z0.s, p0/m, z0.s, z1.s
662 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
664 %res = udiv <2 x i32> %op1, %op2
668 define <4 x i32> @udiv_v4i32(<4 x i32> %op1, <4 x i32> %op2) {
669 ; CHECK-LABEL: udiv_v4i32:
671 ; CHECK-NEXT: ptrue p0.s, vl4
672 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
673 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
674 ; CHECK-NEXT: udiv z0.s, p0/m, z0.s, z1.s
675 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
677 %res = udiv <4 x i32> %op1, %op2
681 define void @udiv_v8i32(ptr %a, ptr %b) {
682 ; CHECK-LABEL: udiv_v8i32:
684 ; CHECK-NEXT: ptrue p0.s, vl4
685 ; CHECK-NEXT: ldp q0, q3, [x1]
686 ; CHECK-NEXT: ldp q1, q2, [x0]
687 ; CHECK-NEXT: udivr z0.s, p0/m, z0.s, z1.s
688 ; CHECK-NEXT: movprfx z1, z2
689 ; CHECK-NEXT: udiv z1.s, p0/m, z1.s, z3.s
690 ; CHECK-NEXT: stp q0, q1, [x0]
692 %op1 = load <8 x i32>, ptr %a
693 %op2 = load <8 x i32>, ptr %b
694 %res = udiv <8 x i32> %op1, %op2
695 store <8 x i32> %res, ptr %a
699 define <1 x i64> @udiv_v1i64(<1 x i64> %op1, <1 x i64> %op2) {
700 ; CHECK-LABEL: udiv_v1i64:
702 ; CHECK-NEXT: ptrue p0.d, vl1
703 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
704 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
705 ; CHECK-NEXT: udiv z0.d, p0/m, z0.d, z1.d
706 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
708 %res = udiv <1 x i64> %op1, %op2
712 define <2 x i64> @udiv_v2i64(<2 x i64> %op1, <2 x i64> %op2) {
713 ; CHECK-LABEL: udiv_v2i64:
715 ; CHECK-NEXT: ptrue p0.d, vl2
716 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
717 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
718 ; CHECK-NEXT: udiv z0.d, p0/m, z0.d, z1.d
719 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
721 %res = udiv <2 x i64> %op1, %op2
725 define void @udiv_v4i64(ptr %a, ptr %b) {
726 ; CHECK-LABEL: udiv_v4i64:
728 ; CHECK-NEXT: ptrue p0.d, vl2
729 ; CHECK-NEXT: ldp q0, q3, [x1]
730 ; CHECK-NEXT: ldp q1, q2, [x0]
731 ; CHECK-NEXT: udivr z0.d, p0/m, z0.d, z1.d
732 ; CHECK-NEXT: movprfx z1, z2
733 ; CHECK-NEXT: udiv z1.d, p0/m, z1.d, z3.d
734 ; CHECK-NEXT: stp q0, q1, [x0]
736 %op1 = load <4 x i64>, ptr %a
737 %op2 = load <4 x i64>, ptr %b
738 %res = udiv <4 x i64> %op1, %op2
739 store <4 x i64> %res, ptr %a
743 define void @udiv_constantsplat_v8i32(ptr %a) {
744 ; SVE-LABEL: udiv_constantsplat_v8i32:
746 ; SVE-NEXT: ptrue p0.s, vl4
747 ; SVE-NEXT: mov w8, #8969 // =0x2309
748 ; SVE-NEXT: movk w8, #22765, lsl #16
749 ; SVE-NEXT: ldp q1, q2, [x0]
750 ; SVE-NEXT: mov z0.s, w8
751 ; SVE-NEXT: movprfx z3, z1
752 ; SVE-NEXT: umulh z3.s, p0/m, z3.s, z0.s
753 ; SVE-NEXT: sub z1.s, z1.s, z3.s
754 ; SVE-NEXT: umulh z0.s, p0/m, z0.s, z2.s
755 ; SVE-NEXT: lsr z1.s, z1.s, #1
756 ; SVE-NEXT: sub z2.s, z2.s, z0.s
757 ; SVE-NEXT: add z1.s, z1.s, z3.s
758 ; SVE-NEXT: lsr z2.s, z2.s, #1
759 ; SVE-NEXT: lsr z1.s, z1.s, #6
760 ; SVE-NEXT: add z0.s, z2.s, z0.s
761 ; SVE-NEXT: lsr z0.s, z0.s, #6
762 ; SVE-NEXT: stp q1, q0, [x0]
765 ; SVE2-LABEL: udiv_constantsplat_v8i32:
767 ; SVE2-NEXT: mov w8, #8969 // =0x2309
768 ; SVE2-NEXT: ldp q1, q2, [x0]
769 ; SVE2-NEXT: movk w8, #22765, lsl #16
770 ; SVE2-NEXT: mov z0.s, w8
771 ; SVE2-NEXT: umulh z3.s, z1.s, z0.s
772 ; SVE2-NEXT: umulh z0.s, z2.s, z0.s
773 ; SVE2-NEXT: sub z1.s, z1.s, z3.s
774 ; SVE2-NEXT: sub z2.s, z2.s, z0.s
775 ; SVE2-NEXT: usra z3.s, z1.s, #1
776 ; SVE2-NEXT: usra z0.s, z2.s, #1
777 ; SVE2-NEXT: lsr z1.s, z3.s, #6
778 ; SVE2-NEXT: lsr z0.s, z0.s, #6
779 ; SVE2-NEXT: stp q1, q0, [x0]
781 %op1 = load <8 x i32>, ptr %a
782 %res = udiv <8 x i32> %op1, <i32 95, i32 95, i32 95, i32 95, i32 95, i32 95, i32 95, i32 95>
783 store <8 x i32> %res, ptr %a