MIR Tests: Add liveins and successors to make tests pass with machine verifier.
[oota-llvm.git] / test / CodeGen / MIR / X86 / machine-basic-block-operands.mir
1 # RUN: llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s
2 # This test ensures that the MIR parser parses machine basic block operands.
3
4 --- |
5
6   define i32 @foo(i32* %p) {
7   entry:
8     %a = load i32, i32* %p
9     %0 = icmp sle i32 %a, 10
10     br i1 %0, label %less, label %exit
11
12   less:
13     ret i32 0
14
15   exit:
16     ret i32 %a
17   }
18
19   define i32 @bar(i32* %p) {
20   entry:
21     %a = load i32, i32* %p
22     %b = icmp sle i32 %a, 10
23     br i1 %b, label %0, label %1
24
25   ; <label>:0
26     ret i32 0
27
28   ; <label>:1
29     ret i32 %a
30   }
31
32 ...
33 ---
34 # CHECK: name: foo
35 name:            foo
36 body:
37  # CHECK: name: entry
38  - id:              0
39    name:            entry
40    successors:      [ '%bb.1.less', '%bb.2.exit' ]
41    instructions:
42      - '%eax = MOV32rm %rdi, 1, _, 0, _'
43      # CHECK:      - 'CMP32ri8 %eax, 10
44      # CHECK-NEXT: - 'JG_1 %bb.2.exit
45      - 'CMP32ri8 %eax, 10, implicit-def %eflags'
46      - 'JG_1 %bb.2.exit, implicit %eflags'
47  # CHECK: name: less
48  - id:              1
49    name:            less
50    instructions:
51      - '%eax = MOV32r0 implicit-def %eflags'
52  - id:              2
53    name:            exit
54    instructions:
55      - 'RETQ %eax'
56 ...
57 ---
58 # CHECK: name: bar
59 name:            bar
60 body:
61  # CHECK: name: entry
62  - id: 0
63    name: entry
64    successors:  [ '%bb.1', '%bb.3' ]
65    instructions:
66      - '%eax = MOV32rm %rdi, 1, _, 0, _'
67      # CHECK:      - 'CMP32ri8 %eax, 10
68      # CHECK-NEXT: - 'JG_1 %bb.2
69      - 'CMP32ri8 %eax, 10, implicit-def %eflags'
70      - 'JG_1 %bb.3, implicit %eflags'
71  - id: 1
72    instructions:
73      - '%eax = MOV32r0 implicit-def %eflags'
74  - id: 3
75    instructions:
76      - 'RETQ %eax'
77 ...