1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv8.1m.main-arm-none-eabi -mattr=+mve -verify-machineinstrs %s -o - | FileCheck %s
4 define arm_aapcs_vfpcc <16 x i8> @sadd_int8_t(<16 x i8> %src1, <16 x i8> %src2) {
5 ; CHECK-LABEL: sadd_int8_t:
6 ; CHECK: @ %bb.0: @ %entry
7 ; CHECK-NEXT: vqadd.s8 q0, q0, q1
10 %0 = call <16 x i8> @llvm.sadd.sat.v16i8(<16 x i8> %src1, <16 x i8> %src2)
14 define arm_aapcs_vfpcc <8 x i16> @sadd_int16_t(<8 x i16> %src1, <8 x i16> %src2) {
15 ; CHECK-LABEL: sadd_int16_t:
16 ; CHECK: @ %bb.0: @ %entry
17 ; CHECK-NEXT: vqadd.s16 q0, q0, q1
20 %0 = call <8 x i16> @llvm.sadd.sat.v8i16(<8 x i16> %src1, <8 x i16> %src2)
24 define arm_aapcs_vfpcc <4 x i32> @sadd_int32_t(<4 x i32> %src1, <4 x i32> %src2) {
25 ; CHECK-LABEL: sadd_int32_t:
26 ; CHECK: @ %bb.0: @ %entry
27 ; CHECK-NEXT: vqadd.s32 q0, q0, q1
30 %0 = call <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32> %src1, <4 x i32> %src2)
34 define arm_aapcs_vfpcc <2 x i64> @sadd_int64_t(<2 x i64> %src1, <2 x i64> %src2) {
35 ; CHECK-LABEL: sadd_int64_t:
36 ; CHECK: @ %bb.0: @ %entry
37 ; CHECK-NEXT: .save {r4, r5, r6, r7, r8, lr}
38 ; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, lr}
39 ; CHECK-NEXT: vmov r0, s4
40 ; CHECK-NEXT: vmov r5, s0
41 ; CHECK-NEXT: vmov r8, s5
42 ; CHECK-NEXT: vmov r4, s1
43 ; CHECK-NEXT: vmov r7, s2
44 ; CHECK-NEXT: vmov r3, s7
45 ; CHECK-NEXT: vmov r6, s3
46 ; CHECK-NEXT: adds.w r12, r5, r0
47 ; CHECK-NEXT: adc.w r0, r4, r8
48 ; CHECK-NEXT: asrs r2, r0, #31
49 ; CHECK-NEXT: vmov.32 q2[0], r2
50 ; CHECK-NEXT: vmov.32 q2[1], r2
51 ; CHECK-NEXT: vmov r2, s6
52 ; CHECK-NEXT: adds.w lr, r7, r2
53 ; CHECK-NEXT: adc.w r2, r6, r3
54 ; CHECK-NEXT: subs.w r5, r12, r5
55 ; CHECK-NEXT: sbcs.w r4, r0, r4
56 ; CHECK-NEXT: asr.w r1, r2, #31
57 ; CHECK-NEXT: mov.w r4, #0
58 ; CHECK-NEXT: vmov.32 q2[2], r1
60 ; CHECK-NEXT: movlt r4, #1
61 ; CHECK-NEXT: vmov.32 q2[3], r1
62 ; CHECK-NEXT: adr r1, .LCPI3_0
63 ; CHECK-NEXT: vldrw.u32 q0, [r1]
64 ; CHECK-NEXT: adr r1, .LCPI3_1
65 ; CHECK-NEXT: vldrw.u32 q1, [r1]
66 ; CHECK-NEXT: cmp r4, #0
67 ; CHECK-NEXT: vbic q0, q0, q2
68 ; CHECK-NEXT: csetm r4, ne
69 ; CHECK-NEXT: vand q1, q1, q2
70 ; CHECK-NEXT: movs r1, #0
71 ; CHECK-NEXT: vorr q0, q1, q0
72 ; CHECK-NEXT: vmov.32 q1[0], r4
73 ; CHECK-NEXT: vmov.32 q1[1], r4
74 ; CHECK-NEXT: subs.w r4, lr, r7
75 ; CHECK-NEXT: sbcs.w r4, r2, r6
77 ; CHECK-NEXT: movlt r1, #1
78 ; CHECK-NEXT: cmp r1, #0
79 ; CHECK-NEXT: csetm r1, ne
80 ; CHECK-NEXT: vmov.32 q1[2], r1
81 ; CHECK-NEXT: vmov.32 q1[3], r1
82 ; CHECK-NEXT: asr.w r1, r8, #31
83 ; CHECK-NEXT: vmov.32 q2[0], r1
84 ; CHECK-NEXT: vmov.32 q2[1], r1
85 ; CHECK-NEXT: asrs r1, r3, #31
86 ; CHECK-NEXT: vmov.32 q2[2], r1
87 ; CHECK-NEXT: vmov.32 q2[3], r1
88 ; CHECK-NEXT: veor q1, q2, q1
89 ; CHECK-NEXT: vmov.32 q2[0], r12
90 ; CHECK-NEXT: vmov.32 q2[1], r0
91 ; CHECK-NEXT: vand q0, q0, q1
92 ; CHECK-NEXT: vmov.32 q2[2], lr
93 ; CHECK-NEXT: vmov.32 q2[3], r2
94 ; CHECK-NEXT: vbic q1, q2, q1
95 ; CHECK-NEXT: vorr q0, q0, q1
96 ; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, pc}
97 ; CHECK-NEXT: .p2align 4
98 ; CHECK-NEXT: @ %bb.1:
99 ; CHECK-NEXT: .LCPI3_0:
100 ; CHECK-NEXT: .long 0 @ 0x0
101 ; CHECK-NEXT: .long 2147483648 @ 0x80000000
102 ; CHECK-NEXT: .long 0 @ 0x0
103 ; CHECK-NEXT: .long 2147483648 @ 0x80000000
104 ; CHECK-NEXT: .LCPI3_1:
105 ; CHECK-NEXT: .long 4294967295 @ 0xffffffff
106 ; CHECK-NEXT: .long 2147483647 @ 0x7fffffff
107 ; CHECK-NEXT: .long 4294967295 @ 0xffffffff
108 ; CHECK-NEXT: .long 2147483647 @ 0x7fffffff
110 %0 = call <2 x i64> @llvm.sadd.sat.v2i64(<2 x i64> %src1, <2 x i64> %src2)
114 define arm_aapcs_vfpcc <16 x i8> @uadd_int8_t(<16 x i8> %src1, <16 x i8> %src2) {
115 ; CHECK-LABEL: uadd_int8_t:
116 ; CHECK: @ %bb.0: @ %entry
117 ; CHECK-NEXT: vqadd.u8 q0, q0, q1
120 %0 = call <16 x i8> @llvm.uadd.sat.v16i8(<16 x i8> %src1, <16 x i8> %src2)
124 define arm_aapcs_vfpcc <8 x i16> @uadd_int16_t(<8 x i16> %src1, <8 x i16> %src2) {
125 ; CHECK-LABEL: uadd_int16_t:
126 ; CHECK: @ %bb.0: @ %entry
127 ; CHECK-NEXT: vqadd.u16 q0, q0, q1
130 %0 = call <8 x i16> @llvm.uadd.sat.v8i16(<8 x i16> %src1, <8 x i16> %src2)
134 define arm_aapcs_vfpcc <4 x i32> @uadd_int32_t(<4 x i32> %src1, <4 x i32> %src2) {
135 ; CHECK-LABEL: uadd_int32_t:
136 ; CHECK: @ %bb.0: @ %entry
137 ; CHECK-NEXT: vqadd.u32 q0, q0, q1
140 %0 = call <4 x i32> @llvm.uadd.sat.v4i32(<4 x i32> %src1, <4 x i32> %src2)
144 define arm_aapcs_vfpcc <2 x i64> @uadd_int64_t(<2 x i64> %src1, <2 x i64> %src2) {
145 ; CHECK-LABEL: uadd_int64_t:
146 ; CHECK: @ %bb.0: @ %entry
147 ; CHECK-NEXT: .save {r4, lr}
148 ; CHECK-NEXT: push {r4, lr}
149 ; CHECK-NEXT: vmov r2, s4
150 ; CHECK-NEXT: vmov r3, s0
151 ; CHECK-NEXT: vmov r0, s5
152 ; CHECK-NEXT: vmov r1, s1
153 ; CHECK-NEXT: vmov r4, s2
154 ; CHECK-NEXT: adds.w lr, r3, r2
155 ; CHECK-NEXT: vmov r2, s6
156 ; CHECK-NEXT: adc.w r12, r1, r0
157 ; CHECK-NEXT: subs.w r3, lr, r3
158 ; CHECK-NEXT: sbcs.w r1, r12, r1
159 ; CHECK-NEXT: vmov r3, s3
160 ; CHECK-NEXT: mov.w r1, #0
161 ; CHECK-NEXT: mov.w r0, #0
163 ; CHECK-NEXT: movlo r1, #1
164 ; CHECK-NEXT: cmp r1, #0
165 ; CHECK-NEXT: csetm r1, ne
166 ; CHECK-NEXT: vmov.32 q0[0], lr
167 ; CHECK-NEXT: vmov.32 q2[0], r1
168 ; CHECK-NEXT: vmov.32 q0[1], r12
169 ; CHECK-NEXT: vmov.32 q2[1], r1
170 ; CHECK-NEXT: vmov r1, s7
171 ; CHECK-NEXT: adds r2, r2, r4
172 ; CHECK-NEXT: vmov.32 q0[2], r2
173 ; CHECK-NEXT: adcs r1, r3
174 ; CHECK-NEXT: subs r4, r2, r4
175 ; CHECK-NEXT: sbcs.w r3, r1, r3
177 ; CHECK-NEXT: movlo r0, #1
178 ; CHECK-NEXT: cmp r0, #0
179 ; CHECK-NEXT: vmov.32 q0[3], r1
180 ; CHECK-NEXT: csetm r0, ne
181 ; CHECK-NEXT: vmov.32 q2[2], r0
182 ; CHECK-NEXT: vmov.32 q2[3], r0
183 ; CHECK-NEXT: vorr q0, q0, q2
184 ; CHECK-NEXT: pop {r4, pc}
186 %0 = call <2 x i64> @llvm.uadd.sat.v2i64(<2 x i64> %src1, <2 x i64> %src2)
191 define arm_aapcs_vfpcc <16 x i8> @ssub_int8_t(<16 x i8> %src1, <16 x i8> %src2) {
192 ; CHECK-LABEL: ssub_int8_t:
193 ; CHECK: @ %bb.0: @ %entry
194 ; CHECK-NEXT: vqsub.s8 q0, q0, q1
197 %0 = call <16 x i8> @llvm.ssub.sat.v16i8(<16 x i8> %src1, <16 x i8> %src2)
201 define arm_aapcs_vfpcc <8 x i16> @ssub_int16_t(<8 x i16> %src1, <8 x i16> %src2) {
202 ; CHECK-LABEL: ssub_int16_t:
203 ; CHECK: @ %bb.0: @ %entry
204 ; CHECK-NEXT: vqsub.s16 q0, q0, q1
207 %0 = call <8 x i16> @llvm.ssub.sat.v8i16(<8 x i16> %src1, <8 x i16> %src2)
211 define arm_aapcs_vfpcc <4 x i32> @ssub_int32_t(<4 x i32> %src1, <4 x i32> %src2) {
212 ; CHECK-LABEL: ssub_int32_t:
213 ; CHECK: @ %bb.0: @ %entry
214 ; CHECK-NEXT: vqsub.s32 q0, q0, q1
217 %0 = call <4 x i32> @llvm.ssub.sat.v4i32(<4 x i32> %src1, <4 x i32> %src2)
221 define arm_aapcs_vfpcc <2 x i64> @ssub_int64_t(<2 x i64> %src1, <2 x i64> %src2) {
222 ; CHECK-LABEL: ssub_int64_t:
223 ; CHECK: @ %bb.0: @ %entry
224 ; CHECK-NEXT: .save {r4, r5, r6, lr}
225 ; CHECK-NEXT: push {r4, r5, r6, lr}
226 ; CHECK-NEXT: .vsave {d8, d9}
227 ; CHECK-NEXT: vpush {d8, d9}
228 ; CHECK-NEXT: vmov r2, s4
229 ; CHECK-NEXT: movs r0, #0
230 ; CHECK-NEXT: vmov lr, s5
231 ; CHECK-NEXT: vmov r12, s7
232 ; CHECK-NEXT: vmov r5, s0
233 ; CHECK-NEXT: vmov r4, s1
234 ; CHECK-NEXT: rsbs r3, r2, #0
235 ; CHECK-NEXT: sbcs.w r3, r0, lr
236 ; CHECK-NEXT: mov.w r3, #0
238 ; CHECK-NEXT: movlt r3, #1
239 ; CHECK-NEXT: cmp r3, #0
240 ; CHECK-NEXT: csetm r3, ne
241 ; CHECK-NEXT: vmov.32 q2[0], r3
242 ; CHECK-NEXT: vmov.32 q2[1], r3
243 ; CHECK-NEXT: vmov r3, s6
244 ; CHECK-NEXT: rsbs r1, r3, #0
245 ; CHECK-NEXT: sbcs.w r1, r0, r12
246 ; CHECK-NEXT: mov.w r1, #0
248 ; CHECK-NEXT: movlt r1, #1
249 ; CHECK-NEXT: cmp r1, #0
250 ; CHECK-NEXT: csetm r1, ne
251 ; CHECK-NEXT: subs r6, r5, r2
252 ; CHECK-NEXT: vmov.32 q2[2], r1
253 ; CHECK-NEXT: vmov.32 q2[3], r1
254 ; CHECK-NEXT: sbc.w r1, r4, lr
255 ; CHECK-NEXT: subs r5, r6, r5
256 ; CHECK-NEXT: sbcs.w r5, r1, r4
257 ; CHECK-NEXT: vmov r4, s2
258 ; CHECK-NEXT: mov.w r5, #0
260 ; CHECK-NEXT: movlt r5, #1
261 ; CHECK-NEXT: cmp r5, #0
262 ; CHECK-NEXT: csetm r5, ne
263 ; CHECK-NEXT: vmov.32 q1[0], r5
264 ; CHECK-NEXT: vmov.32 q1[1], r5
265 ; CHECK-NEXT: vmov r5, s3
266 ; CHECK-NEXT: subs r3, r4, r3
267 ; CHECK-NEXT: sbc.w r2, r5, r12
268 ; CHECK-NEXT: subs r4, r3, r4
269 ; CHECK-NEXT: sbcs.w r5, r2, r5
271 ; CHECK-NEXT: movlt r0, #1
272 ; CHECK-NEXT: cmp r0, #0
273 ; CHECK-NEXT: csetm r0, ne
274 ; CHECK-NEXT: vmov.32 q1[2], r0
275 ; CHECK-NEXT: vmov.32 q1[3], r0
276 ; CHECK-NEXT: asrs r0, r1, #31
277 ; CHECK-NEXT: veor q0, q2, q1
278 ; CHECK-NEXT: vmov.32 q2[0], r0
279 ; CHECK-NEXT: vmov.32 q2[1], r0
280 ; CHECK-NEXT: asrs r0, r2, #31
281 ; CHECK-NEXT: vmov.32 q2[2], r0
282 ; CHECK-NEXT: vmov.32 q1[0], r6
283 ; CHECK-NEXT: vmov.32 q2[3], r0
284 ; CHECK-NEXT: adr r0, .LCPI11_0
285 ; CHECK-NEXT: vldrw.u32 q3, [r0]
286 ; CHECK-NEXT: adr r0, .LCPI11_1
287 ; CHECK-NEXT: vldrw.u32 q4, [r0]
288 ; CHECK-NEXT: vmov.32 q1[1], r1
289 ; CHECK-NEXT: vmov.32 q1[2], r3
290 ; CHECK-NEXT: vbic q3, q3, q2
291 ; CHECK-NEXT: vand q2, q4, q2
292 ; CHECK-NEXT: vmov.32 q1[3], r2
293 ; CHECK-NEXT: vorr q2, q2, q3
294 ; CHECK-NEXT: vbic q1, q1, q0
295 ; CHECK-NEXT: vand q0, q2, q0
296 ; CHECK-NEXT: vorr q0, q0, q1
297 ; CHECK-NEXT: vpop {d8, d9}
298 ; CHECK-NEXT: pop {r4, r5, r6, pc}
299 ; CHECK-NEXT: .p2align 4
300 ; CHECK-NEXT: @ %bb.1:
301 ; CHECK-NEXT: .LCPI11_0:
302 ; CHECK-NEXT: .long 0 @ 0x0
303 ; CHECK-NEXT: .long 2147483648 @ 0x80000000
304 ; CHECK-NEXT: .long 0 @ 0x0
305 ; CHECK-NEXT: .long 2147483648 @ 0x80000000
306 ; CHECK-NEXT: .LCPI11_1:
307 ; CHECK-NEXT: .long 4294967295 @ 0xffffffff
308 ; CHECK-NEXT: .long 2147483647 @ 0x7fffffff
309 ; CHECK-NEXT: .long 4294967295 @ 0xffffffff
310 ; CHECK-NEXT: .long 2147483647 @ 0x7fffffff
312 %0 = call <2 x i64> @llvm.ssub.sat.v2i64(<2 x i64> %src1, <2 x i64> %src2)
316 define arm_aapcs_vfpcc <16 x i8> @usub_int8_t(<16 x i8> %src1, <16 x i8> %src2) {
317 ; CHECK-LABEL: usub_int8_t:
318 ; CHECK: @ %bb.0: @ %entry
319 ; CHECK-NEXT: vqsub.u8 q0, q0, q1
322 %0 = call <16 x i8> @llvm.usub.sat.v16i8(<16 x i8> %src1, <16 x i8> %src2)
326 define arm_aapcs_vfpcc <8 x i16> @usub_int16_t(<8 x i16> %src1, <8 x i16> %src2) {
327 ; CHECK-LABEL: usub_int16_t:
328 ; CHECK: @ %bb.0: @ %entry
329 ; CHECK-NEXT: vqsub.u16 q0, q0, q1
332 %0 = call <8 x i16> @llvm.usub.sat.v8i16(<8 x i16> %src1, <8 x i16> %src2)
336 define arm_aapcs_vfpcc <4 x i32> @usub_int32_t(<4 x i32> %src1, <4 x i32> %src2) {
337 ; CHECK-LABEL: usub_int32_t:
338 ; CHECK: @ %bb.0: @ %entry
339 ; CHECK-NEXT: vqsub.u32 q0, q0, q1
342 %0 = call <4 x i32> @llvm.usub.sat.v4i32(<4 x i32> %src1, <4 x i32> %src2)
346 define arm_aapcs_vfpcc <2 x i64> @usub_int64_t(<2 x i64> %src1, <2 x i64> %src2) {
347 ; CHECK-LABEL: usub_int64_t:
348 ; CHECK: @ %bb.0: @ %entry
349 ; CHECK-NEXT: .save {r4, lr}
350 ; CHECK-NEXT: push {r4, lr}
351 ; CHECK-NEXT: vmov r2, s4
352 ; CHECK-NEXT: vmov r3, s0
353 ; CHECK-NEXT: vmov r0, s5
354 ; CHECK-NEXT: vmov r1, s1
355 ; CHECK-NEXT: vmov r4, s2
356 ; CHECK-NEXT: subs.w lr, r3, r2
357 ; CHECK-NEXT: vmov r2, s6
358 ; CHECK-NEXT: sbc.w r12, r1, r0
359 ; CHECK-NEXT: subs.w r3, r3, lr
360 ; CHECK-NEXT: sbcs.w r1, r1, r12
361 ; CHECK-NEXT: vmov r3, s3
362 ; CHECK-NEXT: mov.w r1, #0
363 ; CHECK-NEXT: mov.w r0, #0
365 ; CHECK-NEXT: movlo r1, #1
366 ; CHECK-NEXT: cmp r1, #0
367 ; CHECK-NEXT: csetm r1, ne
368 ; CHECK-NEXT: vmov.32 q0[0], lr
369 ; CHECK-NEXT: vmov.32 q2[0], r1
370 ; CHECK-NEXT: vmov.32 q0[1], r12
371 ; CHECK-NEXT: vmov.32 q2[1], r1
372 ; CHECK-NEXT: vmov r1, s7
373 ; CHECK-NEXT: subs r2, r4, r2
374 ; CHECK-NEXT: vmov.32 q0[2], r2
375 ; CHECK-NEXT: sbc.w r1, r3, r1
376 ; CHECK-NEXT: subs r4, r4, r2
377 ; CHECK-NEXT: sbcs r3, r1
379 ; CHECK-NEXT: movlo r0, #1
380 ; CHECK-NEXT: cmp r0, #0
381 ; CHECK-NEXT: vmov.32 q0[3], r1
382 ; CHECK-NEXT: csetm r0, ne
383 ; CHECK-NEXT: vmov.32 q2[2], r0
384 ; CHECK-NEXT: vmov.32 q2[3], r0
385 ; CHECK-NEXT: vbic q0, q0, q2
386 ; CHECK-NEXT: pop {r4, pc}
388 %0 = call <2 x i64> @llvm.usub.sat.v2i64(<2 x i64> %src1, <2 x i64> %src2)
393 declare <16 x i8> @llvm.sadd.sat.v16i8(<16 x i8> %src1, <16 x i8> %src2)
394 declare <8 x i16> @llvm.sadd.sat.v8i16(<8 x i16> %src1, <8 x i16> %src2)
395 declare <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32> %src1, <4 x i32> %src2)
396 declare <2 x i64> @llvm.sadd.sat.v2i64(<2 x i64> %src1, <2 x i64> %src2)
397 declare <16 x i8> @llvm.uadd.sat.v16i8(<16 x i8> %src1, <16 x i8> %src2)
398 declare <8 x i16> @llvm.uadd.sat.v8i16(<8 x i16> %src1, <8 x i16> %src2)
399 declare <4 x i32> @llvm.uadd.sat.v4i32(<4 x i32> %src1, <4 x i32> %src2)
400 declare <2 x i64> @llvm.uadd.sat.v2i64(<2 x i64> %src1, <2 x i64> %src2)
401 declare <16 x i8> @llvm.ssub.sat.v16i8(<16 x i8> %src1, <16 x i8> %src2)
402 declare <8 x i16> @llvm.ssub.sat.v8i16(<8 x i16> %src1, <8 x i16> %src2)
403 declare <4 x i32> @llvm.ssub.sat.v4i32(<4 x i32> %src1, <4 x i32> %src2)
404 declare <2 x i64> @llvm.ssub.sat.v2i64(<2 x i64> %src1, <2 x i64> %src2)
405 declare <16 x i8> @llvm.usub.sat.v16i8(<16 x i8> %src1, <16 x i8> %src2)
406 declare <8 x i16> @llvm.usub.sat.v8i16(<8 x i16> %src1, <8 x i16> %src2)
407 declare <4 x i32> @llvm.usub.sat.v4i32(<4 x i32> %src1, <4 x i32> %src2)
408 declare <2 x i64> @llvm.usub.sat.v2i64(<2 x i64> %src1, <2 x i64> %src2)