1# RUN: llc -mtriple=ppc64-- -run-pass scavenger-test -verify-machineinstrs -o - %s | FileCheck %s
2---
3# CHECK-LABEL: name: noscav0
4name: noscav0
5tracksRegLiveness: true
6body: |
7  bb.0:
8    ; CHECK: [[REG0:\$r[0-9]+]] = LI 42
9    ; CHECK-NEXT: NOP implicit killed [[REG0]]
10    %0 : gprc = LI 42
11    NOP implicit %0
12
13    ; CHECK: [[REG1:\$r[0-9]+]] = LI 42
14    ; CHECK-NEXT: NOP
15    ; CHECK-NEXT: NOP implicit [[REG1]]
16    ; CHECK-NEXT: NOP
17    ; CHECK-NEXT: NOP implicit killed [[REG1]]
18    %1 : gprc = LI 42
19    NOP
20    NOP implicit %1
21    NOP
22    NOP implicit %1
23
24    ; CHECK: [[REG2:\$r[0-9]+]] = LI 42
25    ; CHECK-NEXT: NOP implicit [[REG2]]
26    %2 : gprc = LI 42
27    NOP implicit %2
28
29    $x0 = IMPLICIT_DEF
30    $x1 = IMPLICIT_DEF
31    $x2 = IMPLICIT_DEF
32    $x3 = IMPLICIT_DEF
33    $x4 = IMPLICIT_DEF
34    $x27 = IMPLICIT_DEF
35    $x28 = IMPLICIT_DEF
36    $x29 = IMPLICIT_DEF
37    $x30 = IMPLICIT_DEF
38
39    ; CHECK-NOT: $x0 = LI 42
40    ; CHECK-NOT: $x1 = LI 42
41    ; CHECK-NOT: $x2 = LI 42
42    ; CHECK-NOT: $x3 = LI 42
43    ; CHECK-NOT: $x4 = LI 42
44    ; CHECK-NOT: $x5 = LI 42
45    ; CHECK-NOT: $x27 = LI 42
46    ; CHECK-NOT: $x28 = LI 42
47    ; CHECK-NOT: $x29 = LI 42
48    ; CHECK-NOT: $x30 = LI 42
49    ; CHECK: [[REG3:\$r[0-9]+]] = LI 42
50    ; CHECK-NEXT: $x5 = IMPLICIT_DEF
51    ; CHECK-NEXT: NOP implicit killed [[REG2]]
52    ; CHECK-NEXT: NOP implicit killed [[REG3]]
53    %3 : gprc = LI 42
54    $x5 = IMPLICIT_DEF
55    NOP implicit %2
56    NOP implicit %3
57
58    NOP implicit $x0
59    NOP implicit $x1
60    NOP implicit $x2
61    NOP implicit $x3
62    NOP implicit $x4
63    NOP implicit $x5
64    NOP implicit $x27
65    NOP implicit $x28
66    NOP implicit $x29
67    NOP implicit $x30
68...
69---
70# CHECK-LABEL: name: scav0
71name: scav0
72tracksRegLiveness: true
73stack:
74  # variable-sized object should be a reason to reserve an emergency spillslot
75  # in the RegScavenger
76  - { id: 0, type: variable-sized, offset: -32, alignment: 1 }
77body: |
78  bb.0:
79    $x0 = IMPLICIT_DEF
80    $x1 = IMPLICIT_DEF
81    $x2 = IMPLICIT_DEF
82    $x3 = IMPLICIT_DEF
83    $x4 = IMPLICIT_DEF
84    $x5 = IMPLICIT_DEF
85    $x6 = IMPLICIT_DEF
86    $x7 = IMPLICIT_DEF
87    $x8 = IMPLICIT_DEF
88    $x9 = IMPLICIT_DEF
89    $x10 = IMPLICIT_DEF
90    $x11 = IMPLICIT_DEF
91    $x12 = IMPLICIT_DEF
92    $x13 = IMPLICIT_DEF
93    $x14 = IMPLICIT_DEF
94    $x15 = IMPLICIT_DEF
95    $x16 = IMPLICIT_DEF
96    $x17 = IMPLICIT_DEF
97    $x18 = IMPLICIT_DEF
98    $x19 = IMPLICIT_DEF
99    $x20 = IMPLICIT_DEF
100    $x21 = IMPLICIT_DEF
101    $x22 = IMPLICIT_DEF
102    $x23 = IMPLICIT_DEF
103    $x24 = IMPLICIT_DEF
104    $x25 = IMPLICIT_DEF
105    $x26 = IMPLICIT_DEF
106    $x27 = IMPLICIT_DEF
107    $x28 = IMPLICIT_DEF
108    $x29 = IMPLICIT_DEF
109    $x30 = IMPLICIT_DEF
110
111    ; CHECK: STD killed [[SPILLEDREG:\$x[0-9]+]]
112    ; CHECK: [[SPILLEDREG]] = LI8 42
113    ; CHECK: NOP implicit killed [[SPILLEDREG]]
114    ; CHECK: [[SPILLEDREG]] = LD
115    %0 : g8rc = LI8 42
116    NOP implicit %0
117
118    NOP implicit $x0
119    NOP implicit $x1
120    NOP implicit $x2
121    NOP implicit $x3
122    NOP implicit $x4
123    NOP implicit $x5
124    NOP implicit $x6
125    NOP implicit $x7
126    NOP implicit $x8
127    NOP implicit $x9
128    NOP implicit $x10
129    NOP implicit $x11
130    NOP implicit $x12
131    NOP implicit $x13
132    NOP implicit $x14
133    NOP implicit $x15
134    NOP implicit $x16
135    NOP implicit $x17
136    NOP implicit $x18
137    NOP implicit $x19
138    NOP implicit $x20
139    NOP implicit $x21
140    NOP implicit $x22
141    NOP implicit $x23
142    NOP implicit $x24
143    NOP implicit $x25
144    NOP implicit $x26
145    NOP implicit $x27
146    NOP implicit $x28
147    NOP implicit $x29
148    NOP implicit $x30
149...
150---
151# Check for bug where we would refuse to spill before the first instruction in a
152# block.
153# CHECK-LABEL: name: spill_at_begin
154# CHECK: bb.0:
155# CHECK: liveins:
156# CHECK: STD killed [[REG:\$x[0-9]+]]{{.*}}(store 8 into %stack.{{[0-9]+}})
157# CHECK: [[REG]] = LIS8 0
158# CHECK: [[REG]] = ORI8 killed [[REG]], 48
159# CHECK: NOP implicit killed [[REG]]
160# CHECK: [[REG]] = LD{{.*}}(load 8 from %stack.{{[0-9]+}})
161name: spill_at_begin
162tracksRegLiveness: true
163stack:
164  # variable-sized object should be a reason to reserve an emergency spillslot
165  # in the RegScavenger
166  - { id: 0, type: variable-sized, offset: -32, alignment: 1 }
167body: |
168  bb.0:
169    liveins: $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28, $x29, $x30, $x31
170    %0 : g8rc = LIS8 0
171    %1 : g8rc = ORI8 %0, 48
172    NOP implicit %1
173
174    NOP implicit $x0
175    NOP implicit $x1
176    NOP implicit $x2
177    NOP implicit $x3
178    NOP implicit $x4
179    NOP implicit $x5
180    NOP implicit $x6
181    NOP implicit $x7
182    NOP implicit $x8
183    NOP implicit $x9
184    NOP implicit $x10
185    NOP implicit $x11
186    NOP implicit $x12
187    NOP implicit $x13
188    NOP implicit $x14
189    NOP implicit $x15
190    NOP implicit $x16
191    NOP implicit $x17
192    NOP implicit $x18
193    NOP implicit $x19
194    NOP implicit $x20
195    NOP implicit $x21
196    NOP implicit $x22
197    NOP implicit $x23
198    NOP implicit $x24
199    NOP implicit $x25
200    NOP implicit $x26
201    NOP implicit $x27
202    NOP implicit $x28
203    NOP implicit $x29
204    NOP implicit $x30
205    NOP implicit $x31
206...
207