1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple arm-- -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
4 define void @test_mla() #0 { ret void }
5 define void @test_mla_commutative() #0 { ret void }
6 define void @test_mla_v5() #1 { ret void }
8 define void @test_mls() #2 { ret void }
9 define void @test_no_mls() { ret void }
11 define void @test_bicrr() { ret void }
12 define void @test_bicrr_commutative() { ret void }
14 define void @test_bicri() { ret void }
15 define void @test_bicri_commutative_xor() { ret void }
16 define void @test_bicri_commutative_and() { ret void }
17 define void @test_bicri_commutative_both() { ret void }
19 define void @test_movti16_0xffff() #2 { ret void }
21 define void @test_vnmuls() #3 { ret void }
22 define void @test_vnmuls_reassociate() #3 { ret void }
23 define void @test_vnmuld() #3 { ret void }
25 define void @test_vfnmas() #4 { ret void }
26 define void @test_vfnmad() #4 { ret void }
28 define void @test_vfmss() #4 { ret void }
29 define void @test_vfmsd() #4 { ret void }
31 define void @test_vfnmss() #4 { ret void }
33 define void @test_bfc() #2 { ret void }
34 define void @test_no_bfc_bad_mask() #2 { ret void }
36 attributes #0 = { "target-features"="+v6" }
37 attributes #1 = { "target-features"="-v6" }
38 attributes #2 = { "target-features"="+v6t2" }
39 attributes #3 = { "target-features"="+vfp2" }
40 attributes #4 = { "target-features"="+vfp4" }
48 - { id: 0, class: gprb }
49 - { id: 1, class: gprb }
50 - { id: 2, class: gprb }
51 - { id: 3, class: gprb }
52 - { id: 4, class: gprb }
55 liveins: $r0, $r1, $r2
57 ; CHECK-LABEL: name: test_mla
58 ; CHECK: [[COPY:%[0-9]+]]:gprnopc = COPY $r0
59 ; CHECK: [[COPY1:%[0-9]+]]:gprnopc = COPY $r1
60 ; CHECK: [[COPY2:%[0-9]+]]:gprnopc = COPY $r2
61 ; CHECK: [[MLA:%[0-9]+]]:gprnopc = MLA [[COPY]], [[COPY1]], [[COPY2]], 14 /* CC::al */, $noreg, $noreg
62 ; CHECK: $r0 = COPY [[MLA]]
63 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
68 %3(s32) = G_MUL %0, %1
69 %4(s32) = G_ADD %3, %2
73 BX_RET 14, $noreg, implicit $r0
76 name: test_mla_commutative
81 - { id: 0, class: gprb }
82 - { id: 1, class: gprb }
83 - { id: 2, class: gprb }
84 - { id: 3, class: gprb }
85 - { id: 4, class: gprb }
88 liveins: $r0, $r1, $r2
90 ; CHECK-LABEL: name: test_mla_commutative
91 ; CHECK: [[COPY:%[0-9]+]]:gprnopc = COPY $r0
92 ; CHECK: [[COPY1:%[0-9]+]]:gprnopc = COPY $r1
93 ; CHECK: [[COPY2:%[0-9]+]]:gprnopc = COPY $r2
94 ; CHECK: [[MLA:%[0-9]+]]:gprnopc = MLA [[COPY]], [[COPY1]], [[COPY2]], 14 /* CC::al */, $noreg, $noreg
95 ; CHECK: $r0 = COPY [[MLA]]
96 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
101 %3(s32) = G_MUL %0, %1
102 %4(s32) = G_ADD %2, %3
106 BX_RET 14, $noreg, implicit $r0
111 regBankSelected: true
114 - { id: 0, class: gprb }
115 - { id: 1, class: gprb }
116 - { id: 2, class: gprb }
117 - { id: 3, class: gprb }
118 - { id: 4, class: gprb }
121 liveins: $r0, $r1, $r2
123 ; CHECK-LABEL: name: test_mla_v5
124 ; CHECK: [[COPY:%[0-9]+]]:gprnopc = COPY $r0
125 ; CHECK: [[COPY1:%[0-9]+]]:gprnopc = COPY $r1
126 ; CHECK: [[COPY2:%[0-9]+]]:gprnopc = COPY $r2
127 ; CHECK: early-clobber %4:gprnopc = MLAv5 [[COPY]], [[COPY1]], [[COPY2]], 14 /* CC::al */, $noreg, $noreg
128 ; CHECK: $r0 = COPY %4
129 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
134 %3(s32) = G_MUL %0, %1
135 %4(s32) = G_ADD %3, %2
139 BX_RET 14, $noreg, implicit $r0
144 regBankSelected: true
147 - { id: 0, class: gprb }
148 - { id: 1, class: gprb }
149 - { id: 2, class: gprb }
150 - { id: 3, class: gprb }
151 - { id: 4, class: gprb }
154 liveins: $r0, $r1, $r2
156 ; CHECK-LABEL: name: test_mls
157 ; CHECK: [[COPY:%[0-9]+]]:gpr = COPY $r0
158 ; CHECK: [[COPY1:%[0-9]+]]:gpr = COPY $r1
159 ; CHECK: [[COPY2:%[0-9]+]]:gpr = COPY $r2
160 ; CHECK: [[MLS:%[0-9]+]]:gpr = MLS [[COPY]], [[COPY1]], [[COPY2]], 14 /* CC::al */, $noreg
161 ; CHECK: $r0 = COPY [[MLS]]
162 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
167 %3(s32) = G_MUL %0, %1
168 %4(s32) = G_SUB %2, %3
172 BX_RET 14, $noreg, implicit $r0
177 regBankSelected: true
180 - { id: 0, class: gprb }
181 - { id: 1, class: gprb }
182 - { id: 2, class: gprb }
183 - { id: 3, class: gprb }
184 - { id: 4, class: gprb }
187 liveins: $r0, $r1, $r2
189 ; CHECK-LABEL: name: test_no_mls
190 ; CHECK: [[COPY:%[0-9]+]]:gprnopc = COPY $r0
191 ; CHECK: [[COPY1:%[0-9]+]]:gprnopc = COPY $r1
192 ; CHECK: [[COPY2:%[0-9]+]]:gpr = COPY $r2
193 ; CHECK: early-clobber %3:gprnopc = MULv5 [[COPY]], [[COPY1]], 14 /* CC::al */, $noreg, $noreg
194 ; CHECK: [[SUBrr:%[0-9]+]]:gpr = SUBrr [[COPY2]], %3, 14 /* CC::al */, $noreg, $noreg
195 ; CHECK: $r0 = COPY [[SUBrr]]
196 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
201 %3(s32) = G_MUL %0, %1
202 %4(s32) = G_SUB %2, %3
206 BX_RET 14, $noreg, implicit $r0
211 regBankSelected: true
214 - { id: 0, class: gprb }
215 - { id: 1, class: gprb }
216 - { id: 2, class: gprb }
217 - { id: 3, class: gprb }
218 - { id: 4, class: gprb }
223 ; CHECK-LABEL: name: test_bicrr
224 ; CHECK: [[COPY:%[0-9]+]]:gpr = COPY $r0
225 ; CHECK: [[COPY1:%[0-9]+]]:gpr = COPY $r1
226 ; CHECK: [[BICrr:%[0-9]+]]:gpr = BICrr [[COPY]], [[COPY1]], 14 /* CC::al */, $noreg, $noreg
227 ; CHECK: $r0 = COPY [[BICrr]]
228 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
232 %2(s32) = G_CONSTANT i32 -1
233 %3(s32) = G_XOR %1, %2
234 %4(s32) = G_AND %0, %3
238 BX_RET 14, $noreg, implicit $r0
241 name: test_bicrr_commutative
243 regBankSelected: true
246 - { id: 0, class: gprb }
247 - { id: 1, class: gprb }
248 - { id: 2, class: gprb }
249 - { id: 3, class: gprb }
250 - { id: 4, class: gprb }
255 ; CHECK-LABEL: name: test_bicrr_commutative
256 ; CHECK: [[COPY:%[0-9]+]]:gpr = COPY $r0
257 ; CHECK: [[COPY1:%[0-9]+]]:gpr = COPY $r1
258 ; CHECK: [[BICrr:%[0-9]+]]:gpr = BICrr [[COPY]], [[COPY1]], 14 /* CC::al */, $noreg, $noreg
259 ; CHECK: $r0 = COPY [[BICrr]]
260 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
264 %2(s32) = G_CONSTANT i32 -1
265 %3(s32) = G_XOR %1, %2
266 %4(s32) = G_AND %3, %0
270 BX_RET 14, $noreg, implicit $r0
275 regBankSelected: true
278 - { id: 0, class: gprb }
279 - { id: 1, class: gprb }
280 - { id: 2, class: gprb }
281 - { id: 3, class: gprb }
282 - { id: 4, class: gprb }
287 ; CHECK-LABEL: name: test_bicri
288 ; CHECK: [[COPY:%[0-9]+]]:gpr = COPY $r0
289 ; CHECK: [[BICri:%[0-9]+]]:gpr = BICri [[COPY]], 192, 14 /* CC::al */, $noreg, $noreg
290 ; CHECK: $r0 = COPY [[BICri]]
291 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
294 ; This test and the following ones are a bit contrived, since they use a
295 ; G_XOR that can be constant-folded. They exist mostly to validate the
296 ; TableGen pattern that defines BICri. We also have a pattern for matching a
297 ; G_AND with a G_CONSTANT operand directly, which is the more common case,
298 ; but that will be covered by different tests.
299 %1(s32) = G_CONSTANT i32 192
301 %2(s32) = G_CONSTANT i32 -1
302 %3(s32) = G_XOR %1, %2
303 %4(s32) = G_AND %0, %3
307 BX_RET 14, $noreg, implicit $r0
310 name: test_bicri_commutative_xor
312 regBankSelected: true
315 - { id: 0, class: gprb }
316 - { id: 1, class: gprb }
317 - { id: 2, class: gprb }
318 - { id: 3, class: gprb }
319 - { id: 4, class: gprb }
324 ; CHECK-LABEL: name: test_bicri_commutative_xor
325 ; CHECK: [[COPY:%[0-9]+]]:gpr = COPY $r0
326 ; CHECK: [[BICri:%[0-9]+]]:gpr = BICri [[COPY]], 192, 14 /* CC::al */, $noreg, $noreg
327 ; CHECK: $r0 = COPY [[BICri]]
328 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
331 %1(s32) = G_CONSTANT i32 192
333 %2(s32) = G_CONSTANT i32 -1
334 %3(s32) = G_XOR %2, %1
335 %4(s32) = G_AND %0, %3
339 BX_RET 14, $noreg, implicit $r0
342 name: test_bicri_commutative_and
344 regBankSelected: true
347 - { id: 0, class: gprb }
348 - { id: 1, class: gprb }
349 - { id: 2, class: gprb }
350 - { id: 3, class: gprb }
351 - { id: 4, class: gprb }
356 ; CHECK-LABEL: name: test_bicri_commutative_and
357 ; CHECK: [[COPY:%[0-9]+]]:gpr = COPY $r0
358 ; CHECK: [[BICri:%[0-9]+]]:gpr = BICri [[COPY]], 192, 14 /* CC::al */, $noreg, $noreg
359 ; CHECK: $r0 = COPY [[BICri]]
360 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
363 %1(s32) = G_CONSTANT i32 192
365 %2(s32) = G_CONSTANT i32 -1
366 %3(s32) = G_XOR %1, %2
367 %4(s32) = G_AND %3, %0
371 BX_RET 14, $noreg, implicit $r0
374 name: test_bicri_commutative_both
376 regBankSelected: true
379 - { id: 0, class: gprb }
380 - { id: 1, class: gprb }
381 - { id: 2, class: gprb }
382 - { id: 3, class: gprb }
383 - { id: 4, class: gprb }
388 ; CHECK-LABEL: name: test_bicri_commutative_both
389 ; CHECK: [[COPY:%[0-9]+]]:gpr = COPY $r0
390 ; CHECK: [[BICri:%[0-9]+]]:gpr = BICri [[COPY]], 192, 14 /* CC::al */, $noreg, $noreg
391 ; CHECK: $r0 = COPY [[BICri]]
392 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
395 %1(s32) = G_CONSTANT i32 192
397 %2(s32) = G_CONSTANT i32 -1
398 %3(s32) = G_XOR %2, %1
399 %4(s32) = G_AND %3, %0
403 BX_RET 14, $noreg, implicit $r0
406 name: test_movti16_0xffff
408 regBankSelected: true
411 - { id: 0, class: gprb }
412 - { id: 1, class: gprb }
413 - { id: 2, class: gprb }
418 ; CHECK-LABEL: name: test_movti16_0xffff
419 ; CHECK: [[COPY:%[0-9]+]]:gpr = COPY $r0
420 ; CHECK: [[MOVTi16_:%[0-9]+]]:gprnopc = MOVTi16 [[COPY]], 65535, 14 /* CC::al */, $noreg
421 ; CHECK: $r0 = COPY [[MOVTi16_]]
422 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
425 %1(s32) = G_CONSTANT i32 4294901760 ; 0xFFFF0000
427 %2(s32) = G_OR %0, %1
431 BX_RET 14, $noreg, implicit $r0
436 regBankSelected: true
439 - { id: 0, class: fprb }
440 - { id: 1, class: fprb }
441 - { id: 2, class: fprb }
442 - { id: 3, class: fprb }
447 ; CHECK-LABEL: name: test_vnmuls
448 ; CHECK: [[COPY:%[0-9]+]]:spr = COPY $s0
449 ; CHECK: [[COPY1:%[0-9]+]]:spr = COPY $s1
450 ; CHECK: [[VNMULS:%[0-9]+]]:spr = VNMULS [[COPY]], [[COPY1]], 14 /* CC::al */, $noreg
451 ; CHECK: $s0 = COPY [[VNMULS]]
452 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $s0
456 %2(s32) = G_FMUL %0, %1
461 BX_RET 14, $noreg, implicit $s0
464 name: test_vnmuls_reassociate
466 regBankSelected: true
469 - { id: 0, class: fprb }
470 - { id: 1, class: fprb }
471 - { id: 2, class: fprb }
472 - { id: 3, class: fprb }
477 ; CHECK-LABEL: name: test_vnmuls_reassociate
478 ; CHECK: [[COPY:%[0-9]+]]:spr = COPY $s0
479 ; CHECK: [[COPY1:%[0-9]+]]:spr = COPY $s1
480 ; CHECK: [[VNMULS:%[0-9]+]]:spr = VNMULS [[COPY]], [[COPY1]], 14 /* CC::al */, $noreg
481 ; CHECK: $s0 = COPY [[VNMULS]]
482 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $s0
487 %3(s32) = G_FMUL %1, %2
491 BX_RET 14, $noreg, implicit $s0
496 regBankSelected: true
499 - { id: 0, class: fprb }
500 - { id: 1, class: fprb }
501 - { id: 2, class: fprb }
502 - { id: 3, class: fprb }
507 ; CHECK-LABEL: name: test_vnmuld
508 ; CHECK: [[COPY:%[0-9]+]]:dpr = COPY $d0
509 ; CHECK: [[COPY1:%[0-9]+]]:dpr = COPY $d1
510 ; CHECK: [[VNMULD:%[0-9]+]]:dpr = VNMULD [[COPY]], [[COPY1]], 14 /* CC::al */, $noreg
511 ; CHECK: $d0 = COPY [[VNMULD]]
512 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $d0
516 %2(s64) = G_FMUL %0, %1
521 BX_RET 14, $noreg, implicit $d0
526 regBankSelected: true
529 - { id: 0, class: fprb }
530 - { id: 1, class: fprb }
531 - { id: 2, class: fprb }
532 - { id: 3, class: fprb }
533 - { id: 4, class: fprb }
536 liveins: $s0, $s1, $s2
538 ; CHECK-LABEL: name: test_vfnmas
539 ; CHECK: [[COPY:%[0-9]+]]:spr = COPY $s0
540 ; CHECK: [[COPY1:%[0-9]+]]:spr = COPY $s1
541 ; CHECK: [[COPY2:%[0-9]+]]:spr = COPY $s2
542 ; CHECK: [[VFNMAS:%[0-9]+]]:spr = VFNMAS [[COPY2]], [[COPY]], [[COPY1]], 14 /* CC::al */, $noreg
543 ; CHECK: $s0 = COPY [[VFNMAS]]
544 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $s0
549 %3(s32) = G_FMA %0, %1, %2
554 BX_RET 14, $noreg, implicit $s0
559 regBankSelected: true
562 - { id: 0, class: fprb }
563 - { id: 1, class: fprb }
564 - { id: 2, class: fprb }
565 - { id: 3, class: fprb }
566 - { id: 4, class: fprb }
567 - { id: 5, class: fprb }
570 liveins: $d0, $d1, $d2
572 ; CHECK-LABEL: name: test_vfnmad
573 ; CHECK: [[COPY:%[0-9]+]]:dpr = COPY $d0
574 ; CHECK: [[COPY1:%[0-9]+]]:dpr = COPY $d1
575 ; CHECK: [[COPY2:%[0-9]+]]:dpr = COPY $d2
576 ; CHECK: [[VFNMAD:%[0-9]+]]:dpr = VFNMAD [[COPY2]], [[COPY]], [[COPY1]], 14 /* CC::al */, $noreg
577 ; CHECK: $d0 = COPY [[VFNMAD]]
578 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $d0
585 %5(s64) = G_FMA %3, %1, %4
589 BX_RET 14, $noreg, implicit $d0
594 regBankSelected: true
597 - { id: 0, class: fprb }
598 - { id: 1, class: fprb }
599 - { id: 2, class: fprb }
600 - { id: 3, class: fprb }
601 - { id: 4, class: fprb }
604 liveins: $s0, $s1, $s2
606 ; CHECK-LABEL: name: test_vfmss
607 ; CHECK: [[COPY:%[0-9]+]]:spr = COPY $s0
608 ; CHECK: [[COPY1:%[0-9]+]]:spr = COPY $s1
609 ; CHECK: [[COPY2:%[0-9]+]]:spr = COPY $s2
610 ; CHECK: [[VFMSS:%[0-9]+]]:spr = VFMSS [[COPY2]], [[COPY]], [[COPY1]], 14 /* CC::al */, $noreg
611 ; CHECK: $s0 = COPY [[VFMSS]]
612 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $s0
618 %4(s32) = G_FMA %3, %1, %2
622 BX_RET 14, $noreg, implicit $s0
627 regBankSelected: true
630 - { id: 0, class: fprb }
631 - { id: 1, class: fprb }
632 - { id: 2, class: fprb }
633 - { id: 3, class: fprb }
634 - { id: 4, class: fprb }
637 liveins: $d0, $d1, $d2
639 ; CHECK-LABEL: name: test_vfmsd
640 ; CHECK: [[COPY:%[0-9]+]]:dpr = COPY $d0
641 ; CHECK: [[COPY1:%[0-9]+]]:dpr = COPY $d1
642 ; CHECK: [[COPY2:%[0-9]+]]:dpr = COPY $d2
643 ; CHECK: [[VFMSD:%[0-9]+]]:dpr = VFMSD [[COPY2]], [[COPY1]], [[COPY]], 14 /* CC::al */, $noreg
644 ; CHECK: $d0 = COPY [[VFMSD]]
645 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $d0
651 %4(s64) = G_FMA %0, %3, %2
655 BX_RET 14, $noreg, implicit $d0
660 regBankSelected: true
663 - { id: 0, class: fprb }
664 - { id: 1, class: fprb }
665 - { id: 2, class: fprb }
666 - { id: 3, class: fprb }
667 - { id: 4, class: fprb }
670 liveins: $s0, $s1, $s2
672 ; CHECK-LABEL: name: test_vfnmss
673 ; CHECK: [[COPY:%[0-9]+]]:spr = COPY $s0
674 ; CHECK: [[COPY1:%[0-9]+]]:spr = COPY $s1
675 ; CHECK: [[COPY2:%[0-9]+]]:spr = COPY $s2
676 ; CHECK: [[VFNMSS:%[0-9]+]]:spr = VFNMSS [[COPY2]], [[COPY]], [[COPY1]], 14 /* CC::al */, $noreg
677 ; CHECK: $s0 = COPY [[VFNMSS]]
678 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $s0
684 %4(s32) = G_FMA %0, %1, %3
688 BX_RET 14, $noreg, implicit $s0
693 regBankSelected: true
696 - { id: 0, class: gprb }
697 - { id: 1, class: gprb }
698 - { id: 2, class: gprb }
703 ; CHECK-LABEL: name: test_bfc
704 ; CHECK: [[COPY:%[0-9]+]]:gpr = COPY $r0
705 ; CHECK: [[BFC:%[0-9]+]]:gpr = BFC [[COPY]], -65529, 14 /* CC::al */, $noreg
706 ; CHECK: $r0 = COPY [[BFC]]
707 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
709 %1(s32) = G_CONSTANT i32 -65529 ; 0xFFFF0007
710 %2(s32) = G_AND %0, %1
714 BX_RET 14, $noreg, implicit $r0
717 name: test_no_bfc_bad_mask
719 regBankSelected: true
722 - { id: 0, class: gprb }
723 - { id: 1, class: gprb }
724 - { id: 2, class: gprb }
729 ; CHECK-LABEL: name: test_no_bfc_bad_mask
730 ; CHECK: [[COPY:%[0-9]+]]:gpr = COPY $r0
731 ; CHECK: [[ANDri:%[0-9]+]]:gpr = ANDri [[COPY]], 6, 14 /* CC::al */, $noreg, $noreg
732 ; CHECK: $r0 = COPY [[ANDri]]
733 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
735 %1(s32) = G_CONSTANT i32 6 ; 0x00000006
736 %2(s32) = G_AND %0, %1
740 BX_RET 14, $noreg, implicit $r0