xref: /llvm-project/llvm/test/CodeGen/PowerPC/mcp-elim-eviction-chain.mir (revision 96aaebd12e734610fe0ef61329f99fdac253ef9f)
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -O3 -verify-machineinstrs -mtriple=powerpc64-unknown-unknown \
3# RUN:   -simplify-mir -run-pass=machine-cp %s -o - | FileCheck %s
4
5--- |
6  declare void @foo()
7  define void @test0() {
8  entry:
9    ret void
10  }
11
12  define void @test1() {
13  entry:
14    ret void
15  }
16
17  define void @test2() {
18  entry:
19    ret void
20  }
21
22  define void @test3() {
23  entry:
24    ret void
25  }
26
27  define void @test4() {
28  entry:
29    ret void
30  }
31
32  define void @test5() {
33  entry:
34    ret void
35  }
36
37  define void @test6() {
38  entry:
39    ret void
40  }
41
42...
43---
44name: test0
45alignment: 4
46tracksRegLiveness: true
47body: |
48  bb.0.entry:
49    liveins: $x4, $x5, $x20, $x21, $x22
50    ; CHECK-LABEL: name: test0
51    ; CHECK: liveins: $x4, $x5, $x20, $x21, $x22
52    ; CHECK-NEXT: {{  $}}
53    ; CHECK-NEXT: renamable $x24 = COPY $x4
54    ; CHECK-NEXT: $x23 = COPY renamable $x20
55    ; CHECK-NEXT: renamable $x20 = ADD8 $x4, $x5
56    ; CHECK-NEXT: renamable $x4 = COPY renamable $x20
57    ; CHECK-NEXT: renamable $x20 = COPY $x23
58    ; CHECK-NEXT: renamable $x23 = COPY renamable $x24
59    ; CHECK-NEXT: $x3 = COPY renamable $x4
60    ; CHECK-NEXT: BLR8 implicit $lr8, implicit undef $rm, implicit $x3, implicit $x20, implicit $x21, implicit $x22, implicit $x23
61    renamable $x23 = COPY renamable $x4
62    renamable $x24 = COPY renamable $x23
63    renamable $x23 = COPY renamable $x22
64    renamable $x22 = COPY renamable $x21
65    renamable $x21 = COPY renamable $x20
66    renamable $x20 = ADD8 $x4, $x5
67    renamable $x4 = COPY renamable $x20
68    renamable $x20 = COPY renamable $x21
69    renamable $x21 = COPY renamable $x22
70    renamable $x22 = COPY renamable $x23
71    renamable $x23 = COPY renamable $x24
72    $x3 = COPY renamable $x4
73    BLR8 implicit $lr8, implicit undef $rm, implicit $x3, implicit $x20, implicit $x21, implicit $x22, implicit $x23
74
75...
76
77# Duplicated pairs.
78---
79name: test1
80alignment: 4
81tracksRegLiveness: true
82body: |
83  bb.0.entry:
84    liveins: $x3, $x20, $x21, $x22, $x23
85    ; CHECK-LABEL: name: test1
86    ; CHECK: liveins: $x3, $x20, $x21, $x22, $x23
87    ; CHECK-NEXT: {{  $}}
88    ; CHECK-NEXT: renamable $x24 = COPY $x3
89    ; CHECK-NEXT: renamable $x23 = COPY renamable $x22
90    ; CHECK-NEXT: renamable $x22 = COPY renamable $x21
91    ; CHECK-NEXT: renamable $x21 = COPY renamable $x20
92    ; CHECK-NEXT: BLR8 implicit $lr8, implicit undef $rm, implicit $x3, implicit $x20, implicit $x21, implicit $x22, implicit $x23, implicit $x24
93    renamable $x23 = COPY $x3
94    renamable $x24 = COPY renamable $x23
95    renamable $x23 = COPY renamable $x22
96    renamable $x22 = COPY renamable $x21
97    renamable $x21 = COPY renamable $x20
98    renamable $x20 = COPY renamable $x21
99    renamable $x21 = COPY renamable $x22
100    renamable $x22 = COPY renamable $x23
101    renamable $x23 = COPY renamable $x24
102    renamable $x24 = COPY renamable $x23
103    renamable $x23 = COPY renamable $x22
104    renamable $x22 = COPY renamable $x21
105    renamable $x21 = COPY renamable $x20
106    BLR8 implicit $lr8, implicit undef $rm, implicit $x3, implicit $x20, implicit $x21, implicit $x22, implicit $x23, implicit $x24
107
108...
109
110# Chain one after one.
111---
112name: test2
113alignment: 4
114tracksRegLiveness: true
115body: |
116  bb.0.entry:
117    liveins: $x3, $x18, $x19, $x20, $x21, $x22, $x23, $x24
118    ; CHECK-LABEL: name: test2
119    ; CHECK: liveins: $x3, $x18, $x19, $x20, $x21, $x22, $x23, $x24
120    ; CHECK-NEXT: {{  $}}
121    ; CHECK-NEXT: renamable $x21 = COPY renamable $x20
122    ; CHECK-NEXT: renamable $x20 = COPY renamable $x21
123    ; CHECK-NEXT: renamable $x25 = COPY renamable $x24
124    ; CHECK-NEXT: renamable $x24 = COPY renamable $x25
125    ; CHECK-NEXT: BLR8 implicit $lr8, implicit undef $rm, implicit $x3, implicit $x18, implicit $x19, implicit $x20, implicit $x21, implicit $x22, implicit $x23, implicit $x24, implicit $x25
126    renamable $x21 = COPY renamable $x20
127    renamable $x20 = COPY renamable $x19
128    renamable $x19 = COPY renamable $x18
129    renamable $x18 = COPY renamable $x19
130    renamable $x19 = COPY renamable $x20
131    renamable $x20 = COPY renamable $x21
132    renamable $x25 = COPY renamable $x24
133    renamable $x24 = COPY renamable $x23
134    renamable $x23 = COPY renamable $x22
135    renamable $x22 = COPY renamable $x23
136    renamable $x23 = COPY renamable $x24
137    renamable $x24 = COPY renamable $x25
138    BLR8 implicit $lr8, implicit undef $rm, implicit $x3, implicit $x18, implicit $x19, implicit $x20, implicit $x21, implicit $x22, implicit $x23, implicit $x24, implicit $x25
139
140...
141
142# Reorder code in test2, thus we have two chains in build simultaneously.
143---
144name: test3
145alignment: 4
146tracksRegLiveness: true
147body: |
148  bb.0.entry:
149    liveins: $x3, $x18, $x19, $x20, $x21, $x22, $x23, $x24
150    ; CHECK-LABEL: name: test3
151    ; CHECK: liveins: $x3, $x18, $x19, $x20, $x21, $x22, $x23, $x24
152    ; CHECK-NEXT: {{  $}}
153    ; CHECK-NEXT: renamable $x21 = COPY renamable $x20
154    ; CHECK-NEXT: renamable $x25 = COPY renamable $x24
155    ; CHECK-NEXT: renamable $x20 = COPY renamable $x21
156    ; CHECK-NEXT: renamable $x24 = COPY renamable $x25
157    ; CHECK-NEXT: BLR8 implicit $lr8, implicit undef $rm, implicit $x3, implicit $x18, implicit $x19, implicit $x20, implicit $x21, implicit $x22, implicit $x23, implicit $x24, implicit $x25
158    renamable $x21 = COPY renamable $x20
159    renamable $x25 = COPY renamable $x24
160    renamable $x20 = COPY renamable $x19
161    renamable $x24 = COPY renamable $x23
162    renamable $x19 = COPY renamable $x18
163    renamable $x23 = COPY renamable $x22
164    renamable $x18 = COPY renamable $x19
165    renamable $x22 = COPY renamable $x23
166    renamable $x19 = COPY renamable $x20
167    renamable $x23 = COPY renamable $x24
168    renamable $x20 = COPY renamable $x21
169    renamable $x24 = COPY renamable $x25
170    BLR8 implicit $lr8, implicit undef $rm, implicit $x3, implicit $x18, implicit $x19, implicit $x20, implicit $x21, implicit $x22, implicit $x23, implicit $x24, implicit $x25
171
172...
173
174---
175name: test4
176alignment: 4
177tracksRegLiveness: true
178body: |
179  bb.0.entry:
180    liveins: $x3, $x4, $x5
181    ; CHECK-LABEL: name: test4
182    ; CHECK: liveins: $x3, $x4, $x5
183    ; CHECK-NEXT: {{  $}}
184    ; CHECK-NEXT: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
185    renamable $x5 = COPY renamable $x3
186    renamable $x4 = COPY renamable $x3
187    renamable $x2 = COPY renamable $x3
188    renamable $x3 = COPY renamable $x2
189    renamable $x3 = COPY renamable $x4
190    renamable $x3 = COPY renamable $x5
191    BLR8 implicit $lr8, implicit undef $rm, implicit $x3
192
193...
194
195# Chain across regmask.
196---
197name: test5
198alignment: 4
199tracksRegLiveness: true
200body: |
201  bb.0.entry:
202    liveins: $x17, $x16, $x15, $x14, $x3
203    ; CHECK-LABEL: name: test5
204    ; CHECK: liveins: $x17, $x16, $x15, $x14, $x3
205    ; CHECK-NEXT: {{  $}}
206    ; CHECK-NEXT: renamable $x18 = COPY renamable $x17
207    ; CHECK-NEXT: $x17 = COPY renamable $x3
208    ; CHECK-NEXT: BL8_NOP @foo, csr_ppc64, implicit-def dead $lr8, implicit $rm, implicit-def $x3, implicit $x3
209    ; CHECK-NEXT: renamable $x3 = COPY $x17
210    ; CHECK-NEXT: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
211    renamable $x18 = COPY renamable $x17
212    renamable $x17 = COPY renamable $x16
213    renamable $x16 = COPY renamable $x15
214    renamable $x15 = COPY renamable $x14
215    renamable $x14 = COPY renamable $x3
216    BL8_NOP @foo, csr_ppc64, implicit-def dead $lr8, implicit $rm, implicit-def $x3, implicit $x3
217    renamable $x3 = COPY renamable $x14
218    renamable $x14 = COPY renamable $x15
219    renamable $x15 = COPY renamable $x16
220    renamable $x16 = COPY renamable $x17
221    renamable $x17 = COPY renamable $x18
222    BLR8 implicit $lr8, implicit undef $rm, implicit $x3
223
224...
225
226# Two chains across regmask.
227---
228name: test6
229alignment: 4
230tracksRegLiveness: true
231body: |
232  bb.0.entry:
233    liveins: $x20, $x19, $x17, $x16, $x15, $x14, $x3, $x4
234    ; CHECK-LABEL: name: test6
235    ; CHECK: liveins: $x20, $x19, $x17, $x16, $x15, $x14, $x3, $x4
236    ; CHECK-NEXT: {{  $}}
237    ; CHECK-NEXT: renamable $x21 = COPY renamable $x20
238    ; CHECK-NEXT: renamable $x18 = COPY renamable $x17
239    ; CHECK-NEXT: $x17 = COPY renamable $x3
240    ; CHECK-NEXT: $x20 = COPY renamable $x4
241    ; CHECK-NEXT: BL8_NOP @foo, csr_ppc64, implicit-def dead $lr8, implicit $rm, implicit-def $x3, implicit $x3, implicit-def $x4, implicit $x4
242    ; CHECK-NEXT: renamable $x3 = COPY $x17
243    ; CHECK-NEXT: renamable $x4 = COPY $x20
244    ; CHECK-NEXT: BLR8 implicit $lr8, implicit undef $rm, implicit $x3, implicit $x4
245    renamable $x21 = COPY renamable $x20
246    renamable $x18 = COPY renamable $x17
247    renamable $x17 = COPY renamable $x16
248    renamable $x16 = COPY renamable $x15
249    renamable $x20 = COPY renamable $x19
250    renamable $x15 = COPY renamable $x14
251    renamable $x14 = COPY renamable $x3
252    renamable $x19 = COPY renamable $x4
253    BL8_NOP @foo, csr_ppc64, implicit-def dead $lr8, implicit $rm, implicit-def $x3, implicit $x3, implicit-def $x4, implicit $x4
254    renamable $x3 = COPY renamable $x14
255    renamable $x14 = COPY renamable $x15
256    renamable $x4 = COPY renamable $x19
257    renamable $x15 = COPY renamable $x16
258    renamable $x19 = COPY renamable $x20
259    renamable $x16 = COPY renamable $x17
260    renamable $x20 = COPY renamable $x21
261    renamable $x17 = COPY renamable $x18
262    BLR8 implicit $lr8, implicit undef $rm, implicit $x3, implicit $x4
263
264...
265
266