1 # RUN: llc -O0 -mtriple arm-- -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
3 define void @test_trunc_and_zext_s1_to_s32() { ret void }
4 define void @test_trunc_and_sext_s1_to_s32() { ret void }
5 define void @test_trunc_and_sext_s8_to_s32() { ret void }
6 define void @test_trunc_and_zext_s16_to_s32() { ret void }
7 define void @test_trunc_and_anyext_s8_to_s32() { ret void }
8 define void @test_trunc_and_anyext_s16_to_s32() { ret void }
10 define void @test_trunc_and_zext_s1_to_s16() { ret void }
11 define void @test_trunc_and_sext_s1_to_s16() { ret void }
12 define void @test_trunc_and_anyext_s1_to_s16() { ret void }
14 define void @test_trunc_and_zext_s8_to_s16() { ret void }
15 define void @test_trunc_and_sext_s8_to_s16() { ret void }
16 define void @test_trunc_and_anyext_s8_to_s16() { ret void }
18 define void @test_trunc_and_zext_s1_to_s8() { ret void }
19 define void @test_trunc_and_sext_s1_to_s8() { ret void }
20 define void @test_trunc_and_anyext_s1_to_s8() { ret void }
22 define void @test_add_s32() { ret void }
23 define void @test_add_fold_imm_s32() { ret void }
24 define void @test_add_no_fold_imm_s32() #2 { ret void }
26 define void @test_sub_s32() { ret void }
27 define void @test_sub_imm_s32() { ret void }
28 define void @test_sub_rev_imm_s32() { ret void }
30 define void @test_mul_s32() #0 { ret void }
31 define void @test_mulv5_s32() { ret void }
33 define void @test_sdiv_s32() #1 { ret void }
34 define void @test_udiv_s32() #1 { ret void }
36 define void @test_lshr_s32() { ret void }
37 define void @test_ashr_s32() { ret void }
38 define void @test_shl_s32() { ret void }
40 define void @test_load_from_stack() { ret void }
42 define void @test_stores() { ret void }
44 define void @test_gep() { ret void }
46 define void @test_MOVi32imm() #2 { ret void }
48 define void @test_constant_imm() { ret void }
49 define void @test_constant_cimm() { ret void }
51 define void @test_pointer_constant_unconstrained() { ret void }
52 define void @test_pointer_constant_constrained() { ret void }
54 define void @test_inttoptr_s32() { ret void }
55 define void @test_ptrtoint_s32() { ret void }
57 define void @test_select_s32() { ret void }
58 define void @test_select_ptr() { ret void }
60 define void @test_br() { ret void }
62 define void @test_phi_s32() { ret void }
64 attributes #0 = { "target-features"="+v6" }
65 attributes #1 = { "target-features"="+hwdiv-arm" }
66 attributes #2 = { "target-features"="+v6t2" }
69 name: test_trunc_and_zext_s1_to_s32
70 # CHECK-LABEL: name: test_trunc_and_zext_s1_to_s32
74 # CHECK: selected: true
76 - { id: 0, class: gprb }
77 - { id: 1, class: gprb }
78 - { id: 2, class: gprb }
84 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
86 %1(s1) = G_TRUNC %0(s32)
88 %2(s32) = G_ZEXT %1(s1)
89 ; CHECK: [[VREGEXT:%[0-9]+]]:gpr = ANDri [[VREG]], 1, 14, $noreg, $noreg
92 ; CHECK: $r0 = COPY [[VREGEXT]]
94 BX_RET 14, $noreg, implicit $r0
95 ; CHECK: BX_RET 14, $noreg, implicit $r0
98 name: test_trunc_and_sext_s1_to_s32
99 # CHECK-LABEL: name: test_trunc_and_sext_s1_to_s32
101 regBankSelected: true
103 # CHECK: selected: true
105 - { id: 0, class: gprb }
106 - { id: 1, class: gprb }
107 - { id: 2, class: gprb }
113 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
115 %1(s1) = G_TRUNC %0(s32)
117 %2(s32) = G_SEXT %1(s1)
118 ; CHECK: [[VREGAND:%[0-9]+]]:gpr = ANDri [[VREG]], 1, 14, $noreg, $noreg
119 ; CHECK: [[VREGEXT:%[0-9]+]]:gpr = RSBri [[VREGAND]], 0, 14, $noreg, $noreg
122 ; CHECK: $r0 = COPY [[VREGEXT]]
124 BX_RET 14, $noreg, implicit $r0
125 ; CHECK: BX_RET 14, $noreg, implicit $r0
128 name: test_trunc_and_sext_s8_to_s32
129 # CHECK-LABEL: name: test_trunc_and_sext_s8_to_s32
131 regBankSelected: true
133 # CHECK: selected: true
135 - { id: 0, class: gprb }
136 - { id: 1, class: gprb }
137 - { id: 2, class: gprb }
143 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
145 %1(s8) = G_TRUNC %0(s32)
146 ; CHECK: [[VREGTRUNC:%[0-9]+]]:gprnopc = COPY [[VREG]]
148 %2(s32) = G_SEXT %1(s8)
149 ; CHECK: [[VREGEXT:%[0-9]+]]:gprnopc = SXTB [[VREGTRUNC]], 0, 14, $noreg
152 ; CHECK: $r0 = COPY [[VREGEXT]]
154 BX_RET 14, $noreg, implicit $r0
155 ; CHECK: BX_RET 14, $noreg, implicit $r0
158 name: test_trunc_and_zext_s16_to_s32
159 # CHECK-LABEL: name: test_trunc_and_zext_s16_to_s32
161 regBankSelected: true
163 # CHECK: selected: true
165 - { id: 0, class: gprb }
166 - { id: 1, class: gprb }
167 - { id: 2, class: gprb }
173 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
175 %1(s16) = G_TRUNC %0(s32)
176 ; CHECK: [[VREGTRUNC:%[0-9]+]]:gprnopc = COPY [[VREG]]
178 %2(s32) = G_ZEXT %1(s16)
179 ; CHECK: [[VREGEXT:%[0-9]+]]:gprnopc = UXTH [[VREGTRUNC]], 0, 14, $noreg
182 ; CHECK: $r0 = COPY [[VREGEXT]]
184 BX_RET 14, $noreg, implicit $r0
185 ; CHECK: BX_RET 14, $noreg, implicit $r0
188 name: test_trunc_and_anyext_s8_to_s32
189 # CHECK-LABEL: name: test_trunc_and_anyext_s8_to_s32
191 regBankSelected: true
193 # CHECK: selected: true
195 - { id: 0, class: gprb }
196 - { id: 1, class: gprb }
197 - { id: 2, class: gprb }
203 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
205 %1(s8) = G_TRUNC %0(s32)
207 %2(s32) = G_ANYEXT %1(s8)
210 ; CHECK: $r0 = COPY [[VREG]]
212 BX_RET 14, $noreg, implicit $r0
213 ; CHECK: BX_RET 14, $noreg, implicit $r0
216 name: test_trunc_and_anyext_s16_to_s32
217 # CHECK-LABEL: name: test_trunc_and_anyext_s16_to_s32
219 regBankSelected: true
221 # CHECK: selected: true
223 - { id: 0, class: gprb }
224 - { id: 1, class: gprb }
225 - { id: 2, class: gprb }
231 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
233 %1(s16) = G_TRUNC %0(s32)
235 %2(s32) = G_ANYEXT %1(s16)
238 ; CHECK: $r0 = COPY [[VREG]]
240 BX_RET 14, $noreg, implicit $r0
241 ; CHECK: BX_RET 14, $noreg, implicit $r0
244 name: test_trunc_and_zext_s1_to_s16
245 # CHECK-LABEL: name: test_trunc_and_zext_s1_to_s16
247 regBankSelected: true
249 # CHECK: selected: true
250 tracksRegLiveness: true
252 - { id: 0, class: gprb }
253 - { id: 1, class: gprb }
254 - { id: 2, class: gprb }
255 - { id: 3, class: gprb }
261 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
264 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
266 %2(s1) = G_TRUNC %1(s32)
268 %3(s16) = G_ZEXT %2(s1)
269 ; CHECK: [[VREGEXT:%[0-9]+]]:gpr = ANDri [[VREG]], 1, 14, $noreg, $noreg
271 G_STORE %3(s16), %0(p0) :: (store 2)
272 ; CHECK: STRH [[VREGEXT]], [[PTR]], $noreg, 0, 14, $noreg :: (store 2)
275 ; CHECK: BX_RET 14, $noreg
278 name: test_trunc_and_sext_s1_to_s16
279 # CHECK-LABEL: name: test_trunc_and_sext_s1_to_s16
281 regBankSelected: true
283 # CHECK: selected: true
284 tracksRegLiveness: true
286 - { id: 0, class: gprb }
287 - { id: 1, class: gprb }
288 - { id: 2, class: gprb }
289 - { id: 3, class: gprb }
295 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
298 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
300 %2(s1) = G_TRUNC %1(s32)
302 %3(s16) = G_SEXT %2(s1)
303 ; CHECK: [[VREGAND:%[0-9]+]]:gpr = ANDri [[VREG]], 1, 14, $noreg, $noreg
304 ; CHECK: [[VREGEXT:%[0-9]+]]:gpr = RSBri [[VREGAND]], 0, 14, $noreg, $noreg
306 G_STORE %3(s16), %0(p0) :: (store 2)
307 ; CHECK: STRH [[VREGEXT]], [[PTR]], $noreg, 0, 14, $noreg :: (store 2)
310 ; CHECK: BX_RET 14, $noreg
313 name: test_trunc_and_anyext_s1_to_s16
314 # CHECK-LABEL: name: test_trunc_and_anyext_s1_to_s16
316 regBankSelected: true
318 # CHECK: selected: true
319 tracksRegLiveness: true
321 - { id: 0, class: gprb }
322 - { id: 1, class: gprb }
323 - { id: 2, class: gprb }
324 - { id: 3, class: gprb }
330 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
333 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
335 %2(s1) = G_TRUNC %1(s32)
337 %3(s16) = G_ANYEXT %2(s1)
339 G_STORE %3(s16), %0(p0) :: (store 2)
340 ; CHECK: STRH [[VREG]], [[PTR]], $noreg, 0, 14, $noreg :: (store 2)
343 ; CHECK: BX_RET 14, $noreg
346 name: test_trunc_and_zext_s8_to_s16
347 # CHECK-LABEL: name: test_trunc_and_zext_s8_to_s16
349 regBankSelected: true
351 # CHECK: selected: true
352 tracksRegLiveness: true
354 - { id: 0, class: gprb }
355 - { id: 1, class: gprb }
356 - { id: 2, class: gprb }
357 - { id: 3, class: gprb }
363 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
366 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
368 %2(s8) = G_TRUNC %1(s32)
369 ; CHECK: [[VREGTRUNC:%[0-9]+]]:gprnopc = COPY [[VREG]]
371 %3(s16) = G_ZEXT %2(s8)
372 ; CHECK: [[VREGEXT:%[0-9]+]]:gprnopc = UXTB [[VREGTRUNC]], 0, 14, $noreg
374 G_STORE %3(s16), %0(p0) :: (store 2)
375 ; CHECK: STRH [[VREGEXT]], [[PTR]], $noreg, 0, 14, $noreg :: (store 2)
378 ; CHECK: BX_RET 14, $noreg
381 name: test_trunc_and_sext_s8_to_s16
382 # CHECK-LABEL: name: test_trunc_and_sext_s8_to_s16
384 regBankSelected: true
386 # CHECK: selected: true
387 tracksRegLiveness: true
389 - { id: 0, class: gprb }
390 - { id: 1, class: gprb }
391 - { id: 2, class: gprb }
392 - { id: 3, class: gprb }
398 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
401 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
403 %2(s8) = G_TRUNC %1(s32)
404 ; CHECK: [[VREGTRUNC:%[0-9]+]]:gprnopc = COPY [[VREG]]
406 %3(s16) = G_SEXT %2(s8)
407 ; CHECK: [[VREGEXT:%[0-9]+]]:gprnopc = SXTB [[VREGTRUNC]], 0, 14, $noreg
409 G_STORE %3(s16), %0(p0) :: (store 2)
410 ; CHECK: STRH [[VREGEXT]], [[PTR]], $noreg, 0, 14, $noreg :: (store 2)
413 ; CHECK: BX_RET 14, $noreg
416 name: test_trunc_and_anyext_s8_to_s16
417 # CHECK-LABEL: name: test_trunc_and_anyext_s8_to_s16
419 regBankSelected: true
421 # CHECK: selected: true
422 tracksRegLiveness: true
424 - { id: 0, class: gprb }
425 - { id: 1, class: gprb }
426 - { id: 2, class: gprb }
427 - { id: 3, class: gprb }
433 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
436 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
438 %2(s8) = G_TRUNC %1(s32)
440 %3(s16) = G_ANYEXT %2(s8)
442 G_STORE %3(s16), %0(p0) :: (store 2)
443 ; CHECK: STRH [[VREG]], [[PTR]], $noreg, 0, 14, $noreg :: (store 2)
446 ; CHECK: BX_RET 14, $noreg
449 name: test_trunc_and_zext_s1_to_s8
450 # CHECK-LABEL: name: test_trunc_and_zext_s1_to_s8
452 regBankSelected: true
454 # CHECK: selected: true
455 tracksRegLiveness: true
457 - { id: 0, class: gprb }
458 - { id: 1, class: gprb }
459 - { id: 2, class: gprb }
460 - { id: 3, class: gprb }
466 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
469 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
471 %2(s1) = G_TRUNC %1(s32)
473 %3(s8) = G_ZEXT %2(s1)
474 ; CHECK: [[VREGEXT:%[0-9]+]]:gprnopc = ANDri [[VREG]], 1, 14, $noreg, $noreg
476 G_STORE %3(s8), %0(p0) :: (store 1)
477 ; CHECK: STRBi12 [[VREGEXT]], [[PTR]], 0, 14, $noreg :: (store 1)
480 ; CHECK: BX_RET 14, $noreg
483 name: test_trunc_and_sext_s1_to_s8
484 # CHECK-LABEL: name: test_trunc_and_sext_s1_to_s8
486 regBankSelected: true
488 # CHECK: selected: true
489 tracksRegLiveness: true
491 - { id: 0, class: gprb }
492 - { id: 1, class: gprb }
493 - { id: 2, class: gprb }
494 - { id: 3, class: gprb }
500 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
503 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
505 %2(s1) = G_TRUNC %1(s32)
507 %3(s8) = G_SEXT %2(s1)
508 ; CHECK: [[VREGAND:%[0-9]+]]:gpr = ANDri [[VREG]], 1, 14, $noreg, $noreg
509 ; CHECK: [[VREGEXT:%[0-9]+]]:gprnopc = RSBri [[VREGAND]], 0, 14, $noreg, $noreg
511 G_STORE %3(s8), %0(p0) :: (store 1)
512 ; CHECK: STRBi12 [[VREGEXT]], [[PTR]], 0, 14, $noreg :: (store 1)
515 ; CHECK: BX_RET 14, $noreg
518 name: test_trunc_and_anyext_s1_to_s8
519 # CHECK-LABEL: name: test_trunc_and_anyext_s1_to_s8
521 regBankSelected: true
523 # CHECK: selected: true
524 tracksRegLiveness: true
526 - { id: 0, class: gprb }
527 - { id: 1, class: gprb }
528 - { id: 2, class: gprb }
529 - { id: 3, class: gprb }
535 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
538 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
540 %2(s1) = G_TRUNC %1(s32)
542 %3(s8) = G_ANYEXT %2(s1)
544 G_STORE %3(s8), %0(p0) :: (store 1)
545 ; CHECK: [[RVREG:%[0-9]+]]:gprnopc = COPY [[VREG]]
546 ; CHECK: STRBi12 [[RVREG]], [[PTR]], 0, 14, $noreg :: (store 1)
549 ; CHECK: BX_RET 14, $noreg
553 # CHECK-LABEL: name: test_add_s32
555 regBankSelected: true
557 # CHECK: selected: true
559 - { id: 0, class: gprb }
560 - { id: 1, class: gprb }
561 - { id: 2, class: gprb }
567 ; CHECK: [[VREGX:%[0-9]+]]:gpr = COPY $r0
570 ; CHECK: [[VREGY:%[0-9]+]]:gpr = COPY $r1
572 %2(s32) = G_ADD %0, %1
573 ; CHECK: [[VREGSUM:%[0-9]+]]:gpr = ADDrr [[VREGX]], [[VREGY]], 14, $noreg, $noreg
576 ; CHECK: $r0 = COPY [[VREGSUM]]
578 BX_RET 14, $noreg, implicit $r0
579 ; CHECK: BX_RET 14, $noreg, implicit $r0
582 name: test_add_fold_imm_s32
583 # CHECK-LABEL: name: test_add_fold_imm_s32
585 regBankSelected: true
587 # CHECK: selected: true
589 - { id: 0, class: gprb }
590 - { id: 1, class: gprb }
591 - { id: 2, class: gprb }
597 ; CHECK: [[VREGX:%[0-9]+]]:gpr = COPY $r0
599 %1(s32) = G_CONSTANT i32 255
600 %2(s32) = G_ADD %0, %1
601 ; CHECK: [[VREGSUM:%[0-9]+]]:gpr = ADDri [[VREGX]], 255, 14, $noreg, $noreg
604 ; CHECK: $r0 = COPY [[VREGSUM]]
606 BX_RET 14, $noreg, implicit $r0
607 ; CHECK: BX_RET 14, $noreg, implicit $r0
610 name: test_add_no_fold_imm_s32
611 # CHECK-LABEL: name: test_add_no_fold_imm_s32
613 regBankSelected: true
615 # CHECK: selected: true
617 - { id: 0, class: gprb }
618 - { id: 1, class: gprb }
619 - { id: 2, class: gprb }
625 ; CHECK: [[VREGX:%[0-9]+]]:gpr = COPY $r0
627 %1(s32) = G_CONSTANT i32 65535
628 ; CHECK: [[VREGY:%[0-9]+]]:gpr = MOVi16 65535, 14, $noreg
630 %2(s32) = G_ADD %0, %1
631 ; CHECK: [[VREGSUM:%[0-9]+]]:gpr = ADDrr [[VREGX]], [[VREGY]], 14, $noreg, $noreg
634 ; CHECK: $r0 = COPY [[VREGSUM]]
636 BX_RET 14, $noreg, implicit $r0
637 ; CHECK: BX_RET 14, $noreg, implicit $r0
641 # CHECK-LABEL: name: test_sub_s32
643 regBankSelected: true
645 # CHECK: selected: true
647 - { id: 0, class: gprb }
648 - { id: 1, class: gprb }
649 - { id: 2, class: gprb }
655 ; CHECK: [[VREGX:%[0-9]+]]:gpr = COPY $r0
658 ; CHECK: [[VREGY:%[0-9]+]]:gpr = COPY $r1
660 %2(s32) = G_SUB %0, %1
661 ; CHECK: [[VREGRES:%[0-9]+]]:gpr = SUBrr [[VREGX]], [[VREGY]], 14, $noreg, $noreg
664 ; CHECK: $r0 = COPY [[VREGRES]]
666 BX_RET 14, $noreg, implicit $r0
667 ; CHECK: BX_RET 14, $noreg, implicit $r0
670 name: test_sub_imm_s32
671 # CHECK-LABEL: name: test_sub_imm_s32
673 regBankSelected: true
675 # CHECK: selected: true
677 - { id: 0, class: gprb }
678 - { id: 1, class: gprb }
679 - { id: 2, class: gprb }
685 ; CHECK: [[VREGX:%[0-9]+]]:gpr = COPY $r0
687 %1(s32) = G_CONSTANT i32 17
688 %2(s32) = G_SUB %0, %1
689 ; CHECK: [[VREGRES:%[0-9]+]]:gpr = SUBri [[VREGX]], 17, 14, $noreg, $noreg
692 ; CHECK: $r0 = COPY [[VREGRES]]
694 BX_RET 14, $noreg, implicit $r0
695 ; CHECK: BX_RET 14, $noreg, implicit $r0
698 name: test_sub_rev_imm_s32
699 # CHECK-LABEL: name: test_sub_rev_imm_s32
701 regBankSelected: true
703 # CHECK: selected: true
705 - { id: 0, class: gprb }
706 - { id: 1, class: gprb }
707 - { id: 2, class: gprb }
713 ; CHECK: [[VREGX:%[0-9]+]]:gpr = COPY $r0
715 %1(s32) = G_CONSTANT i32 17
716 %2(s32) = G_SUB %1, %0
717 ; CHECK: [[VREGRES:%[0-9]+]]:gpr = RSBri [[VREGX]], 17, 14, $noreg, $noreg
720 ; CHECK: $r0 = COPY [[VREGRES]]
722 BX_RET 14, $noreg, implicit $r0
723 ; CHECK: BX_RET 14, $noreg, implicit $r0
727 # CHECK-LABEL: name: test_mul_s32
729 regBankSelected: true
731 # CHECK: selected: true
733 - { id: 0, class: gprb }
734 - { id: 1, class: gprb }
735 - { id: 2, class: gprb }
741 ; CHECK: [[VREGX:%[0-9]+]]:gprnopc = COPY $r0
744 ; CHECK: [[VREGY:%[0-9]+]]:gprnopc = COPY $r1
746 %2(s32) = G_MUL %0, %1
747 ; CHECK: [[VREGRES:%[0-9]+]]:gprnopc = MUL [[VREGX]], [[VREGY]], 14, $noreg, $noreg
750 ; CHECK: $r0 = COPY [[VREGRES]]
752 BX_RET 14, $noreg, implicit $r0
753 ; CHECK: BX_RET 14, $noreg, implicit $r0
757 # CHECK-LABEL: name: test_mulv5_s32
759 regBankSelected: true
761 # CHECK: selected: true
763 - { id: 0, class: gprb }
764 - { id: 1, class: gprb }
765 - { id: 2, class: gprb }
771 ; CHECK: [[VREGX:%[0-9]+]]:gprnopc = COPY $r0
774 ; CHECK: [[VREGY:%[0-9]+]]:gprnopc = COPY $r1
776 %2(s32) = G_MUL %0, %1
777 ; CHECK: early-clobber [[VREGRES:%[0-9]+]]:gprnopc = MULv5 [[VREGX]], [[VREGY]], 14, $noreg, $noreg
780 ; CHECK: $r0 = COPY [[VREGRES]]
782 BX_RET 14, $noreg, implicit $r0
783 ; CHECK: BX_RET 14, $noreg, implicit $r0
787 # CHECK-LABEL: name: test_sdiv_s32
789 regBankSelected: true
791 # CHECK: selected: true
793 - { id: 0, class: gprb }
794 - { id: 1, class: gprb }
795 - { id: 2, class: gprb }
801 ; CHECK: [[VREGX:%[0-9]+]]:gpr = COPY $r0
804 ; CHECK: [[VREGY:%[0-9]+]]:gpr = COPY $r1
806 %2(s32) = G_SDIV %0, %1
807 ; CHECK: [[VREGRES:%[0-9]+]]:gpr = SDIV [[VREGX]], [[VREGY]], 14, $noreg
810 ; CHECK: $r0 = COPY [[VREGRES]]
812 BX_RET 14, $noreg, implicit $r0
813 ; CHECK: BX_RET 14, $noreg, implicit $r0
817 # CHECK-LABEL: name: test_udiv_s32
819 regBankSelected: true
821 # CHECK: selected: true
823 - { id: 0, class: gprb }
824 - { id: 1, class: gprb }
825 - { id: 2, class: gprb }
831 ; CHECK: [[VREGX:%[0-9]+]]:gpr = COPY $r0
834 ; CHECK: [[VREGY:%[0-9]+]]:gpr = COPY $r1
836 %2(s32) = G_UDIV %0, %1
837 ; CHECK: [[VREGRES:%[0-9]+]]:gpr = UDIV [[VREGX]], [[VREGY]], 14, $noreg
840 ; CHECK: $r0 = COPY [[VREGRES]]
842 BX_RET 14, $noreg, implicit $r0
843 ; CHECK: BX_RET 14, $noreg, implicit $r0
847 # CHECK-LABEL: name: test_lshr_s32
849 regBankSelected: true
851 # CHECK: selected: true
853 - { id: 0, class: gprb }
854 - { id: 1, class: gprb }
855 - { id: 2, class: gprb }
861 ; CHECK: [[VREGX:%[0-9]+]]:gpr = COPY $r0
864 ; CHECK: [[VREGY:%[0-9]+]]:gpr = COPY $r1
866 %2(s32) = G_LSHR %0, %1
867 ; CHECK: [[VREGRES:%[0-9]+]]:gprnopc = MOVsr [[VREGX]], [[VREGY]], 3, 14, $noreg, $noreg
870 ; CHECK: $r0 = COPY [[VREGRES]]
872 BX_RET 14, $noreg, implicit $r0
873 ; CHECK: BX_RET 14, $noreg, implicit $r0
877 # CHECK-LABEL: name: test_ashr_s32
879 regBankSelected: true
881 # CHECK: selected: true
883 - { id: 0, class: gprb }
884 - { id: 1, class: gprb }
885 - { id: 2, class: gprb }
891 ; CHECK: [[VREGX:%[0-9]+]]:gpr = COPY $r0
894 ; CHECK: [[VREGY:%[0-9]+]]:gpr = COPY $r1
896 %2(s32) = G_ASHR %0, %1
897 ; CHECK: [[VREGRES:%[0-9]+]]:gprnopc = MOVsr [[VREGX]], [[VREGY]], 1, 14, $noreg, $noreg
900 ; CHECK: $r0 = COPY [[VREGRES]]
902 BX_RET 14, $noreg, implicit $r0
903 ; CHECK: BX_RET 14, $noreg, implicit $r0
907 # CHECK-LABEL: name: test_shl_s32
909 regBankSelected: true
911 # CHECK: selected: true
913 - { id: 0, class: gprb }
914 - { id: 1, class: gprb }
915 - { id: 2, class: gprb }
921 ; CHECK: [[VREGX:%[0-9]+]]:gpr = COPY $r0
924 ; CHECK: [[VREGY:%[0-9]+]]:gpr = COPY $r1
926 %2(s32) = G_SHL %0, %1
927 ; CHECK: [[VREGRES:%[0-9]+]]:gprnopc = MOVsr [[VREGX]], [[VREGY]], 2, 14, $noreg, $noreg
930 ; CHECK: $r0 = COPY [[VREGRES]]
932 BX_RET 14, $noreg, implicit $r0
933 ; CHECK: BX_RET 14, $noreg, implicit $r0
936 name: test_load_from_stack
937 # CHECK-LABEL: name: test_load_from_stack
939 regBankSelected: true
941 # CHECK: selected: true
943 - { id: 0, class: gprb }
944 - { id: 1, class: gprb }
945 - { id: 2, class: gprb }
946 - { id: 3, class: gprb }
947 - { id: 4, class: gprb }
949 - { id: 0, offset: 0, size: 1, alignment: 4, isImmutable: true, isAliased: false }
950 - { id: 1, offset: 4, size: 4, alignment: 4, isImmutable: true, isAliased: false }
951 - { id: 2, offset: 8, size: 4, alignment: 4, isImmutable: true, isAliased: false }
952 # CHECK-DAG: id: [[FI1:[0-9]+]], type: default, offset: 0, size: 1
953 # CHECK-DAG: id: [[FI32:[0-9]+]], type: default, offset: 8
956 liveins: $r0, $r1, $r2, $r3
958 %0(p0) = G_FRAME_INDEX %fixed-stack.2
959 ; CHECK: [[FI32VREG:%[0-9]+]]:gpr = ADDri %fixed-stack.[[FI32]], 0, 14, $noreg, $noreg
961 %1(s32) = G_LOAD %0(p0) :: (load 4)
962 ; CHECK: [[LD32VREG:%[0-9]+]]:gpr = LDRi12 [[FI32VREG]], 0, 14, $noreg
965 ; CHECK: $r0 = COPY [[LD32VREG]]
967 %2(p0) = G_FRAME_INDEX %fixed-stack.0
968 ; CHECK: [[FI1VREG:%[0-9]+]]:gpr = ADDri %fixed-stack.[[FI1]], 0, 14, $noreg, $noreg
970 %3(s1) = G_LOAD %2(p0) :: (load 1)
971 ; CHECK: [[LD1VREG:%[0-9]+]]:gprnopc = LDRBi12 [[FI1VREG]], 0, 14, $noreg
973 %4(s32) = G_ANYEXT %3(s1)
974 ; CHECK: [[RES:%[0-9]+]]:gpr = COPY [[LD1VREG]]
977 ; CHECK: $r0 = COPY [[RES]]
980 ; CHECK: BX_RET 14, $noreg
984 # CHECK-LABEL: name: test_stores
986 regBankSelected: true
988 # CHECK: selected: true
990 - { id: 0, class: gprb }
991 - { id: 1, class: gprb }
992 - { id: 2, class: gprb }
993 - { id: 3, class: gprb }
994 - { id: 4, class: gprb }
1000 ; CHECK: [[P:%[0-9]+]]:gpr = COPY $r0
1003 ; CHECK: [[V32:%[0-9]+]]:gpr = COPY $r1
1005 %4(s1) = G_TRUNC %3(s32)
1007 %1(s8) = G_TRUNC %3(s32)
1008 ; CHECK: [[V8:%[0-9]+]]:gprnopc = COPY [[V32]]
1010 %2(s16) = G_TRUNC %3(s32)
1012 G_STORE %4(s1), %0(p0) :: (store 1)
1013 ; CHECK: [[V1:%[0-9]+]]:gprnopc = ANDri [[V32]], 1, 14, $noreg, $noreg
1014 ; CHECK: STRBi12 [[V1]], [[P]], 0, 14, $noreg
1016 G_STORE %1(s8), %0(p0) :: (store 1)
1017 ; CHECK: STRBi12 [[V8]], [[P]], 0, 14, $noreg
1019 G_STORE %2(s16), %0(p0) :: (store 2)
1020 ; CHECK: STRH [[V32]], [[P]], $noreg, 0, 14, $noreg
1022 G_STORE %3(s32), %0(p0) :: (store 4)
1023 ; CHECK: STRi12 [[V32]], [[P]], 0, 14, $noreg
1029 # CHECK-LABEL: name: test_gep
1031 regBankSelected: true
1033 # CHECK: selected: true
1035 - { id: 0, class: gprb }
1036 - { id: 1, class: gprb }
1037 - { id: 2, class: gprb }
1043 ; CHECK: %[[PTR:[0-9]+]]:gpr = COPY $r0
1046 ; CHECK: %[[OFF:[0-9]+]]:gpr = COPY $r1
1048 %2(p0) = G_GEP %0, %1(s32)
1049 ; CHECK: %[[GEP:[0-9]+]]:gpr = ADDrr %[[PTR]], %[[OFF]], 14, $noreg, $noreg
1052 BX_RET 14, $noreg, implicit $r0
1055 name: test_MOVi32imm
1056 # CHECK-LABEL: name: test_MOVi32imm
1058 regBankSelected: true
1060 # CHECK: selected: true
1062 - { id: 0, class: gprb }
1065 %0(s32) = G_CONSTANT i32 65537
1066 ; CHECK: %[[C:[0-9]+]]:gpr = MOVi32imm 65537
1069 BX_RET 14, $noreg, implicit $r0
1072 name: test_constant_imm
1073 # CHECK-LABEL: name: test_constant_imm
1075 regBankSelected: true
1077 # CHECK: selected: true
1079 - { id: 0, class: gprb }
1082 %0(s32) = G_CONSTANT i32 42
1083 ; CHECK: %[[C:[0-9]+]]:gpr = MOVi 42, 14, $noreg, $noreg
1086 BX_RET 14, $noreg, implicit $r0
1089 name: test_constant_cimm
1090 # CHECK-LABEL: name: test_constant_cimm
1092 regBankSelected: true
1094 # CHECK: selected: true
1096 - { id: 0, class: gprb }
1099 ; Adding a type on G_CONSTANT changes its operand from an Imm into a CImm.
1100 ; We still want to see the same thing in the output though.
1101 %0(s32) = G_CONSTANT i32 42
1102 ; CHECK: %[[C:[0-9]+]]:gpr = MOVi 42, 14, $noreg, $noreg
1105 BX_RET 14, $noreg, implicit $r0
1108 name: test_pointer_constant_unconstrained
1109 # CHECK-LABEL: name: test_pointer_constant_unconstrained
1111 regBankSelected: true
1113 # CHECK: selected: true
1115 - { id: 0, class: gprb }
1118 %0(p0) = G_CONSTANT i32 0
1119 ; CHECK: %[[C:[0-9]+]]:gpr = MOVi 0, 14, $noreg, $noreg
1121 ; This leaves %0 unconstrained before the G_CONSTANT is selected.
1123 BX_RET 14, $noreg, implicit $r0
1126 name: test_pointer_constant_constrained
1127 # CHECK-LABEL: name: test_pointer_constant_constrained
1129 regBankSelected: true
1131 # CHECK: selected: true
1133 - { id: 0, class: gprb }
1136 %0(p0) = G_CONSTANT i32 0
1137 ; CHECK: %[[C:[0-9]+]]:gpr = MOVi 0, 14, $noreg, $noreg
1139 ; This constrains %0 before the G_CONSTANT is selected.
1140 G_STORE %0(p0), %0(p0) :: (store 4)
1143 name: test_inttoptr_s32
1144 # CHECK-LABEL: name: test_inttoptr_s32
1146 regBankSelected: true
1148 # CHECK: selected: true
1150 - { id: 0, class: gprb }
1151 - { id: 1, class: gprb }
1157 %1(p0) = G_INTTOPTR %0(s32)
1158 ; CHECK: [[INT:%[0-9]+]]:gpr = COPY $r0
1161 ; CHECK: $r0 = COPY [[INT]]
1163 BX_RET 14, $noreg, implicit $r0
1166 name: test_ptrtoint_s32
1167 # CHECK-LABEL: name: test_ptrtoint_s32
1169 regBankSelected: true
1171 # CHECK: selected: true
1173 - { id: 0, class: gprb }
1174 - { id: 1, class: gprb }
1180 %1(s32) = G_PTRTOINT %0(p0)
1181 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
1184 ; CHECK: $r0 = COPY [[PTR]]
1186 BX_RET 14, $noreg, implicit $r0
1189 name: test_select_s32
1190 # CHECK-LABEL: name: test_select_s32
1192 regBankSelected: true
1194 # CHECK: selected: true
1196 - { id: 0, class: gprb }
1197 - { id: 1, class: gprb }
1198 - { id: 2, class: gprb }
1199 - { id: 3, class: gprb }
1205 ; CHECK: [[VREGX:%[0-9]+]]:gpr = COPY $r0
1208 ; CHECK: [[VREGY:%[0-9]+]]:gpr = COPY $r1
1210 %2(s1) = G_TRUNC %1(s32)
1212 %3(s32) = G_SELECT %2(s1), %0, %1
1213 ; CHECK: TSTri [[VREGY]], 1, 14, $noreg, implicit-def $cpsr
1214 ; CHECK: [[RES:%[0-9]+]]:gpr = MOVCCr [[VREGX]], [[VREGY]], 0, $cpsr
1217 ; CHECK: $r0 = COPY [[RES]]
1219 BX_RET 14, $noreg, implicit $r0
1220 ; CHECK: BX_RET 14, $noreg, implicit $r0
1223 name: test_select_ptr
1224 # CHECK-LABEL: name: test_select_ptr
1226 regBankSelected: true
1228 # CHECK: selected: true
1230 - { id: 0, class: gprb }
1231 - { id: 1, class: gprb }
1232 - { id: 2, class: gprb }
1233 - { id: 3, class: gprb }
1234 - { id: 4, class: gprb }
1237 liveins: $r0, $r1, $r2
1240 ; CHECK: [[VREGX:%[0-9]+]]:gpr = COPY $r0
1243 ; CHECK: [[VREGY:%[0-9]+]]:gpr = COPY $r1
1246 ; CHECK: [[VREGC:%[0-9]+]]:gpr = COPY $r2
1248 %3(s1) = G_TRUNC %2(s32)
1250 %4(p0) = G_SELECT %3(s1), %0, %1
1251 ; CHECK: TSTri [[VREGC]], 1, 14, $noreg, implicit-def $cpsr
1252 ; CHECK: [[RES:%[0-9]+]]:gpr = MOVCCr [[VREGX]], [[VREGY]], 0, $cpsr
1255 ; CHECK: $r0 = COPY [[RES]]
1257 BX_RET 14, $noreg, implicit $r0
1258 ; CHECK: BX_RET 14, $noreg, implicit $r0
1262 # CHECK-LABEL: name: test_br
1264 regBankSelected: true
1266 # CHECK: selected: true
1268 - { id: 0, class: gprb }
1269 - { id: 1, class: gprb }
1273 successors: %bb.1(0x40000000), %bb.2(0x40000000)
1277 ; CHECK: [[COND32:%[0-9]+]]:gpr = COPY $r0
1278 %1(s1) = G_TRUNC %0(s32)
1280 G_BRCOND %1(s1), %bb.1
1281 ; CHECK: TSTri [[COND32]], 1, 14, $noreg, implicit-def $cpsr
1282 ; CHECK: Bcc %bb.1, 1, $cpsr
1288 successors: %bb.2(0x80000000)
1297 ; CHECK: BX_RET 14, $noreg
1301 # CHECK-LABEL: name: test_phi_s32
1303 regBankSelected: true
1305 # CHECK: selected: true
1306 tracksRegLiveness: true
1308 - { id: 0, class: gprb }
1309 - { id: 1, class: gprb }
1310 - { id: 2, class: gprb }
1311 - { id: 3, class: gprb }
1312 - { id: 4, class: gprb }
1315 ; CHECK: [[BB1:bb.0]]:
1316 successors: %bb.1(0x40000000), %bb.2(0x40000000)
1317 liveins: $r0, $r1, $r2
1320 %1(s1) = G_TRUNC %0(s32)
1324 ; CHECK: [[V1:%[0-9]+]]:gpr = COPY $r1
1325 ; CHECK: [[V2:%[0-9]+]]:gpr = COPY $r2
1327 G_BRCOND %1(s1), %bb.1
1331 ; CHECK: [[BB2:bb.1]]:
1332 successors: %bb.2(0x80000000)
1339 %4(s32) = G_PHI %2(s32), %bb.0, %3(s32), %bb.1
1340 ; CHECK: {{%[0-9]+}}:gpr = PHI [[V1]], %[[BB1]], [[V2]], %[[BB2]]
1343 BX_RET 14, $noreg, implicit $r0