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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
| # 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 @mod4_0_to_11(i32 %a) {
entry:
switch i32 %a, label %sw.default [
i32 0, label %sw.bb
i32 4, label %sw.bb
i32 1, label %sw.bb1
i32 5, label %sw.bb1
i32 2, label %sw.bb2
i32 6, label %sw.bb2
i32 3, label %sw.bb3
i32 7, label %sw.bb3
]
sw.bb: ; preds = %entry, %entry
ret i32 0
sw.bb1: ; preds = %entry, %entry
ret i32 1
sw.bb2: ; preds = %entry, %entry
ret i32 2
sw.bb3: ; preds = %entry, %entry
ret i32 3
sw.default: ; preds = %entry
br label %sw.epilog
sw.epilog: ; preds = %sw.default
switch i32 %a, label %sw.default8 [
i32 8, label %sw.bb4
i32 9, label %sw.bb5
i32 10, label %sw.bb6
i32 11, label %sw.bb7
]
sw.bb4: ; preds = %sw.epilog
ret i32 0
sw.bb5: ; preds = %sw.epilog
ret i32 1
sw.bb6: ; preds = %sw.epilog
ret i32 2
sw.bb7: ; preds = %sw.epilog
ret i32 3
sw.default8: ; preds = %sw.epilog
ret i32 -1
}
...
---
name: mod4_0_to_11
alignment: 4
tracksRegLiveness: true
jumpTable:
kind: block-address
entries:
- id: 0
blocks: [ '%bb.2', '%bb.3', '%bb.4', '%bb.5', '%bb.2', '%bb.3',
'%bb.4', '%bb.5' ]
- id: 1
blocks: [ '%bb.8', '%bb.9', '%bb.10', '%bb.11' ]
body: |
; MIPS32-LABEL: name: mod4_0_to_11
; MIPS32: bb.0.entry:
; MIPS32: successors: %bb.6(0x40000000), %bb.1(0x40000000)
; MIPS32: liveins: $a0
; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 7
; MIPS32: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
; MIPS32: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
; MIPS32: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; MIPS32: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
; MIPS32: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
; MIPS32: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
; MIPS32: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[C6]]
; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[C]](s32)
; MIPS32: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[COPY1]](s32), [[COPY2]]
; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[ICMP]](s32)
; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C3]]
; MIPS32: G_BRCOND [[AND]](s32), %bb.6
; MIPS32: bb.1.entry:
; MIPS32: successors: %bb.2(0x20000000), %bb.3(0x20000000), %bb.4(0x20000000), %bb.5(0x20000000)
; MIPS32: [[JUMP_TABLE:%[0-9]+]]:_(p0) = G_JUMP_TABLE %jump-table.0
; MIPS32: G_BRJT [[JUMP_TABLE]](p0), %jump-table.0, [[COPY1]](s32)
; MIPS32: bb.2.sw.bb:
; MIPS32: $v0 = COPY [[C4]](s32)
; MIPS32: RetRA implicit $v0
; MIPS32: bb.3.sw.bb1:
; MIPS32: $v0 = COPY [[C3]](s32)
; MIPS32: RetRA implicit $v0
; MIPS32: bb.4.sw.bb2:
; MIPS32: $v0 = COPY [[C2]](s32)
; MIPS32: RetRA implicit $v0
; MIPS32: bb.5.sw.bb3:
; MIPS32: $v0 = COPY [[C1]](s32)
; MIPS32: RetRA implicit $v0
; MIPS32: bb.6.sw.default:
; MIPS32: successors: %bb.7(0x80000000)
; MIPS32: bb.7.sw.epilog:
; MIPS32: successors: %bb.13(0x40000000), %bb.8(0x40000000)
; MIPS32: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
; MIPS32: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[C7]]
; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[SUB1]](s32)
; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY [[C1]](s32)
; MIPS32: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[COPY4]](s32), [[COPY5]]
; MIPS32: [[C8:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; MIPS32: [[COPY6:%[0-9]+]]:_(s32) = COPY [[ICMP1]](s32)
; MIPS32: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY6]], [[C8]]
; MIPS32: G_BRCOND [[AND1]](s32), %bb.13
; MIPS32: bb.8.sw.epilog:
; MIPS32: successors: %bb.9(0x20000000), %bb.10(0x20000000), %bb.11(0x20000000), %bb.12(0x20000000)
; MIPS32: [[JUMP_TABLE1:%[0-9]+]]:_(p0) = G_JUMP_TABLE %jump-table.1
; MIPS32: G_BRJT [[JUMP_TABLE1]](p0), %jump-table.1, [[COPY4]](s32)
; MIPS32: bb.9.sw.bb4:
; MIPS32: $v0 = COPY [[C4]](s32)
; MIPS32: RetRA implicit $v0
; MIPS32: bb.10.sw.bb5:
; MIPS32: $v0 = COPY [[C3]](s32)
; MIPS32: RetRA implicit $v0
; MIPS32: bb.11.sw.bb6:
; MIPS32: $v0 = COPY [[C2]](s32)
; MIPS32: RetRA implicit $v0
; MIPS32: bb.12.sw.bb7:
; MIPS32: $v0 = COPY [[C1]](s32)
; MIPS32: RetRA implicit $v0
; MIPS32: bb.13.sw.default8:
; MIPS32: $v0 = COPY [[C5]](s32)
; MIPS32: RetRA implicit $v0
bb.1.entry:
liveins: $a0
%0:_(s32) = COPY $a0
%4:_(s32) = G_CONSTANT i32 7
%8:_(s32) = G_CONSTANT i32 3
%9:_(s32) = G_CONSTANT i32 2
%10:_(s32) = G_CONSTANT i32 1
%11:_(s32) = G_CONSTANT i32 0
%18:_(s32) = G_CONSTANT i32 -1
%1:_(s32) = G_CONSTANT i32 0
%2:_(s32) = G_SUB %0, %1
%3:_(s32) = COPY %2(s32)
%5:_(s32) = COPY %4(s32)
%6:_(s1) = G_ICMP intpred(ugt), %3(s32), %5
G_BRCOND %6(s1), %bb.6
bb.13.entry:
successors: %bb.2, %bb.3, %bb.4, %bb.5
%7:_(p0) = G_JUMP_TABLE %jump-table.0
G_BRJT %7(p0), %jump-table.0, %3(s32)
bb.2.sw.bb:
$v0 = COPY %11(s32)
RetRA implicit $v0
bb.3.sw.bb1:
$v0 = COPY %10(s32)
RetRA implicit $v0
bb.4.sw.bb2:
$v0 = COPY %9(s32)
RetRA implicit $v0
bb.5.sw.bb3:
$v0 = COPY %8(s32)
RetRA implicit $v0
bb.6.sw.default:
bb.7.sw.epilog:
%12:_(s32) = G_CONSTANT i32 8
%13:_(s32) = G_SUB %0, %12
%14:_(s32) = COPY %13(s32)
%15:_(s32) = COPY %8(s32)
%16:_(s1) = G_ICMP intpred(ugt), %14(s32), %15
G_BRCOND %16(s1), %bb.12
bb.14.sw.epilog:
successors: %bb.8, %bb.9, %bb.10, %bb.11
%17:_(p0) = G_JUMP_TABLE %jump-table.1
G_BRJT %17(p0), %jump-table.1, %14(s32)
bb.8.sw.bb4:
$v0 = COPY %11(s32)
RetRA implicit $v0
bb.9.sw.bb5:
$v0 = COPY %10(s32)
RetRA implicit $v0
bb.10.sw.bb6:
$v0 = COPY %9(s32)
RetRA implicit $v0
bb.11.sw.bb7:
$v0 = COPY %8(s32)
RetRA implicit $v0
bb.12.sw.default8:
$v0 = COPY %18(s32)
RetRA implicit $v0
...
|