1 # RUN: llc -mtriple=s390x-linux-gnu -start-before=prologepilog %s -o - -mcpu=z14 \
2 # RUN: -verify-machineinstrs 2>&1 | FileCheck %s
5 # Test that redundant frame addressing anchor points are removed by
6 # MachineLateInstrsCleanup.
9 define void @fun1() { ret void }
10 define void @fun2() { ret void }
11 define void @fun3() { ret void }
12 define void @fun4() { ret void }
13 define void @fun5() { ret void }
14 define void @fun6() { ret void }
15 define void @fun7() { ret void }
16 define void @fun8() { ret void }
20 @ptr = external dso_local local_unnamed_addr global ptr
23 # Test elimination of redundant LAYs in successor blocks.
25 # CHECK: lay %r1, 4096(%r15)
32 tracksRegLiveness: true
34 - { id: 0, size: 5000 }
35 - { id: 1, size: 2500 }
36 - { id: 2, size: 2500 }
38 machineFunctionInfo: {}
42 successors: %bb.2(0x00000001), %bb.1(0x7fffffff)
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.0, 0, $noreg
49 VST64 renamable $f16d, %stack.1, 0, $noreg
50 CHIMux undef $r0l, 3, implicit-def $cc
51 BRC 14, 8, %bb.2, implicit killed $cc
56 VST64 renamable $f16d, %stack.2, 0, $noreg
61 VST64 renamable $f16d, %stack.1, 0, $noreg
65 # In this function the LAY in bb.1 will have a different offset, so the first
66 # LAY in bb.2 must remain.
68 # CHECK: lay %r1, 4096(%r15)
70 # CHECK: lay %r1, 8192(%r15)
72 # CHECK: lay %r1, 4096(%r15)
76 tracksRegLiveness: true
78 - { id: 0, size: 5000 }
79 - { id: 1, size: 5000 }
80 - { id: 2, size: 2500 }
82 machineFunctionInfo: {}
86 successors: %bb.2(0x00000001), %bb.1(0x7fffffff)
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.0, 0, $noreg
93 VST64 renamable $f16d, %stack.1, 0, $noreg
94 CHIMux undef $r0l, 3, implicit-def $cc
95 BRC 14, 8, %bb.2, implicit killed $cc
100 VST64 renamable $f16d, %stack.2, 0, $noreg
105 VST64 renamable $f16d, %stack.1, 0, $noreg
106 VST64 renamable $f16d, %stack.1, 0, $noreg
110 # Test case with a loop (with room for improvement: since %r1 is not clobbered
111 # inside the loop only the first LAY is needed).
113 # CHECK: lay %r1, 4096(%r15)
115 # CHECK: lay %r1, 4096(%r15)
117 # CHECK-NOT: lay %r1, 4096(%r15)
120 tracksRegLiveness: true
122 - { id: 0, size: 5000 }
123 - { id: 1, size: 2500 }
124 - { id: 2, size: 2500 }
126 machineFunctionInfo: {}
130 successors: %bb.2(0x00000001), %bb.1(0x7fffffff)
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.0, 0, $noreg
137 VST64 renamable $f16d, %stack.1, 0, $noreg
138 CHIMux undef $r0l, 3, implicit-def $cc
139 BRC 14, 8, %bb.2, implicit killed $cc
144 successors: %bb.2(0x00000001), %bb.1(0x7fffffff)
146 VST64 renamable $f16d, %stack.2, 0, $noreg
147 CHIMux undef $r0l, 3, implicit-def $cc
148 BRC 14, 8, %bb.1, implicit killed $cc
153 VST64 renamable $f16d, %stack.1, 0, $noreg
157 # Test case with a call which clobbers r1: the second LAY after the call is needed.
159 # CHECK: lay %r1, 4096(%r15)
161 # CHECK: lay %r1, 4096(%r15)
164 tracksRegLiveness: true
166 - { id: 0, size: 5000 }
167 - { id: 1, size: 2500 }
169 machineFunctionInfo: {}
174 VST64 renamable $f16d, %stack.0, 0, $noreg
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.1, 0, $noreg
180 ADJCALLSTACKDOWN 0, 0
181 CallBRASL @foo, csr_systemz_elf, implicit-def dead $r14d, implicit-def dead $cc, implicit $fpc, implicit-def $r2l
184 VST64 renamable $f17d, %stack.1, 0, $noreg
188 # Test case where index reg is loaded instead of using an LAY. Only one LGHI is needed.
190 # CHECK: lghi %r1, 4096
194 tracksRegLiveness: true
196 - { id: 0, size: 5000 }
197 - { id: 1, size: 2500 }
199 machineFunctionInfo: {}
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 VST64 renamable $f16d, %stack.0, 0, $noreg
209 $f0q = nofpexcept LXEB %stack.1, 0, $noreg, implicit $fpc
210 $f1q = nofpexcept LXEB %stack.1, 0, $noreg, implicit $fpc
214 # Test where the constant is a Global. Only one LARL is needed.
216 # CHECK: larl %r1, ptr
221 tracksRegLiveness: true
222 tracksDebugUserValues: true
227 - { id: 0, offset: -160, size: 8, alignment: 8 }
228 machineFunctionInfo: {}
231 successors: %bb.2(0x30000000), %bb.1(0x50000000)
233 renamable $r1d = LARL @ptr
234 CGHSI killed renamable $r1d, 0, 0, implicit-def $cc :: (volatile dereferenceable load (s64) from @ptr)
235 BRC 14, 8, %bb.2, implicit killed $cc
239 renamable $r1d = LARL @ptr
240 MVGHI killed renamable $r1d, 0, 0
247 # Load of an invariant location (GOT). Only one LGRL is needed.
249 # CHECK: lgrl %r1, ptr
254 tracksRegLiveness: true
255 tracksDebugUserValues: true
260 - { id: 0, offset: -160, size: 8, alignment: 8 }
261 machineFunctionInfo: {}
264 successors: %bb.2(0x30000000), %bb.1(0x50000000)
266 renamable $r1d = LGRL @ptr :: (load (s64) from got)
267 CGHSI killed renamable $r1d, 0, 0, implicit-def $cc :: (volatile dereferenceable load (s64) from @ptr)
268 BRC 14, 8, %bb.2, implicit killed $cc
272 renamable $r1d = LGRL @ptr :: (load (s64) from got)
273 MVGHI killed renamable $r1d, 0, 0
280 # Load from constant pool. Only one LARL is needed.
282 # CHECK: larl %r1, .LCPI7_0
287 tracksRegLiveness: true
288 tracksDebugUserValues: true
295 - { id: 0, offset: -160, size: 8, alignment: 8 }
298 value: float 0x43E0000000000000
300 machineFunctionInfo: {}
303 successors: %bb.1, %bb.2
306 renamable $r1d = LARL %const.0
307 renamable $f1s = LE killed renamable $r1d, 0, $noreg :: (load (s32) from constant-pool)
308 nofpexcept CEBR renamable $f0s, renamable $f1s, implicit-def $cc, implicit $fpc
309 BRC 15, 11, %bb.2, implicit killed $cc
319 renamable $r1d = LARL %const.0
320 renamable $f1s = LE killed renamable $r1d, 0, $noreg :: (load (s32) from constant-pool)