MIR Serialization: Change MIR syntax - use custom syntax for MBBs.
[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: bb.0.entry
38   bb.0.entry:
39     successors: %bb.1.less, %bb.2.exit
40
41     %eax = MOV32rm %rdi, 1, _, 0, _
42     ; CHECK:      CMP32ri8 %eax, 10
43     ; CHECK-NEXT: JG_1 %bb.2.exit
44     CMP32ri8 %eax, 10, implicit-def %eflags
45     JG_1 %bb.2.exit, implicit %eflags
46   ; CHECK: bb.1.less:
47
48   bb.1.less:
49     %eax = MOV32r0 implicit-def %eflags
50
51   bb.2.exit:
52     RETQ %eax
53 ...
54 ---
55 # CHECK: name: bar
56 name:            bar
57 body: |
58   ; CHECK: bb.0.entry:
59   bb.0.entry:
60     successors: %bb.1, %bb.3
61
62     %eax = MOV32rm %rdi, 1, _, 0, _
63     ; CHECK:      CMP32ri8 %eax, 10
64     ; CHECK-NEXT: JG_1 %bb.2
65     CMP32ri8 %eax, 10, implicit-def %eflags
66     JG_1 %bb.3, implicit %eflags
67
68   bb.1:
69     %eax = MOV32r0 implicit-def %eflags
70
71   bb.3:
72     RETQ %eax
73 ...