1# RUN: llc -mtriple thumbv7-apple-ios -run-pass none -o - %s | FileCheck %s
2# This test ensures that the MIR parser parses the bundled machine instructions
3# and 'internal' register flags correctly.
4
5--- |
6
7  define i32 @test1(i32 %a) {
8  entry:
9    %cmp = icmp sgt i32 %a, -78
10    %. = zext i1 %cmp to i32
11    ret i32 %.
12  }
13
14  define i32 @test2(i32 %a) {
15  entry:
16    %cmp = icmp sgt i32 %a, -78
17    %. = zext i1 %cmp to i32
18    ret i32 %.
19  }
20
21...
22---
23name:            test1
24tracksRegLiveness: true
25liveins:
26  - { reg: '$r0' }
27body: |
28  bb.0.entry:
29    liveins: $r0
30    ; CHECK-LABEL: name: test1
31    ; CHECK:      $r1 = t2MOVi 0, 14, $noreg, $noreg
32    ; CHECK-NEXT: t2CMNri killed $r0, 78, 14, $noreg, implicit-def $cpsr
33    ; CHECK-NEXT: BUNDLE implicit-def dead $itstate, implicit-def $r1, implicit killed $cpsr {
34    ; CHECK-NEXT:   t2IT 12, 8, implicit-def $itstate
35    ; CHECK-NEXT:   $r1 = t2MOVi 1, 12, killed $cpsr, $noreg, implicit internal killed $itstate
36    ; CHECK-NEXT: }
37    ; CHECK-NEXT: $r0 = tMOVr killed $r1, 14, $noreg
38    ; CHECK-NEXT: tBX_RET 14, $noreg, implicit killed $r0
39    $r1 = t2MOVi 0, 14, _, _
40    t2CMNri killed $r0, 78, 14, _, implicit-def $cpsr
41    BUNDLE implicit-def dead $itstate, implicit-def $r1, implicit killed $cpsr {
42      t2IT 12, 8, implicit-def $itstate
43      $r1 = t2MOVi 1, 12, killed $cpsr, _, implicit internal killed $itstate
44    }
45    $r0 = tMOVr killed $r1, 14, _
46    tBX_RET 14, _, implicit killed $r0
47...
48---
49name:            test2
50tracksRegLiveness: true
51liveins:
52  - { reg: '$r0' }
53body: |
54  bb.0.entry:
55    liveins: $r0
56
57    ; Verify that the next machine instruction can be on the same line as
58    ; '{' or '}'.
59
60    ; CHECK-LABEL: name: test2
61    ; CHECK:      $r1 = t2MOVi 0, 14, $noreg, $noreg
62    ; CHECK-NEXT: t2CMNri killed $r0, 78, 14, $noreg, implicit-def $cpsr
63    ; CHECK-NEXT: BUNDLE implicit-def dead $itstate, implicit-def $r1, implicit killed $cpsr {
64    ; CHECK-NEXT:   t2IT 12, 8, implicit-def $itstate
65    ; CHECK-NEXT:   $r1 = t2MOVi 1, 12, killed $cpsr, $noreg, implicit internal killed $itstate
66    ; CHECK-NEXT: }
67    ; CHECK-NEXT: $r0 = tMOVr killed $r1, 14, $noreg
68    ; CHECK-NEXT: tBX_RET 14, $noreg, implicit killed $r0
69    $r1 = t2MOVi 0, 14, _, _
70    t2CMNri killed $r0, 78, 14, _, implicit-def $cpsr
71    BUNDLE implicit-def dead $itstate, implicit-def $r1, implicit killed $cpsr { t2IT 12, 8, implicit-def $itstate
72      $r1 = t2MOVi 1, 12, killed $cpsr, _, internal implicit killed $itstate
73    } $r0 = tMOVr killed $r1, 14, _
74    tBX_RET 14, _, implicit killed $r0
75...
76