1 # RUN: llc -mtriple=s390x-linux-gnu -start-before=prologepilog %s -o - -mcpu=z14 \
2 # RUN: -verify-machineinstrs 2>&1 | FileCheck %s
4 # Test that redundant frame addressing anchor points are removed by
5 # MachineLateInstrsCleanup.
8 define void @fun1() { ret void }
9 define void @fun2() { ret void }
10 define void @fun3() { ret void }
11 define void @fun4() { ret void }
12 define void @fun5() { ret void }
13 define void @fun6() { ret void }
14 define void @fun7() { ret void }
15 define void @fun8() { ret void }
19 @ptr = external dso_local local_unnamed_addr global ptr
22 # Test elimination of redundant LAYs in successor blocks.
24 # CHECK: lay %r1, 4096(%r15)
31 tracksRegLiveness: true
33 - { id: 0, size: 5000 }
34 - { id: 1, size: 2500 }
35 - { id: 2, size: 2500 }
37 machineFunctionInfo: {}
41 successors: %bb.2(0x00000001), %bb.1(0x7fffffff)
43 VST64 renamable $f16d, %stack.0, 0, $noreg
44 VST64 renamable $f16d, %stack.0, 0, $noreg
45 VST64 renamable $f16d, %stack.0, 0, $noreg
46 VST64 renamable $f16d, %stack.0, 0, $noreg
47 VST64 renamable $f16d, %stack.0, 0, $noreg
48 VST64 renamable $f16d, %stack.1, 0, $noreg
49 CHIMux undef $r0l, 3, implicit-def $cc
50 BRC 14, 8, %bb.2, implicit killed $cc
55 VST64 renamable $f16d, %stack.2, 0, $noreg
60 VST64 renamable $f16d, %stack.1, 0, $noreg
64 # In this function the LAY in bb.1 will have a different offset, so the first
65 # LAY in bb.2 must remain.
67 # CHECK: lay %r1, 4096(%r15)
69 # CHECK: lay %r1, 8192(%r15)
71 # CHECK: lay %r1, 4096(%r15)
75 tracksRegLiveness: true
77 - { id: 0, size: 5000 }
78 - { id: 1, size: 5000 }
79 - { id: 2, size: 2500 }
81 machineFunctionInfo: {}
85 successors: %bb.2(0x00000001), %bb.1(0x7fffffff)
87 VST64 renamable $f16d, %stack.0, 0, $noreg
88 VST64 renamable $f16d, %stack.0, 0, $noreg
89 VST64 renamable $f16d, %stack.0, 0, $noreg
90 VST64 renamable $f16d, %stack.0, 0, $noreg
91 VST64 renamable $f16d, %stack.0, 0, $noreg
92 VST64 renamable $f16d, %stack.1, 0, $noreg
93 CHIMux undef $r0l, 3, implicit-def $cc
94 BRC 14, 8, %bb.2, implicit killed $cc
99 VST64 renamable $f16d, %stack.2, 0, $noreg
104 VST64 renamable $f16d, %stack.1, 0, $noreg
105 VST64 renamable $f16d, %stack.1, 0, $noreg
109 # Test case with a loop (with room for improvement: since %r1 is not clobbered
110 # inside the loop only the first LAY is needed).
112 # CHECK: lay %r1, 4096(%r15)
114 # CHECK: lay %r1, 4096(%r15)
116 # CHECK-NOT: lay %r1, 4096(%r15)
119 tracksRegLiveness: true
121 - { id: 0, size: 5000 }
122 - { id: 1, size: 2500 }
123 - { id: 2, size: 2500 }
125 machineFunctionInfo: {}
129 successors: %bb.2(0x00000001), %bb.1(0x7fffffff)
131 VST64 renamable $f16d, %stack.0, 0, $noreg
132 VST64 renamable $f16d, %stack.0, 0, $noreg
133 VST64 renamable $f16d, %stack.0, 0, $noreg
134 VST64 renamable $f16d, %stack.0, 0, $noreg
135 VST64 renamable $f16d, %stack.0, 0, $noreg
136 VST64 renamable $f16d, %stack.1, 0, $noreg
137 CHIMux undef $r0l, 3, implicit-def $cc
138 BRC 14, 8, %bb.2, implicit killed $cc
143 successors: %bb.2(0x00000001), %bb.1(0x7fffffff)
145 VST64 renamable $f16d, %stack.2, 0, $noreg
146 CHIMux undef $r0l, 3, implicit-def $cc
147 BRC 14, 8, %bb.1, implicit killed $cc
152 VST64 renamable $f16d, %stack.1, 0, $noreg
156 # Test case with a call which clobbers r1: the second LAY after the call is needed.
158 # CHECK: lay %r1, 4096(%r15)
160 # CHECK: lay %r1, 4096(%r15)
163 tracksRegLiveness: true
167 - { id: 0, size: 5000 }
168 - { id: 1, size: 2500 }
170 machineFunctionInfo: {}
175 VST64 renamable $f16d, %stack.0, 0, $noreg
176 VST64 renamable $f16d, %stack.0, 0, $noreg
177 VST64 renamable $f16d, %stack.0, 0, $noreg
178 VST64 renamable $f16d, %stack.0, 0, $noreg
179 VST64 renamable $f16d, %stack.0, 0, $noreg
180 VST64 renamable $f16d, %stack.1, 0, $noreg
181 CallBRASL @foo, csr_systemz_elf, implicit-def dead $r14d, implicit-def dead $cc, implicit $fpc, implicit-def $r2l
183 VST64 renamable $f17d, %stack.1, 0, $noreg
187 # Test case where index reg is loaded instead of using an LAY. Only one LGHI is needed.
189 # CHECK: lghi %r1, 4096
193 tracksRegLiveness: true
195 - { id: 0, size: 5000 }
196 - { id: 1, size: 2500 }
198 machineFunctionInfo: {}
203 VST64 renamable $f16d, %stack.0, 0, $noreg
204 VST64 renamable $f16d, %stack.0, 0, $noreg
205 VST64 renamable $f16d, %stack.0, 0, $noreg
206 VST64 renamable $f16d, %stack.0, 0, $noreg
207 VST64 renamable $f16d, %stack.0, 0, $noreg
208 $f0q = nofpexcept LXEB %stack.1, 0, $noreg, implicit $fpc
209 $f1q = nofpexcept LXEB %stack.1, 0, $noreg, implicit $fpc
213 # Test where the constant is a Global. Only one LARL is needed.
215 # CHECK: larl %r1, ptr
220 tracksRegLiveness: true
221 tracksDebugUserValues: true
226 - { id: 0, offset: -160, size: 8, alignment: 8 }
227 machineFunctionInfo: {}
230 successors: %bb.2(0x30000000), %bb.1(0x50000000)
232 renamable $r1d = LARL @ptr
233 CGHSI killed renamable $r1d, 0, 0, implicit-def $cc :: (volatile dereferenceable load (s64) from @ptr)
234 BRC 14, 8, %bb.2, implicit killed $cc
238 renamable $r1d = LARL @ptr
239 MVGHI killed renamable $r1d, 0, 0
246 # Load of an invariant location (GOT). Only one LGRL is needed.
248 # CHECK: lgrl %r1, ptr
253 tracksRegLiveness: true
254 tracksDebugUserValues: true
259 - { id: 0, offset: -160, size: 8, alignment: 8 }
260 machineFunctionInfo: {}
263 successors: %bb.2(0x30000000), %bb.1(0x50000000)
265 renamable $r1d = LGRL @ptr :: (load (s64) from got)
266 CGHSI killed renamable $r1d, 0, 0, implicit-def $cc :: (volatile dereferenceable load (s64) from @ptr)
267 BRC 14, 8, %bb.2, implicit killed $cc
271 renamable $r1d = LGRL @ptr :: (load (s64) from got)
272 MVGHI killed renamable $r1d, 0, 0
279 # Load from constant pool. Only one LARL is needed.
281 # CHECK: larl %r1, .LCPI7_0
286 tracksRegLiveness: true
287 tracksDebugUserValues: true
294 - { id: 0, offset: -160, size: 8, alignment: 8 }
297 value: float 0x43E0000000000000
299 machineFunctionInfo: {}
302 successors: %bb.1, %bb.2
305 renamable $r1d = LARL %const.0
306 renamable $f1s = LE killed renamable $r1d, 0, $noreg :: (load (s32) from constant-pool)
307 nofpexcept CEBR renamable $f0s, renamable $f1s, implicit-def $cc, implicit $fpc
308 BRC 15, 11, %bb.2, implicit killed $cc
318 renamable $r1d = LARL %const.0
319 renamable $f1s = LE killed renamable $r1d, 0, $noreg :: (load (s32) from constant-pool)