1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
| # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32
--- |
define i32 @Unconditional_branch(i32 %a, i32 %b) {
entry:
br label %block
end: ; preds = %block
ret i32 %a
block: ; preds = %entry
br label %end
}
define i32 @Conditional_branch(i1 %cond, i32 %a, i32 %b) {
br i1 %cond, label %if.then, label %if.else
if.then: ; preds = %0
ret i32 %a
if.else: ; preds = %0
ret i32 %b
}
...
---
name: Unconditional_branch
alignment: 4
tracksRegLiveness: true
body: |
; MIPS32-LABEL: name: Unconditional_branch
; MIPS32: bb.0.entry:
; MIPS32: successors: %bb.2(0x80000000)
; MIPS32: liveins: $a0, $a1
; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
; MIPS32: G_BR %bb.2
; MIPS32: bb.1.end:
; MIPS32: $v0 = COPY [[COPY]](s32)
; MIPS32: RetRA implicit $v0
; MIPS32: bb.2.block:
; MIPS32: successors: %bb.1(0x80000000)
; MIPS32: G_BR %bb.1
bb.1.entry:
liveins: $a0, $a1
%0:_(s32) = COPY $a0
G_BR %bb.3
bb.2.end:
$v0 = COPY %0(s32)
RetRA implicit $v0
bb.3.block:
G_BR %bb.2
...
---
name: Conditional_branch
alignment: 4
tracksRegLiveness: true
body: |
; MIPS32-LABEL: name: Conditional_branch
; MIPS32: bb.0 (%ir-block.0):
; MIPS32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
; MIPS32: liveins: $a0, $a1, $a2
; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
; MIPS32: G_BRCOND [[AND]](s32), %bb.1
; MIPS32: G_BR %bb.2
; MIPS32: bb.1.if.then:
; MIPS32: $v0 = COPY [[COPY1]](s32)
; MIPS32: RetRA implicit $v0
; MIPS32: bb.2.if.else:
; MIPS32: $v0 = COPY [[COPY2]](s32)
; MIPS32: RetRA implicit $v0
bb.1 (%ir-block.0):
liveins: $a0, $a1, $a2
%3:_(s32) = COPY $a0
%0:_(s1) = G_TRUNC %3(s32)
%1:_(s32) = COPY $a1
%2:_(s32) = COPY $a2
G_BRCOND %0(s1), %bb.2
G_BR %bb.3
bb.2.if.then:
$v0 = COPY %1(s32)
RetRA implicit $v0
bb.3.if.else:
$v0 = COPY %2(s32)
RetRA implicit $v0
...
|