1 ; RUN: llc -O1 -mtriple=armv6-none-none-eabi %s -o - | FileCheck %s
2 ; RUN: llc -O1 -mtriple=armv7-none-none-eabi %s -o - | FileCheck %s
3 ; RUN: llc -O1 -mtriple=thumbv7-none-none-eabi %s -o - | FileCheck %s
4 ; RUN: llc -O1 -mtriple=thumbv6t2-none-none-eabi %s -o - | FileCheck %s
5 ; RUN: llc -O1 -mtriple=thumbv7em-none-none-eabi %s -o - | FileCheck %s
6 ; RUN: llc -O1 -mtriple=thumbv8m.main-none-none-eabi -mattr=+dsp %s -o - | FileCheck %s
9 ; upper-bound of the immediate argument
10 define i32 @ssat1(i32 %a) nounwind {
12 ; CHECK: ssat r0, #32, r0
13 %tmp = call i32 @llvm.arm.ssat(i32 %a, i32 32)
17 ; lower-bound of the immediate argument
18 define i32 @ssat2(i32 %a) nounwind {
20 ; CHECK: ssat r0, #1, r0
21 %tmp = call i32 @llvm.arm.ssat(i32 %a, i32 1)
25 ; upper-bound of the immediate argument
26 define i32 @usat1(i32 %a) nounwind {
28 ; CHECK: usat r0, #31, r0
29 %tmp = call i32 @llvm.arm.usat(i32 %a, i32 31)
33 ; lower-bound of the immediate argument
34 define i32 @usat2(i32 %a) nounwind {
36 ; CHECK: usat r0, #0, r0
37 %tmp = call i32 @llvm.arm.usat(i32 %a, i32 0)
41 define i32 @ssat16 (i32 %a) nounwind {
43 ; CHECK: ssat16 r0, #1, r0
44 ; CHECK: ssat16 r0, #16, r0
45 %tmp = call i32 @llvm.arm.ssat16(i32 %a, i32 1)
46 %tmp2 = call i32 @llvm.arm.ssat16(i32 %tmp, i32 16)
50 define i32 @usat16(i32 %a) nounwind {
52 ; CHECK: usat16 r0, #0, r0
53 ; CHECK: usat16 r0, #15, r0
54 %tmp = call i32 @llvm.arm.usat16(i32 %a, i32 0)
55 %tmp2 = call i32 @llvm.arm.usat16(i32 %tmp, i32 15)
59 define i32 @pack_unpack(i32 %a, i32 %b) nounwind {
60 ; CHECK-LABEL: pack_unpack
61 ; CHECK: sxtab16 r0, r0, r1
62 ; CHECK: sxtb16 r0, r0
63 ; CHECK: uxtab16 r0, r1, r0
64 ; CHECK: uxtb16 r0, r0
65 %tmp = call i32 @llvm.arm.sxtab16(i32 %a, i32 %b)
66 %tmp1 = call i32 @llvm.arm.sxtb16(i32 %tmp)
67 %tmp2 = call i32 @llvm.arm.uxtab16(i32 %b, i32 %tmp1)
68 %tmp3 = call i32 @llvm.arm.uxtb16(i32 %tmp2)
72 define i32 @sel(i32 %a, i32 %b) nounwind {
74 ; CHECK: sel r0, r0, r1
75 %tmp = call i32 @llvm.arm.sel(i32 %a, i32 %b)
79 define i32 @qadd8(i32 %a, i32 %b) nounwind {
81 ; CHECK: qadd8 r0, r0, r1
82 %tmp = call i32 @llvm.arm.qadd8(i32 %a, i32 %b)
86 define i32 @qsub8(i32 %a, i32 %b) nounwind {
88 ; CHECK: qsub8 r0, r0, r1
89 %tmp = call i32 @llvm.arm.qsub8(i32 %a, i32 %b)
93 define i32 @sadd8(i32 %a, i32 %b) nounwind {
95 ; CHECK: sadd8 r0, r0, r1
96 %tmp = call i32 @llvm.arm.sadd8(i32 %a, i32 %b)
100 define i32 @shadd8(i32 %a, i32 %b) nounwind {
101 ; CHECK-LABEL: shadd8
102 ; CHECK: shadd8 r0, r0, r1
103 %tmp = call i32 @llvm.arm.shadd8(i32 %a, i32 %b)
107 define i32 @shsub8(i32 %a, i32 %b) nounwind {
108 ; CHECK-LABEL: shsub8
109 ; CHECK: shsub8 r0, r0, r1
110 %tmp = call i32 @llvm.arm.shsub8(i32 %a, i32 %b)
114 define i32 @ssub8(i32 %a, i32 %b) nounwind {
116 ; CHECK: ssub8 r0, r0, r1
117 %tmp = call i32 @llvm.arm.ssub8(i32 %a, i32 %b)
121 define i32 @uadd8(i32 %a, i32 %b) nounwind {
123 ; CHECK: uadd8 r0, r0, r1
124 %tmp = call i32 @llvm.arm.uadd8(i32 %a, i32 %b)
128 define i32 @uhadd8(i32 %a, i32 %b) nounwind {
129 ; CHECK-LABEL: uhadd8
130 ; CHECK: uhadd8 r0, r0, r1
131 %tmp = call i32 @llvm.arm.uhadd8(i32 %a, i32 %b)
135 define i32 @uhsub8(i32 %a, i32 %b) nounwind {
136 ; CHECK-LABEL: uhsub8
137 ; CHECK: uhsub8 r0, r0, r1
138 %tmp = call i32 @llvm.arm.uhsub8(i32 %a, i32 %b)
142 define i32 @uqadd8(i32 %a, i32 %b) nounwind {
143 ; CHECK-LABEL: uqadd8
144 ; CHECK: uqadd8 r0, r0, r1
145 %tmp = call i32 @llvm.arm.uqadd8(i32 %a, i32 %b)
149 define i32 @uqsub8(i32 %a, i32 %b) nounwind {
150 ; CHECK-LABEL: uqsub8
151 ; CHECK: uqsub8 r0, r0, r1
152 %tmp = call i32 @llvm.arm.uqsub8(i32 %a, i32 %b)
156 define i32 @usub8(i32 %a, i32 %b) nounwind {
158 ; CHECK: usub8 r0, r0, r1
159 %tmp = call i32 @llvm.arm.usub8(i32 %a, i32 %b)
163 define i32 @usad(i32 %a, i32 %b, i32 %c) nounwind {
165 ; CHECK: usad8 r0, r0, r1
166 ; CHECK: usada8 r0, r0, r1, r2
167 %tmp = call i32 @llvm.arm.usad8(i32 %a, i32 %b)
168 %tmp1 = call i32 @llvm.arm.usada8(i32 %tmp, i32 %b, i32 %c)
172 define i32 @qadd16(i32 %a, i32 %b) nounwind {
173 ; CHECK-LABEL: qadd16
174 ; CHECK: qadd16 r0, r0, r1
175 %tmp = call i32 @llvm.arm.qadd16(i32 %a, i32 %b)
179 define i32 @qasx(i32 %a, i32 %b) nounwind {
181 ; CHECK: qasx r0, r0, r1
182 %tmp = call i32 @llvm.arm.qasx(i32 %a, i32 %b)
186 define i32 @qsax(i32 %a, i32 %b) nounwind {
188 ; CHECK: qsax r0, r0, r1
189 %tmp = call i32 @llvm.arm.qsax(i32 %a, i32 %b)
193 define i32 @qsub16(i32 %a, i32 %b) nounwind {
194 ; CHECK-LABEL: qsub16
195 ; CHECK: qsub16 r0, r0, r1
196 %tmp = call i32 @llvm.arm.qsub16(i32 %a, i32 %b)
200 define i32 @sadd16(i32 %a, i32 %b) nounwind {
201 ; CHECK-LABEL: sadd16
202 ; CHECK: sadd16 r0, r0, r1
203 %tmp = call i32 @llvm.arm.sadd16(i32 %a, i32 %b)
207 define i32 @sasx(i32 %a, i32 %b) nounwind {
209 ; CHECK: sasx r0, r0, r1
210 %tmp = call i32 @llvm.arm.sasx(i32 %a, i32 %b)
214 define i32 @shadd16(i32 %a, i32 %b) nounwind {
215 ; CHECK-LABEL: shadd16
216 ; CHECK: shadd16 r0, r0, r1
217 %tmp = call i32 @llvm.arm.shadd16(i32 %a, i32 %b)
221 define i32 @shasx(i32 %a, i32 %b) nounwind {
223 ; CHECK: shasx r0, r0, r1
224 %tmp = call i32 @llvm.arm.shasx(i32 %a, i32 %b)
228 define i32 @shsax(i32 %a, i32 %b) nounwind {
230 ; CHECK: shsax r0, r0, r1
231 %tmp = call i32 @llvm.arm.shsax(i32 %a, i32 %b)
235 define i32 @shsub16(i32 %a, i32 %b) nounwind {
236 ; CHECK-LABEL: shsub16
237 ; CHECK: shsub16 r0, r0, r1
238 %tmp = call i32 @llvm.arm.shsub16(i32 %a, i32 %b)
242 define i32 @ssax(i32 %a, i32 %b) nounwind {
244 ; CHECK: ssax r0, r0, r1
245 %tmp = call i32 @llvm.arm.ssax(i32 %a, i32 %b)
249 define i32 @ssub16(i32 %a, i32 %b) nounwind {
250 ; CHECK-LABEL: ssub16
251 ; CHECK: ssub16 r0, r0, r1
252 %tmp = call i32 @llvm.arm.ssub16(i32 %a, i32 %b)
256 define i32 @uadd16(i32 %a, i32 %b) nounwind {
257 ; CHECK-LABEL: uadd16
258 ; CHECK: uadd16 r0, r0, r1
259 %tmp = call i32 @llvm.arm.uadd16(i32 %a, i32 %b)
263 define i32 @uasx(i32 %a, i32 %b) nounwind {
265 ; CHECK: uasx r0, r0, r1
266 %tmp = call i32 @llvm.arm.uasx(i32 %a, i32 %b)
270 define i32 @uhadd16(i32 %a, i32 %b) nounwind {
271 ; CHECK-LABEL: uhadd16
272 ; CHECK: uhadd16 r0, r0, r1
273 %tmp = call i32 @llvm.arm.uhadd16(i32 %a, i32 %b)
277 define i32 @uhasx(i32 %a, i32 %b) nounwind {
279 ; CHECK: uhasx r0, r0, r1
280 %tmp = call i32 @llvm.arm.uhasx(i32 %a, i32 %b)
284 define i32 @uhsax(i32 %a, i32 %b) nounwind {
286 ; CHECK: uhsax r0, r0, r1
287 %tmp = call i32 @llvm.arm.uhsax(i32 %a, i32 %b)
291 define i32 @uhsub16(i32 %a, i32 %b) nounwind {
292 ; CHECK-LABEL: uhsub16
293 ; CHECK: uhsub16 r0, r0, r1
294 %tmp = call i32 @llvm.arm.uhsub16(i32 %a, i32 %b)
298 define i32 @uqadd16(i32 %a, i32 %b) nounwind {
299 ; CHECK-LABEL: uqadd16
300 ; CHECK: uqadd16 r0, r0, r1
301 %tmp = call i32 @llvm.arm.uqadd16(i32 %a, i32 %b)
305 define i32 @uqasx(i32 %a, i32 %b) nounwind {
307 ; CHECK: uqasx r0, r0, r1
308 %tmp = call i32 @llvm.arm.uqasx(i32 %a, i32 %b)
312 define i32 @uqsax(i32 %a, i32 %b) nounwind {
314 ; CHECK: uqsax r0, r0, r1
315 %tmp = call i32 @llvm.arm.uqsax(i32 %a, i32 %b)
319 define i32 @uqsub16(i32 %a, i32 %b) nounwind {
320 ; CHECK-LABEL: uqsub16
321 ; CHECK: uqsub16 r0, r0, r1
322 %tmp = call i32 @llvm.arm.uqsub16(i32 %a, i32 %b)
326 define i32 @usax(i32 %a, i32 %b) nounwind {
328 ; CHECK: usax r0, r0, r1
329 %tmp = call i32 @llvm.arm.usax(i32 %a, i32 %b)
333 define i32 @usub16(i32 %a, i32 %b) nounwind {
334 ; CHECK-LABEL: usub16
335 ; CHECK: usub16 r0, r0, r1
336 %tmp = call i32 @llvm.arm.usub16(i32 %a, i32 %b)
340 define i32 @smlad(i32 %a, i32 %b, i32 %c) nounwind {
342 ; CHECK: smlad r0, r0, r1, r2
343 %tmp = call i32 @llvm.arm.smlad(i32 %a, i32 %b, i32 %c)
347 define i32 @smladx(i32 %a, i32 %b, i32 %c) nounwind {
348 ; CHECK-LABEL: smladx
349 ; CHECK: smladx r0, r0, r1, r2
350 %tmp = call i32 @llvm.arm.smladx(i32 %a, i32 %b, i32 %c)
354 define i64 @smlald(i32 %a, i32 %b, i64 %c) nounwind {
355 ; CHECK-LABEL: smlald
356 ; CHECK: smlald r2, r3, r0, r1
357 %tmp = call i64 @llvm.arm.smlald(i32 %a, i32 %b, i64 %c)
361 define i64 @smlaldx(i32 %a, i32 %b, i64 %c) nounwind {
362 ; CHECK-LABEL: smlaldx
363 ; CHECK: smlaldx r2, r3, r0, r1
364 %tmp = call i64 @llvm.arm.smlaldx(i32 %a, i32 %b, i64 %c)
368 define i32 @smlsd(i32 %a, i32 %b, i32 %c) nounwind {
370 ; CHECK: smlsd r0, r0, r1, r2
371 %tmp = call i32 @llvm.arm.smlsd(i32 %a, i32 %b, i32 %c)
375 define i32 @smlsdx(i32 %a, i32 %b, i32 %c) nounwind {
376 ; CHECK-LABEL: smlsdx
377 ; CHECK: smlsdx r0, r0, r1, r2
378 %tmp = call i32 @llvm.arm.smlsdx(i32 %a, i32 %b, i32 %c)
382 define i64 @smlsld(i32 %a, i32 %b, i64 %c) nounwind {
383 ; CHECK-LABEL: smlsld
384 ; CHECK: smlsld r2, r3, r0, r1
385 %tmp = call i64 @llvm.arm.smlsld(i32 %a, i32 %b, i64 %c)
389 define i64 @smlsldx(i32 %a, i32 %b, i64 %c) nounwind {
390 ; CHECK-LABEL: smlsldx
391 ; CHECK: smlsldx r2, r3, r0, r1
392 %tmp = call i64 @llvm.arm.smlsldx(i32 %a, i32 %b, i64 %c)
396 define i32 @smuad(i32 %a, i32 %b) nounwind {
398 ; CHECK: smuad r0, r0, r1
399 %tmp = call i32 @llvm.arm.smuad(i32 %a, i32 %b)
403 define i32 @smuadx(i32 %a, i32 %b) nounwind {
405 ; CHECK: smuadx r0, r0, r1
406 %tmp = call i32 @llvm.arm.smuadx(i32 %a, i32 %b)
410 define i32 @smusd(i32 %a, i32 %b) nounwind {
412 ; CHECK: smusd r0, r0, r1
413 %tmp = call i32 @llvm.arm.smusd(i32 %a, i32 %b)
417 define i32 @smusdx(i32 %a, i32 %b) nounwind {
418 ; CHECK-LABEL: smusdx
419 ; CHECK: smusdx r0, r0, r1
420 %tmp = call i32 @llvm.arm.smusdx(i32 %a, i32 %b)
423 declare i32 @llvm.arm.ssat(i32, i32) nounwind readnone
424 declare i32 @llvm.arm.usat(i32, i32) nounwind readnone
425 declare i32 @llvm.arm.ssat16(i32, i32) nounwind
426 declare i32 @llvm.arm.usat16(i32, i32) nounwind
427 declare i32 @llvm.arm.sxtab16(i32, i32)
428 declare i32 @llvm.arm.sxtb16(i32)
429 declare i32 @llvm.arm.uxtab16(i32, i32)
430 declare i32 @llvm.arm.uxtb16(i32)
431 declare i32 @llvm.arm.sel(i32, i32) nounwind
432 declare i32 @llvm.arm.qadd8(i32, i32) nounwind
433 declare i32 @llvm.arm.qsub8(i32, i32) nounwind
434 declare i32 @llvm.arm.sadd8(i32, i32) nounwind
435 declare i32 @llvm.arm.shadd8(i32, i32) nounwind
436 declare i32 @llvm.arm.shsub8(i32, i32) nounwind
437 declare i32 @llvm.arm.ssub8(i32, i32) nounwind
438 declare i32 @llvm.arm.uadd8(i32, i32) nounwind
439 declare i32 @llvm.arm.uhadd8(i32, i32) nounwind
440 declare i32 @llvm.arm.uhsub8(i32, i32) nounwind
441 declare i32 @llvm.arm.uqadd8(i32, i32) nounwind
442 declare i32 @llvm.arm.uqsub8(i32, i32) nounwind
443 declare i32 @llvm.arm.usub8(i32, i32) nounwind
444 declare i32 @llvm.arm.usad8(i32, i32) nounwind readnone
445 declare i32 @llvm.arm.usada8(i32, i32, i32) nounwind readnone
446 declare i32 @llvm.arm.qadd16(i32, i32) nounwind
447 declare i32 @llvm.arm.qasx(i32, i32) nounwind
448 declare i32 @llvm.arm.qsax(i32, i32) nounwind
449 declare i32 @llvm.arm.qsub16(i32, i32) nounwind
450 declare i32 @llvm.arm.sadd16(i32, i32) nounwind
451 declare i32 @llvm.arm.sasx(i32, i32) nounwind
452 declare i32 @llvm.arm.shadd16(i32, i32) nounwind
453 declare i32 @llvm.arm.shasx(i32, i32) nounwind
454 declare i32 @llvm.arm.shsax(i32, i32) nounwind
455 declare i32 @llvm.arm.shsub16(i32, i32) nounwind
456 declare i32 @llvm.arm.ssax(i32, i32) nounwind
457 declare i32 @llvm.arm.ssub16(i32, i32) nounwind
458 declare i32 @llvm.arm.uadd16(i32, i32) nounwind
459 declare i32 @llvm.arm.uasx(i32, i32) nounwind
460 declare i32 @llvm.arm.usax(i32, i32) nounwind
461 declare i32 @llvm.arm.uhadd16(i32, i32) nounwind
462 declare i32 @llvm.arm.uhasx(i32, i32) nounwind
463 declare i32 @llvm.arm.uhsax(i32, i32) nounwind
464 declare i32 @llvm.arm.uhsub16(i32, i32) nounwind
465 declare i32 @llvm.arm.uqadd16(i32, i32) nounwind
466 declare i32 @llvm.arm.uqasx(i32, i32) nounwind
467 declare i32 @llvm.arm.uqsax(i32, i32) nounwind
468 declare i32 @llvm.arm.uqsub16(i32, i32) nounwind
469 declare i32 @llvm.arm.usub16(i32, i32) nounwind
470 declare i32 @llvm.arm.smlad(i32, i32, i32) nounwind
471 declare i32 @llvm.arm.smladx(i32, i32, i32) nounwind
472 declare i64 @llvm.arm.smlald(i32, i32, i64) nounwind
473 declare i64 @llvm.arm.smlaldx(i32, i32, i64) nounwind
474 declare i32 @llvm.arm.smlsd(i32, i32, i32) nounwind
475 declare i32 @llvm.arm.smlsdx(i32, i32, i32) nounwind
476 declare i64 @llvm.arm.smlsld(i32, i32, i64) nounwind
477 declare i64 @llvm.arm.smlsldx(i32, i32, i64) nounwind
478 declare i32 @llvm.arm.smuad(i32, i32) nounwind
479 declare i32 @llvm.arm.smuadx(i32, i32) nounwind
480 declare i32 @llvm.arm.smusd(i32, i32) nounwind
481 declare i32 @llvm.arm.smusdx(i32, i32) nounwind