Debian Codegraph @

llvm/test/CodeGen/PowerPC/machine-backward-cp.mir

raw
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O3 -verify-machineinstrs -mtriple=powerpc64le-unknown-unknown \
3 # RUN: -mcpu=pwr9 -simplify-mir -run-pass=machine-cp %s -o - | FileCheck %s
4
5
6 # Normal case
7 ---
8 name: test0
9 alignment: 4
10 tracksRegLiveness: true
11 body: |
12 bb.0.entry:
13 ; CHECK-LABEL: name: test0
14 ; CHECK: $x3 = LI8 1024
15 ; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
16 renamable $x4 = LI8 1024
17 $x3 = COPY renamable killed $x4
18 BLR8 implicit $lr8, implicit undef $rm, implicit $x3
19
20 ...
21
22 # Not in terminal BBs
23 ---
24 name: test1
25 alignment: 4
26 tracksRegLiveness: true
27 body: |
28 ; CHECK-LABEL: name: test1
29 ; CHECK: bb.0.entry:
30 ; CHECK: renamable $x4 = LI8 42
31 ; CHECK: B %bb.1
32 ; CHECK: bb.1:
33 ; CHECK: liveins: $x4
34 ; CHECK: $x3 = COPY killed renamable $x4
35 ; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
36 bb.0.entry:
37 successors: %bb.1
38
39 renamable $x5 = LI8 42
40 renamable $x4 = COPY renamable killed $x5
41 B %bb.1
42
43 bb.1:
44 liveins: $x4
45 $x3 = COPY renamable killed $x4
46 BLR8 implicit $lr8, implicit undef $rm, implicit $x3
47
48 ...
49
50 # Use reserved register
51 ---
52 name: test2
53 alignment: 4
54 tracksRegLiveness: true
55 body: |
56 bb.0.entry:
57 ; CHECK-LABEL: name: test2
58 ; CHECK: renamable $x4 = LI8 1024
59 ; CHECK: $x13 = COPY killed renamable $x4
60 ; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit undef $x3
61 renamable $x4 = LI8 1024
62 $x13 = COPY renamable killed $x4
63 BLR8 implicit $lr8, implicit undef $rm, implicit undef $x3
64
65 ...
66
67 # Intermediate read of copy's src
68 ---
69 name: test3
70 alignment: 4
71 tracksRegLiveness: true
72 body: |
73 bb.0.entry:
74 ; CHECK-LABEL: name: test3
75 ; CHECK: renamable $x4 = LI8 0
76 ; CHECK: renamable $x5 = ADDI8 $x4, 1
77 ; CHECK: $x3 = COPY killed renamable $x4
78 ; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
79 renamable $x4 = LI8 0
80 renamable $x5 = ADDI8 $x4, 1
81 $x3 = COPY renamable killed $x4
82 BLR8 implicit $lr8, implicit undef $rm, implicit $x3
83
84 ...
85
86 # Intermediate read of copy's def
87 ---
88 name: test4
89 alignment: 4
90 tracksRegLiveness: true
91 body: |
92 bb.0.entry:
93 liveins: $x3
94
95 ; CHECK-LABEL: name: test4
96 ; CHECK: liveins: $x3
97 ; CHECK: renamable $x4 = LI8 0
98 ; CHECK: renamable $x5 = ADDI8 $x3, 1
99 ; CHECK: $x3 = COPY killed renamable $x4
100 ; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
101 renamable $x4 = LI8 0
102 renamable $x5 = ADDI8 $x3, 1
103 $x3 = COPY renamable killed $x4
104 BLR8 implicit $lr8, implicit undef $rm, implicit $x3
105
106 ...
107
108 # Intermiediate clobber of copy's def
109 ---
110 name: test5
111 alignment: 4
112 tracksRegLiveness: true
113 body: |
114 bb.0.entry:
115 liveins: $x3, $x5
116
117 ; CHECK-LABEL: name: test5
118 ; CHECK: liveins: $x3, $x5
119 ; CHECK: renamable $x4 = LI8 0
120 ; CHECK: renamable $x3 = ADDI8 $x5, 1
121 ; CHECK: $x3 = COPY killed renamable $x4
122 ; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
123 renamable $x4 = LI8 0
124 renamable $x3 = ADDI8 $x5, 1
125 $x3 = COPY renamable killed $x4
126 BLR8 implicit $lr8, implicit undef $rm, implicit $x3
127
128 ...
129
130 ---
131 name: iterative_deletion
132 alignment: 4
133 tracksRegLiveness: true
134 body: |
135 bb.0.entry:
136 liveins: $x5
137
138 ; CHECK-LABEL: name: iterative_deletion
139 ; CHECK: liveins: $x5
140 ; CHECK: renamable $x4 = ADDI8 killed renamable $x5, 1
141 ; CHECK: $x3 = COPY $x4
142 ; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
143 renamable $x6 = ADDI8 renamable killed $x5, 1
144 renamable $x4 = COPY renamable killed $x6
145 renamable $x7 = COPY renamable killed $x4
146 $x3 = COPY renamable killed $x7
147 BLR8 implicit $lr8, implicit undef $rm, implicit $x3
148
149 ...
150
151 ---
152 name: Enter
153 alignment: 4
154 tracksRegLiveness: true
155 body: |
156 bb.0.entry:
157 liveins: $x4, $x7
158 ; CHECK-LABEL: name: Enter
159 ; CHECK: liveins: $x4, $x7
160 ; CHECK: renamable $x5 = COPY killed renamable $x7
161 ; CHECK: renamable $x7 = ADDI8 killed renamable $x4, 1
162 ; CHECK: $x3 = ADD8 killed renamable $x5, killed renamable $x7
163 ; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
164 renamable $x5 = COPY killed renamable $x7
165 renamable $x6 = ADDI8 killed renamable $x4, 1
166 renamable $x7 = COPY killed renamable $x6
167 $x3 = ADD8 renamable killed $x5, renamable killed $x7
168 BLR8 implicit $lr8, implicit undef $rm, implicit $x3
169
170 ...
171
172 ---
173 name: foo
174 alignment: 4
175 tracksRegLiveness: true
176 body: |
177 bb.0.entry:
178 liveins: $x4, $x7
179 ; CHECK-LABEL: name: foo
180 ; CHECK: liveins: $x4, $x7
181 ; CHECK: renamable $x5 = COPY killed renamable $x7
182 ; CHECK: renamable $x7 = ADDI8 renamable $x4, 1
183 ; CHECK: renamable $x6 = ADDI8 killed $x4, 2
184 ; CHECK: $x3 = ADD8 killed renamable $x5, killed renamable $x6
185 ; CHECK: $x3 = ADD8 $x3, killed renamable $x7
186 ; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
187 renamable $x5 = COPY killed renamable $x7
188 renamable $x6 = ADDI8 renamable $x4, 1
189 renamable $x7 = COPY killed renamable $x6
190 renamable $x8 = ADDI8 killed $x4, 2
191 renamable $x6 = COPY killed renamable $x8
192 $x3 = ADD8 renamable killed $x5, renamable killed $x6
193 $x3 = ADD8 $x3, renamable killed $x7
194 BLR8 implicit $lr8, implicit undef $rm, implicit $x3
195
196 ...
197
198 ---
199 name: bar
200 alignment: 4
201 tracksRegLiveness: true
202 body: |
203 bb.0.entry:
204 liveins: $x4, $x7
205 ; CHECK-LABEL: name: bar
206 ; CHECK: liveins: $x4, $x7
207 ; CHECK: renamable $x5 = COPY killed renamable $x7
208 ; CHECK: renamable $x7 = ADDI8 renamable $x4, 1
209 ; CHECK: renamable $x8 = COPY killed renamable $x7
210 ; CHECK: renamable $x7 = ADDI8 renamable $x5, 2
211 ; CHECK: $x3 = ADD8 killed renamable $x5, killed renamable $x7
212 ; CHECK: $x3 = ADD8 $x3, killed renamable $x8
213 ; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
214 renamable $x5 = COPY killed renamable $x7
215 renamable $x6 = ADDI8 renamable $x4, 1
216 renamable $x7 = COPY killed renamable $x6
217 renamable $x8 = COPY killed renamable $x7
218 renamable $x6 = ADDI8 renamable $x5, 2
219 renamable $x7 = COPY killed renamable $x6
220 $x3 = ADD8 renamable killed $x5, renamable killed $x7
221 $x3 = ADD8 $x3, renamable killed $x8
222 BLR8 implicit $lr8, implicit undef $rm, implicit $x3
223
224 ...
225
226 ---
227 name: bogus
228 alignment: 4
229 tracksRegLiveness: true
230 body: |
231 bb.0.entry:
232 liveins: $x7
233 ; CHECK-LABEL: name: bogus
234 ; CHECK: liveins: $x7
235 ; CHECK: renamable $x5 = COPY renamable $x7
236 ; CHECK: renamable $x4 = ADDI8 $x7, 1
237 ; CHECK: renamable $x6 = ADDI8 renamable $x5, 2
238 ; CHECK: $x3 = ADD8 killed renamable $x4, killed renamable $x5
239 ; CHECK: $x3 = ADD8 $x3, killed renamable $x6
240 ; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
241 renamable $x5 = COPY killed renamable $x7
242 renamable $x6 = ADDI8 renamable $x5, 1
243 renamable $x4 = COPY killed renamable $x6
244 renamable $x7 = COPY killed renamable $x4
245 renamable $x6 = ADDI8 renamable $x5, 2
246 renamable $x4 = COPY killed renamable $x7
247 $x3 = ADD8 renamable killed $x4, renamable killed $x5
248 $x3 = ADD8 $x3, renamable killed $x6
249 BLR8 implicit $lr8, implicit undef $rm, implicit $x3
250
251 ...
252
253 ---
254 name: foobar
255 alignment: 4
256 tracksRegLiveness: true
257 body: |
258 bb.0.entry:
259 liveins: $x7
260 ; CHECK-LABEL: name: foobar
261 ; CHECK: liveins: $x7
262 ; CHECK: renamable $x4 = ADDI8 $x7, 1
263 ; CHECK: renamable $x8 = COPY killed renamable $x4
264 ; CHECK: renamable $x4 = ADDI8 $x7, 2
265 ; CHECK: $x3 = ADD8 killed renamable $x4, $x7
266 ; CHECK: $x3 = ADD8 $x3, killed renamable $x8
267 ; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
268 renamable $x5 = COPY killed renamable $x7
269 renamable $x6 = ADDI8 renamable $x5, 1
270 renamable $x4 = COPY killed renamable $x6
271 renamable $x8 = COPY killed renamable $x4
272 renamable $x6 = ADDI8 renamable $x5, 2
273 renamable $x4 = COPY killed renamable $x6
274 $x3 = ADD8 renamable killed $x4, renamable killed $x5
275 $x3 = ADD8 $x3, renamable killed $x8
276 BLR8 implicit $lr8, implicit undef $rm, implicit $x3
277
278 ...
279
280 ---
281 name: cross_call
282 alignment: 4
283 tracksRegLiveness: true
284 body: |
285 bb.0.entry:
286 liveins: $x2, $x3, $x20
287 ; CHECK-LABEL: name: cross_call
288 ; CHECK: liveins: $x2, $x3, $x20
289 ; CHECK: renamable $x20 = LI8 1024
290 ; CHECK: BL8_NOP @foo, csr_ppc64_altivec, implicit-def $lr8, implicit $rm, implicit $x3, implicit-def $x3, implicit $x2
291 ; CHECK: $x3 = COPY killed renamable $x20
292 ; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
293 renamable $x20 = LI8 1024
294 BL8_NOP @foo, csr_ppc64_altivec, implicit-def $lr8, implicit $rm, implicit $x3, implicit-def $x3, implicit $x2
295 $x3 = COPY renamable killed $x20
296 BLR8 implicit $lr8, implicit undef $rm, implicit $x3
297 ...