1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv8.1m.main-none-none-eabi -mattr=+mve -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK
4 define arm_aapcs_vfpcc i32 @mul_v2i32(<2 x i32> %x) {
5 ; CHECK-LABEL: mul_v2i32:
6 ; CHECK: @ %bb.0: @ %entry
7 ; CHECK-NEXT: vmov r0, s2
8 ; CHECK-NEXT: vmov r1, s0
9 ; CHECK-NEXT: muls r0, r1, r0
12 %z = call i32 @llvm.vector.reduce.mul.v2i32(<2 x i32> %x)
16 define arm_aapcs_vfpcc i32 @mul_v4i32(<4 x i32> %x) {
17 ; CHECK-LABEL: mul_v4i32:
18 ; CHECK: @ %bb.0: @ %entry
19 ; CHECK-NEXT: vmov r0, r1, d1
20 ; CHECK-NEXT: muls r0, r1, r0
21 ; CHECK-NEXT: vmov r1, r2, d0
22 ; CHECK-NEXT: muls r1, r2, r1
23 ; CHECK-NEXT: muls r0, r1, r0
26 %z = call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %x)
30 define arm_aapcs_vfpcc i32 @mul_v8i32(<8 x i32> %x) {
31 ; CHECK-LABEL: mul_v8i32:
32 ; CHECK: @ %bb.0: @ %entry
33 ; CHECK-NEXT: vmul.i32 q0, q0, q1
34 ; CHECK-NEXT: vmov r0, r1, d1
35 ; CHECK-NEXT: muls r0, r1, r0
36 ; CHECK-NEXT: vmov r1, r2, d0
37 ; CHECK-NEXT: muls r1, r2, r1
38 ; CHECK-NEXT: muls r0, r1, r0
41 %z = call i32 @llvm.vector.reduce.mul.v8i32(<8 x i32> %x)
45 define arm_aapcs_vfpcc i16 @mul_v4i16(<4 x i16> %x) {
46 ; CHECK-LABEL: mul_v4i16:
47 ; CHECK: @ %bb.0: @ %entry
48 ; CHECK-NEXT: vmov r0, r1, d1
49 ; CHECK-NEXT: muls r0, r1, r0
50 ; CHECK-NEXT: vmov r1, r2, d0
51 ; CHECK-NEXT: muls r1, r2, r1
52 ; CHECK-NEXT: muls r0, r1, r0
55 %z = call i16 @llvm.vector.reduce.mul.v4i16(<4 x i16> %x)
59 define arm_aapcs_vfpcc i16 @mul_v8i16(<8 x i16> %x) {
60 ; CHECK-LABEL: mul_v8i16:
61 ; CHECK: @ %bb.0: @ %entry
62 ; CHECK-NEXT: vrev32.16 q1, q0
63 ; CHECK-NEXT: vmul.i16 q0, q0, q1
64 ; CHECK-NEXT: vmov.u16 r0, q0[6]
65 ; CHECK-NEXT: vmov.u16 r1, q0[4]
66 ; CHECK-NEXT: muls r0, r1, r0
67 ; CHECK-NEXT: vmov.u16 r1, q0[2]
68 ; CHECK-NEXT: vmov.u16 r2, q0[0]
69 ; CHECK-NEXT: muls r1, r2, r1
70 ; CHECK-NEXT: muls r0, r1, r0
73 %z = call i16 @llvm.vector.reduce.mul.v8i16(<8 x i16> %x)
77 define arm_aapcs_vfpcc i16 @mul_v16i16(<16 x i16> %x) {
78 ; CHECK-LABEL: mul_v16i16:
79 ; CHECK: @ %bb.0: @ %entry
80 ; CHECK-NEXT: vmul.i16 q0, q0, q1
81 ; CHECK-NEXT: vrev32.16 q1, q0
82 ; CHECK-NEXT: vmul.i16 q0, q0, q1
83 ; CHECK-NEXT: vmov.u16 r0, q0[6]
84 ; CHECK-NEXT: vmov.u16 r1, q0[4]
85 ; CHECK-NEXT: muls r0, r1, r0
86 ; CHECK-NEXT: vmov.u16 r1, q0[2]
87 ; CHECK-NEXT: vmov.u16 r2, q0[0]
88 ; CHECK-NEXT: muls r1, r2, r1
89 ; CHECK-NEXT: muls r0, r1, r0
92 %z = call i16 @llvm.vector.reduce.mul.v16i16(<16 x i16> %x)
96 define arm_aapcs_vfpcc i8 @mul_v8i8(<8 x i8> %x) {
97 ; CHECK-LABEL: mul_v8i8:
98 ; CHECK: @ %bb.0: @ %entry
99 ; CHECK-NEXT: vrev32.16 q1, q0
100 ; CHECK-NEXT: vmul.i16 q0, q0, q1
101 ; CHECK-NEXT: vmov.u16 r0, q0[6]
102 ; CHECK-NEXT: vmov.u16 r1, q0[4]
103 ; CHECK-NEXT: muls r0, r1, r0
104 ; CHECK-NEXT: vmov.u16 r1, q0[2]
105 ; CHECK-NEXT: vmov.u16 r2, q0[0]
106 ; CHECK-NEXT: muls r1, r2, r1
107 ; CHECK-NEXT: muls r0, r1, r0
110 %z = call i8 @llvm.vector.reduce.mul.v8i8(<8 x i8> %x)
114 define arm_aapcs_vfpcc i8 @mul_v16i8(<16 x i8> %x) {
115 ; CHECK-LABEL: mul_v16i8:
116 ; CHECK: @ %bb.0: @ %entry
117 ; CHECK-NEXT: vrev16.8 q1, q0
118 ; CHECK-NEXT: vmul.i8 q0, q0, q1
119 ; CHECK-NEXT: vrev32.8 q1, q0
120 ; CHECK-NEXT: vmul.i8 q0, q0, q1
121 ; CHECK-NEXT: vmov.u8 r0, q0[12]
122 ; CHECK-NEXT: vmov.u8 r1, q0[8]
123 ; CHECK-NEXT: muls r0, r1, r0
124 ; CHECK-NEXT: vmov.u8 r1, q0[4]
125 ; CHECK-NEXT: vmov.u8 r2, q0[0]
126 ; CHECK-NEXT: muls r1, r2, r1
127 ; CHECK-NEXT: muls r0, r1, r0
130 %z = call i8 @llvm.vector.reduce.mul.v16i8(<16 x i8> %x)
134 define arm_aapcs_vfpcc i8 @mul_v32i8(<32 x i8> %x) {
135 ; CHECK-LABEL: mul_v32i8:
136 ; CHECK: @ %bb.0: @ %entry
137 ; CHECK-NEXT: vmul.i8 q0, q0, q1
138 ; CHECK-NEXT: vrev16.8 q1, q0
139 ; CHECK-NEXT: vmul.i8 q0, q0, q1
140 ; CHECK-NEXT: vrev32.8 q1, q0
141 ; CHECK-NEXT: vmul.i8 q0, q0, q1
142 ; CHECK-NEXT: vmov.u8 r0, q0[12]
143 ; CHECK-NEXT: vmov.u8 r1, q0[8]
144 ; CHECK-NEXT: muls r0, r1, r0
145 ; CHECK-NEXT: vmov.u8 r1, q0[4]
146 ; CHECK-NEXT: vmov.u8 r2, q0[0]
147 ; CHECK-NEXT: muls r1, r2, r1
148 ; CHECK-NEXT: muls r0, r1, r0
151 %z = call i8 @llvm.vector.reduce.mul.v32i8(<32 x i8> %x)
155 define arm_aapcs_vfpcc i64 @mul_v1i64(<1 x i64> %x) {
156 ; CHECK-LABEL: mul_v1i64:
157 ; CHECK: @ %bb.0: @ %entry
160 %z = call i64 @llvm.vector.reduce.mul.v1i64(<1 x i64> %x)
164 define arm_aapcs_vfpcc i64 @mul_v2i64(<2 x i64> %x) {
165 ; CHECK-LABEL: mul_v2i64:
166 ; CHECK: @ %bb.0: @ %entry
167 ; CHECK-NEXT: .save {r7, lr}
168 ; CHECK-NEXT: push {r7, lr}
169 ; CHECK-NEXT: vmov r1, r12, d1
170 ; CHECK-NEXT: vmov r3, lr, d0
171 ; CHECK-NEXT: umull r0, r2, r3, r1
172 ; CHECK-NEXT: mla r2, r3, r12, r2
173 ; CHECK-NEXT: mla r1, lr, r1, r2
174 ; CHECK-NEXT: pop {r7, pc}
176 %z = call i64 @llvm.vector.reduce.mul.v2i64(<2 x i64> %x)
180 define arm_aapcs_vfpcc i64 @mul_v4i64(<4 x i64> %x) {
181 ; CHECK-LABEL: mul_v4i64:
182 ; CHECK: @ %bb.0: @ %entry
183 ; CHECK-NEXT: .save {r4, r5, r6, r7, r8, r9, r10, r11, lr}
184 ; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, r10, r11, lr}
185 ; CHECK-NEXT: vmov r1, r12, d1
186 ; CHECK-NEXT: vmov r3, lr, d0
187 ; CHECK-NEXT: vmov r5, r9, d2
188 ; CHECK-NEXT: vmov r6, r11, d3
189 ; CHECK-NEXT: umull r2, r8, r3, r1
190 ; CHECK-NEXT: mla r3, r3, r12, r8
191 ; CHECK-NEXT: umull r7, r10, r2, r5
192 ; CHECK-NEXT: mla r1, lr, r1, r3
193 ; CHECK-NEXT: mla r2, r2, r9, r10
194 ; CHECK-NEXT: umull r0, r4, r7, r6
195 ; CHECK-NEXT: mla r1, r1, r5, r2
196 ; CHECK-NEXT: mla r4, r7, r11, r4
197 ; CHECK-NEXT: mla r1, r1, r6, r4
198 ; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, r11, pc}
200 %z = call i64 @llvm.vector.reduce.mul.v4i64(<4 x i64> %x)
204 define arm_aapcs_vfpcc i32 @mul_v2i32_acc(<2 x i32> %x, i32 %y) {
205 ; CHECK-LABEL: mul_v2i32_acc:
206 ; CHECK: @ %bb.0: @ %entry
207 ; CHECK-NEXT: vmov r1, s2
208 ; CHECK-NEXT: vmov r2, s0
209 ; CHECK-NEXT: muls r1, r2, r1
210 ; CHECK-NEXT: muls r0, r1, r0
213 %z = call i32 @llvm.vector.reduce.mul.v2i32(<2 x i32> %x)
218 define arm_aapcs_vfpcc i32 @mul_v4i32_acc(<4 x i32> %x, i32 %y) {
219 ; CHECK-LABEL: mul_v4i32_acc:
220 ; CHECK: @ %bb.0: @ %entry
221 ; CHECK-NEXT: vmov r1, r2, d1
222 ; CHECK-NEXT: muls r1, r2, r1
223 ; CHECK-NEXT: vmov r2, r3, d0
224 ; CHECK-NEXT: muls r2, r3, r2
225 ; CHECK-NEXT: muls r1, r2, r1
226 ; CHECK-NEXT: muls r0, r1, r0
229 %z = call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %x)
234 define arm_aapcs_vfpcc i32 @mul_v8i32_acc(<8 x i32> %x, i32 %y) {
235 ; CHECK-LABEL: mul_v8i32_acc:
236 ; CHECK: @ %bb.0: @ %entry
237 ; CHECK-NEXT: vmul.i32 q0, q0, q1
238 ; CHECK-NEXT: vmov r1, r2, d1
239 ; CHECK-NEXT: muls r1, r2, r1
240 ; CHECK-NEXT: vmov r2, r3, d0
241 ; CHECK-NEXT: muls r2, r3, r2
242 ; CHECK-NEXT: muls r1, r2, r1
243 ; CHECK-NEXT: muls r0, r1, r0
246 %z = call i32 @llvm.vector.reduce.mul.v8i32(<8 x i32> %x)
251 define arm_aapcs_vfpcc i16 @mul_v4i16_acc(<4 x i16> %x, i16 %y) {
252 ; CHECK-LABEL: mul_v4i16_acc:
253 ; CHECK: @ %bb.0: @ %entry
254 ; CHECK-NEXT: vmov r1, r2, d1
255 ; CHECK-NEXT: muls r1, r2, r1
256 ; CHECK-NEXT: vmov r2, r3, d0
257 ; CHECK-NEXT: muls r2, r3, r2
258 ; CHECK-NEXT: muls r1, r2, r1
259 ; CHECK-NEXT: muls r0, r1, r0
262 %z = call i16 @llvm.vector.reduce.mul.v4i16(<4 x i16> %x)
267 define arm_aapcs_vfpcc i16 @mul_v8i16_acc(<8 x i16> %x, i16 %y) {
268 ; CHECK-LABEL: mul_v8i16_acc:
269 ; CHECK: @ %bb.0: @ %entry
270 ; CHECK-NEXT: vrev32.16 q1, q0
271 ; CHECK-NEXT: vmul.i16 q0, q0, q1
272 ; CHECK-NEXT: vmov.u16 r1, q0[6]
273 ; CHECK-NEXT: vmov.u16 r2, q0[4]
274 ; CHECK-NEXT: muls r1, r2, r1
275 ; CHECK-NEXT: vmov.u16 r2, q0[2]
276 ; CHECK-NEXT: vmov.u16 r3, q0[0]
277 ; CHECK-NEXT: muls r2, r3, r2
278 ; CHECK-NEXT: muls r1, r2, r1
279 ; CHECK-NEXT: muls r0, r1, r0
282 %z = call i16 @llvm.vector.reduce.mul.v8i16(<8 x i16> %x)
287 define arm_aapcs_vfpcc i16 @mul_v16i16_acc(<16 x i16> %x, i16 %y) {
288 ; CHECK-LABEL: mul_v16i16_acc:
289 ; CHECK: @ %bb.0: @ %entry
290 ; CHECK-NEXT: vmul.i16 q0, q0, q1
291 ; CHECK-NEXT: vrev32.16 q1, q0
292 ; CHECK-NEXT: vmul.i16 q0, q0, q1
293 ; CHECK-NEXT: vmov.u16 r1, q0[6]
294 ; CHECK-NEXT: vmov.u16 r2, q0[4]
295 ; CHECK-NEXT: muls r1, r2, r1
296 ; CHECK-NEXT: vmov.u16 r2, q0[2]
297 ; CHECK-NEXT: vmov.u16 r3, q0[0]
298 ; CHECK-NEXT: muls r2, r3, r2
299 ; CHECK-NEXT: muls r1, r2, r1
300 ; CHECK-NEXT: muls r0, r1, r0
303 %z = call i16 @llvm.vector.reduce.mul.v16i16(<16 x i16> %x)
308 define arm_aapcs_vfpcc i8 @mul_v8i8_acc(<8 x i8> %x, i8 %y) {
309 ; CHECK-LABEL: mul_v8i8_acc:
310 ; CHECK: @ %bb.0: @ %entry
311 ; CHECK-NEXT: vrev32.16 q1, q0
312 ; CHECK-NEXT: vmul.i16 q0, q0, q1
313 ; CHECK-NEXT: vmov.u16 r1, q0[6]
314 ; CHECK-NEXT: vmov.u16 r2, q0[4]
315 ; CHECK-NEXT: muls r1, r2, r1
316 ; CHECK-NEXT: vmov.u16 r2, q0[2]
317 ; CHECK-NEXT: vmov.u16 r3, q0[0]
318 ; CHECK-NEXT: muls r2, r3, r2
319 ; CHECK-NEXT: muls r1, r2, r1
320 ; CHECK-NEXT: muls r0, r1, r0
323 %z = call i8 @llvm.vector.reduce.mul.v8i8(<8 x i8> %x)
328 define arm_aapcs_vfpcc i8 @mul_v16i8_acc(<16 x i8> %x, i8 %y) {
329 ; CHECK-LABEL: mul_v16i8_acc:
330 ; CHECK: @ %bb.0: @ %entry
331 ; CHECK-NEXT: vrev16.8 q1, q0
332 ; CHECK-NEXT: vmul.i8 q0, q0, q1
333 ; CHECK-NEXT: vrev32.8 q1, q0
334 ; CHECK-NEXT: vmul.i8 q0, q0, q1
335 ; CHECK-NEXT: vmov.u8 r1, q0[12]
336 ; CHECK-NEXT: vmov.u8 r2, q0[8]
337 ; CHECK-NEXT: muls r1, r2, r1
338 ; CHECK-NEXT: vmov.u8 r2, q0[4]
339 ; CHECK-NEXT: vmov.u8 r3, q0[0]
340 ; CHECK-NEXT: muls r2, r3, r2
341 ; CHECK-NEXT: muls r1, r2, r1
342 ; CHECK-NEXT: muls r0, r1, r0
345 %z = call i8 @llvm.vector.reduce.mul.v16i8(<16 x i8> %x)
350 define arm_aapcs_vfpcc i8 @mul_v32i8_acc(<32 x i8> %x, i8 %y) {
351 ; CHECK-LABEL: mul_v32i8_acc:
352 ; CHECK: @ %bb.0: @ %entry
353 ; CHECK-NEXT: vmul.i8 q0, q0, q1
354 ; CHECK-NEXT: vrev16.8 q1, q0
355 ; CHECK-NEXT: vmul.i8 q0, q0, q1
356 ; CHECK-NEXT: vrev32.8 q1, q0
357 ; CHECK-NEXT: vmul.i8 q0, q0, q1
358 ; CHECK-NEXT: vmov.u8 r1, q0[12]
359 ; CHECK-NEXT: vmov.u8 r2, q0[8]
360 ; CHECK-NEXT: muls r1, r2, r1
361 ; CHECK-NEXT: vmov.u8 r2, q0[4]
362 ; CHECK-NEXT: vmov.u8 r3, q0[0]
363 ; CHECK-NEXT: muls r2, r3, r2
364 ; CHECK-NEXT: muls r1, r2, r1
365 ; CHECK-NEXT: muls r0, r1, r0
368 %z = call i8 @llvm.vector.reduce.mul.v32i8(<32 x i8> %x)
373 define arm_aapcs_vfpcc i64 @mul_v1i64_acc(<1 x i64> %x, i64 %y) {
374 ; CHECK-LABEL: mul_v1i64_acc:
375 ; CHECK: @ %bb.0: @ %entry
376 ; CHECK-NEXT: .save {r7, lr}
377 ; CHECK-NEXT: push {r7, lr}
378 ; CHECK-NEXT: umull r12, lr, r2, r0
379 ; CHECK-NEXT: mla r1, r2, r1, lr
380 ; CHECK-NEXT: mla r1, r3, r0, r1
381 ; CHECK-NEXT: mov r0, r12
382 ; CHECK-NEXT: pop {r7, pc}
384 %z = call i64 @llvm.vector.reduce.mul.v1i64(<1 x i64> %x)
389 define arm_aapcs_vfpcc i64 @mul_v2i64_acc(<2 x i64> %x, i64 %y) {
390 ; CHECK-LABEL: mul_v2i64_acc:
391 ; CHECK: @ %bb.0: @ %entry
392 ; CHECK-NEXT: .save {r4, r5, r7, lr}
393 ; CHECK-NEXT: push {r4, r5, r7, lr}
394 ; CHECK-NEXT: vmov r2, r12, d1
395 ; CHECK-NEXT: vmov r3, lr, d0
396 ; CHECK-NEXT: umull r4, r5, r3, r2
397 ; CHECK-NEXT: mla r3, r3, r12, r5
398 ; CHECK-NEXT: mla r3, lr, r2, r3
399 ; CHECK-NEXT: umull r2, r5, r0, r4
400 ; CHECK-NEXT: mla r0, r0, r3, r5
401 ; CHECK-NEXT: mla r1, r1, r4, r0
402 ; CHECK-NEXT: mov r0, r2
403 ; CHECK-NEXT: pop {r4, r5, r7, pc}
405 %z = call i64 @llvm.vector.reduce.mul.v2i64(<2 x i64> %x)
410 define arm_aapcs_vfpcc i64 @mul_v4i64_acc(<4 x i64> %x, i64 %y) {
411 ; CHECK-LABEL: mul_v4i64_acc:
412 ; CHECK: @ %bb.0: @ %entry
413 ; CHECK-NEXT: .save {r4, r5, r6, r7, r8, r9, r10, r11, lr}
414 ; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, r10, r11, lr}
415 ; CHECK-NEXT: .pad #12
416 ; CHECK-NEXT: sub sp, #12
417 ; CHECK-NEXT: mov lr, r0
418 ; CHECK-NEXT: vmov r2, r0, d1
419 ; CHECK-NEXT: vmov r6, r9, d2
420 ; CHECK-NEXT: str r1, [sp, #8] @ 4-byte Spill
421 ; CHECK-NEXT: vmov r7, r11, d3
422 ; CHECK-NEXT: str r0, [sp, #4] @ 4-byte Spill
423 ; CHECK-NEXT: vmov r3, r0, d0
424 ; CHECK-NEXT: ldr r1, [sp, #4] @ 4-byte Reload
425 ; CHECK-NEXT: str r0, [sp] @ 4-byte Spill
426 ; CHECK-NEXT: umull r4, r8, r3, r2
427 ; CHECK-NEXT: mla r3, r3, r1, r8
428 ; CHECK-NEXT: ldr r1, [sp] @ 4-byte Reload
429 ; CHECK-NEXT: umull r5, r10, r4, r6
430 ; CHECK-NEXT: mla r2, r1, r2, r3
431 ; CHECK-NEXT: mla r4, r4, r9, r10
432 ; CHECK-NEXT: umull r0, r12, r5, r7
433 ; CHECK-NEXT: mla r2, r2, r6, r4
434 ; CHECK-NEXT: mla r5, r5, r11, r12
435 ; CHECK-NEXT: mla r3, r2, r7, r5
436 ; CHECK-NEXT: umull r2, r7, lr, r0
437 ; CHECK-NEXT: mla r1, lr, r3, r7
438 ; CHECK-NEXT: ldr r3, [sp, #8] @ 4-byte Reload
439 ; CHECK-NEXT: mla r1, r3, r0, r1
440 ; CHECK-NEXT: mov r0, r2
441 ; CHECK-NEXT: add sp, #12
442 ; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, r11, pc}
444 %z = call i64 @llvm.vector.reduce.mul.v4i64(<4 x i64> %x)
449 declare i16 @llvm.vector.reduce.mul.v16i16(<16 x i16>)
450 declare i16 @llvm.vector.reduce.mul.v4i16(<4 x i16>)
451 declare i16 @llvm.vector.reduce.mul.v8i16(<8 x i16>)
452 declare i32 @llvm.vector.reduce.mul.v2i32(<2 x i32>)
453 declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>)
454 declare i32 @llvm.vector.reduce.mul.v8i32(<8 x i32>)
455 declare i64 @llvm.vector.reduce.mul.v1i64(<1 x i64>)
456 declare i64 @llvm.vector.reduce.mul.v2i64(<2 x i64>)
457 declare i64 @llvm.vector.reduce.mul.v4i64(<4 x i64>)
458 declare i8 @llvm.vector.reduce.mul.v16i8(<16 x i8>)
459 declare i8 @llvm.vector.reduce.mul.v32i8(<32 x i8>)
460 declare i8 @llvm.vector.reduce.mul.v8i8(<8 x i8>)