xref: /aosp_15_r20/external/llvm/test/CodeGen/SystemZ/frame-16.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; Test the handling of base + index + displacement addresses for large frames,
2*9880d681SAndroid Build Coastguard Worker; in cases where both 12-bit and 20-bit displacements are allowed.
3*9880d681SAndroid Build Coastguard Worker; The tests here assume z10 register pressure, without the high words
4*9880d681SAndroid Build Coastguard Worker; being available.
5*9880d681SAndroid Build Coastguard Worker;
6*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | \
7*9880d681SAndroid Build Coastguard Worker; RUN:   FileCheck -check-prefix=CHECK-NOFP %s
8*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 -disable-fp-elim | \
9*9880d681SAndroid Build Coastguard Worker; RUN:   FileCheck -check-prefix=CHECK-FP %s
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker; This file tests what happens when a displacement is converted from
12*9880d681SAndroid Build Coastguard Worker; being relative to the start of a frame object to being relative to
13*9880d681SAndroid Build Coastguard Worker; the frame itself.  In some cases the test is only possible if two
14*9880d681SAndroid Build Coastguard Worker; objects are allocated.
15*9880d681SAndroid Build Coastguard Worker;
16*9880d681SAndroid Build Coastguard Worker; Rather than rely on a particular order for those objects, the tests
17*9880d681SAndroid Build Coastguard Worker; instead allocate two objects of the same size and apply the test to
18*9880d681SAndroid Build Coastguard Worker; both of them.  For consistency, all tests follow this model, even if
19*9880d681SAndroid Build Coastguard Worker; one object would actually be enough.
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Worker; First check the highest offset that is in range of the 12-bit form.
22*9880d681SAndroid Build Coastguard Worker;
23*9880d681SAndroid Build Coastguard Worker; The last in-range doubleword offset is 4088.  Since the frame has two
24*9880d681SAndroid Build Coastguard Worker; emergency spill slots at 160(%r15), the amount that we need to allocate
25*9880d681SAndroid Build Coastguard Worker; in order to put another object at offset 4088 is 4088 - 176 = 3912 bytes.
26*9880d681SAndroid Build Coastguard Workerdefine void @f1(i8 %byte) {
27*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP-LABEL: f1:
28*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stc %r2, 4095(%r15)
29*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: br %r14
30*9880d681SAndroid Build Coastguard Worker;
31*9880d681SAndroid Build Coastguard Worker; CHECK-FP-LABEL: f1:
32*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stc %r2, 4095(%r11)
33*9880d681SAndroid Build Coastguard Worker; CHECK-FP: br %r14
34*9880d681SAndroid Build Coastguard Worker  %region1 = alloca [3912 x i8], align 8
35*9880d681SAndroid Build Coastguard Worker  %region2 = alloca [3912 x i8], align 8
36*9880d681SAndroid Build Coastguard Worker  %ptr1 = getelementptr inbounds [3912 x i8], [3912 x i8]* %region1, i64 0, i64 7
37*9880d681SAndroid Build Coastguard Worker  %ptr2 = getelementptr inbounds [3912 x i8], [3912 x i8]* %region2, i64 0, i64 7
38*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr1
39*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr2
40*9880d681SAndroid Build Coastguard Worker  ret void
41*9880d681SAndroid Build Coastguard Worker}
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Worker; Test the first offset that is out-of-range of the 12-bit form.
44*9880d681SAndroid Build Coastguard Workerdefine void @f2(i8 %byte) {
45*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP-LABEL: f2:
46*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stcy %r2, 4096(%r15)
47*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: br %r14
48*9880d681SAndroid Build Coastguard Worker;
49*9880d681SAndroid Build Coastguard Worker; CHECK-FP-LABEL: f2:
50*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stcy %r2, 4096(%r11)
51*9880d681SAndroid Build Coastguard Worker; CHECK-FP: br %r14
52*9880d681SAndroid Build Coastguard Worker  %region1 = alloca [3912 x i8], align 8
53*9880d681SAndroid Build Coastguard Worker  %region2 = alloca [3912 x i8], align 8
54*9880d681SAndroid Build Coastguard Worker  %ptr1 = getelementptr inbounds [3912 x i8], [3912 x i8]* %region1, i64 0, i64 8
55*9880d681SAndroid Build Coastguard Worker  %ptr2 = getelementptr inbounds [3912 x i8], [3912 x i8]* %region2, i64 0, i64 8
56*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr1
57*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr2
58*9880d681SAndroid Build Coastguard Worker  ret void
59*9880d681SAndroid Build Coastguard Worker}
60*9880d681SAndroid Build Coastguard Worker
61*9880d681SAndroid Build Coastguard Worker; Test the last offset that is in range of the 20-bit form.
62*9880d681SAndroid Build Coastguard Worker;
63*9880d681SAndroid Build Coastguard Worker; The last in-range doubleword offset is 524280, so by the same reasoning
64*9880d681SAndroid Build Coastguard Worker; as above, we need to allocate objects of 524280 - 176 = 524104 bytes.
65*9880d681SAndroid Build Coastguard Workerdefine void @f3(i8 %byte) {
66*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP-LABEL: f3:
67*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stcy %r2, 524287(%r15)
68*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: br %r14
69*9880d681SAndroid Build Coastguard Worker;
70*9880d681SAndroid Build Coastguard Worker; CHECK-FP-LABEL: f3:
71*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stcy %r2, 524287(%r11)
72*9880d681SAndroid Build Coastguard Worker; CHECK-FP: br %r14
73*9880d681SAndroid Build Coastguard Worker  %region1 = alloca [524104 x i8], align 8
74*9880d681SAndroid Build Coastguard Worker  %region2 = alloca [524104 x i8], align 8
75*9880d681SAndroid Build Coastguard Worker  %ptr1 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region1, i64 0, i64 7
76*9880d681SAndroid Build Coastguard Worker  %ptr2 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region2, i64 0, i64 7
77*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr1
78*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr2
79*9880d681SAndroid Build Coastguard Worker  ret void
80*9880d681SAndroid Build Coastguard Worker}
81*9880d681SAndroid Build Coastguard Worker
82*9880d681SAndroid Build Coastguard Worker; Test the first out-of-range offset.  We can't use an index register here,
83*9880d681SAndroid Build Coastguard Worker; and the offset is also out of LAY's range, so expect a constant load
84*9880d681SAndroid Build Coastguard Worker; followed by an addition.
85*9880d681SAndroid Build Coastguard Workerdefine void @f4(i8 %byte) {
86*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP-LABEL: f4:
87*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: llilh %r1, 8
88*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stc %r2, 0(%r1,%r15)
89*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: br %r14
90*9880d681SAndroid Build Coastguard Worker;
91*9880d681SAndroid Build Coastguard Worker; CHECK-FP-LABEL: f4:
92*9880d681SAndroid Build Coastguard Worker; CHECK-FP: llilh %r1, 8
93*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stc %r2, 0(%r1,%r11)
94*9880d681SAndroid Build Coastguard Worker; CHECK-FP: br %r14
95*9880d681SAndroid Build Coastguard Worker  %region1 = alloca [524104 x i8], align 8
96*9880d681SAndroid Build Coastguard Worker  %region2 = alloca [524104 x i8], align 8
97*9880d681SAndroid Build Coastguard Worker  %ptr1 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region1, i64 0, i64 8
98*9880d681SAndroid Build Coastguard Worker  %ptr2 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region2, i64 0, i64 8
99*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr1
100*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr2
101*9880d681SAndroid Build Coastguard Worker  ret void
102*9880d681SAndroid Build Coastguard Worker}
103*9880d681SAndroid Build Coastguard Worker
104*9880d681SAndroid Build Coastguard Worker; Add 4095 to the previous offset, to test the other end of the STC range.
105*9880d681SAndroid Build Coastguard Worker; The instruction will actually be STCY before frame lowering.
106*9880d681SAndroid Build Coastguard Workerdefine void @f5(i8 %byte) {
107*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP-LABEL: f5:
108*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: llilh %r1, 8
109*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stc %r2, 4095(%r1,%r15)
110*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: br %r14
111*9880d681SAndroid Build Coastguard Worker;
112*9880d681SAndroid Build Coastguard Worker; CHECK-FP-LABEL: f5:
113*9880d681SAndroid Build Coastguard Worker; CHECK-FP: llilh %r1, 8
114*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stc %r2, 4095(%r1,%r11)
115*9880d681SAndroid Build Coastguard Worker; CHECK-FP: br %r14
116*9880d681SAndroid Build Coastguard Worker  %region1 = alloca [524104 x i8], align 8
117*9880d681SAndroid Build Coastguard Worker  %region2 = alloca [524104 x i8], align 8
118*9880d681SAndroid Build Coastguard Worker  %ptr1 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region1, i64 0, i64 4103
119*9880d681SAndroid Build Coastguard Worker  %ptr2 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region2, i64 0, i64 4103
120*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr1
121*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr2
122*9880d681SAndroid Build Coastguard Worker  ret void
123*9880d681SAndroid Build Coastguard Worker}
124*9880d681SAndroid Build Coastguard Worker
125*9880d681SAndroid Build Coastguard Worker; Test the next offset after that, which uses STCY instead of STC.
126*9880d681SAndroid Build Coastguard Workerdefine void @f6(i8 %byte) {
127*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP-LABEL: f6:
128*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: llilh %r1, 8
129*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stcy %r2, 4096(%r1,%r15)
130*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: br %r14
131*9880d681SAndroid Build Coastguard Worker;
132*9880d681SAndroid Build Coastguard Worker; CHECK-FP-LABEL: f6:
133*9880d681SAndroid Build Coastguard Worker; CHECK-FP: llilh %r1, 8
134*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stcy %r2, 4096(%r1,%r11)
135*9880d681SAndroid Build Coastguard Worker; CHECK-FP: br %r14
136*9880d681SAndroid Build Coastguard Worker  %region1 = alloca [524104 x i8], align 8
137*9880d681SAndroid Build Coastguard Worker  %region2 = alloca [524104 x i8], align 8
138*9880d681SAndroid Build Coastguard Worker  %ptr1 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region1, i64 0, i64 4104
139*9880d681SAndroid Build Coastguard Worker  %ptr2 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region2, i64 0, i64 4104
140*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr1
141*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr2
142*9880d681SAndroid Build Coastguard Worker  ret void
143*9880d681SAndroid Build Coastguard Worker}
144*9880d681SAndroid Build Coastguard Worker
145*9880d681SAndroid Build Coastguard Worker; Now try an offset of 524287 from the start of the object, with the
146*9880d681SAndroid Build Coastguard Worker; object being at offset 1048576 (1 << 20).  The backend prefers to create
147*9880d681SAndroid Build Coastguard Worker; anchors 0x10000 bytes apart, so that the high part can be loaded using
148*9880d681SAndroid Build Coastguard Worker; LLILH while still using STC in more cases than 0x40000 anchors would.
149*9880d681SAndroid Build Coastguard Workerdefine void @f7(i8 %byte) {
150*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP-LABEL: f7:
151*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: llilh %r1, 23
152*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stcy %r2, 65535(%r1,%r15)
153*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: br %r14
154*9880d681SAndroid Build Coastguard Worker;
155*9880d681SAndroid Build Coastguard Worker; CHECK-FP-LABEL: f7:
156*9880d681SAndroid Build Coastguard Worker; CHECK-FP: llilh %r1, 23
157*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stcy %r2, 65535(%r1,%r11)
158*9880d681SAndroid Build Coastguard Worker; CHECK-FP: br %r14
159*9880d681SAndroid Build Coastguard Worker  %region1 = alloca [1048400 x i8], align 8
160*9880d681SAndroid Build Coastguard Worker  %region2 = alloca [1048400 x i8], align 8
161*9880d681SAndroid Build Coastguard Worker  %ptr1 = getelementptr inbounds [1048400 x i8], [1048400 x i8]* %region1, i64 0, i64 524287
162*9880d681SAndroid Build Coastguard Worker  %ptr2 = getelementptr inbounds [1048400 x i8], [1048400 x i8]* %region2, i64 0, i64 524287
163*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr1
164*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr2
165*9880d681SAndroid Build Coastguard Worker  ret void
166*9880d681SAndroid Build Coastguard Worker}
167*9880d681SAndroid Build Coastguard Worker
168*9880d681SAndroid Build Coastguard Worker; Keep the object-relative offset the same but bump the size of the
169*9880d681SAndroid Build Coastguard Worker; objects by one doubleword.
170*9880d681SAndroid Build Coastguard Workerdefine void @f8(i8 %byte) {
171*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP-LABEL: f8:
172*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: llilh %r1, 24
173*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stc %r2, 7(%r1,%r15)
174*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: br %r14
175*9880d681SAndroid Build Coastguard Worker;
176*9880d681SAndroid Build Coastguard Worker; CHECK-FP-LABEL: f8:
177*9880d681SAndroid Build Coastguard Worker; CHECK-FP: llilh %r1, 24
178*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stc %r2, 7(%r1,%r11)
179*9880d681SAndroid Build Coastguard Worker; CHECK-FP: br %r14
180*9880d681SAndroid Build Coastguard Worker  %region1 = alloca [1048408 x i8], align 8
181*9880d681SAndroid Build Coastguard Worker  %region2 = alloca [1048408 x i8], align 8
182*9880d681SAndroid Build Coastguard Worker  %ptr1 = getelementptr inbounds [1048408 x i8], [1048408 x i8]* %region1, i64 0, i64 524287
183*9880d681SAndroid Build Coastguard Worker  %ptr2 = getelementptr inbounds [1048408 x i8], [1048408 x i8]* %region2, i64 0, i64 524287
184*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr1
185*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr2
186*9880d681SAndroid Build Coastguard Worker  ret void
187*9880d681SAndroid Build Coastguard Worker}
188*9880d681SAndroid Build Coastguard Worker
189*9880d681SAndroid Build Coastguard Worker; Check a case where the original displacement is out of range.  The backend
190*9880d681SAndroid Build Coastguard Worker; should force separate address logic from the outset.  We don't yet do any
191*9880d681SAndroid Build Coastguard Worker; kind of anchor optimization, so there should be no offset on the STC itself.
192*9880d681SAndroid Build Coastguard Worker;
193*9880d681SAndroid Build Coastguard Worker; Before frame lowering this is an LA followed by the AGFI seen below.
194*9880d681SAndroid Build Coastguard Worker; The LA then gets lowered into the LLILH/LA form.  The exact sequence
195*9880d681SAndroid Build Coastguard Worker; isn't that important though.
196*9880d681SAndroid Build Coastguard Workerdefine void @f9(i8 %byte) {
197*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP-LABEL: f9:
198*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: llilh [[R1:%r[1-5]]], 16
199*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: la [[R2:%r[1-5]]], 8([[R1]],%r15)
200*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: agfi [[R2]], 524288
201*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stc %r2, 0([[R2]])
202*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: br %r14
203*9880d681SAndroid Build Coastguard Worker;
204*9880d681SAndroid Build Coastguard Worker; CHECK-FP-LABEL: f9:
205*9880d681SAndroid Build Coastguard Worker; CHECK-FP: llilh [[R1:%r[1-5]]], 16
206*9880d681SAndroid Build Coastguard Worker; CHECK-FP: la [[R2:%r[1-5]]], 8([[R1]],%r11)
207*9880d681SAndroid Build Coastguard Worker; CHECK-FP: agfi [[R2]], 524288
208*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stc %r2, 0([[R2]])
209*9880d681SAndroid Build Coastguard Worker; CHECK-FP: br %r14
210*9880d681SAndroid Build Coastguard Worker  %region1 = alloca [1048408 x i8], align 8
211*9880d681SAndroid Build Coastguard Worker  %region2 = alloca [1048408 x i8], align 8
212*9880d681SAndroid Build Coastguard Worker  %ptr1 = getelementptr inbounds [1048408 x i8], [1048408 x i8]* %region1, i64 0, i64 524288
213*9880d681SAndroid Build Coastguard Worker  %ptr2 = getelementptr inbounds [1048408 x i8], [1048408 x i8]* %region2, i64 0, i64 524288
214*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr1
215*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr2
216*9880d681SAndroid Build Coastguard Worker  ret void
217*9880d681SAndroid Build Coastguard Worker}
218*9880d681SAndroid Build Coastguard Worker
219*9880d681SAndroid Build Coastguard Worker; Repeat f4 in a case that needs the emergency spill slots (because all
220*9880d681SAndroid Build Coastguard Worker; call-clobbered registers are live and no call-saved ones have been
221*9880d681SAndroid Build Coastguard Worker; allocated).
222*9880d681SAndroid Build Coastguard Workerdefine void @f10(i32 *%vptr, i8 %byte) {
223*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP-LABEL: f10:
224*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stg [[REGISTER:%r[1-9][0-4]?]], [[OFFSET:160|168]](%r15)
225*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: llilh [[REGISTER]], 8
226*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stc %r3, 0([[REGISTER]],%r15)
227*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: lg [[REGISTER]], [[OFFSET]](%r15)
228*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: br %r14
229*9880d681SAndroid Build Coastguard Worker;
230*9880d681SAndroid Build Coastguard Worker; CHECK-FP-LABEL: f10:
231*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stg [[REGISTER:%r[1-9][0-4]?]], [[OFFSET:160|168]](%r11)
232*9880d681SAndroid Build Coastguard Worker; CHECK-FP: llilh [[REGISTER]], 8
233*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stc %r3, 0([[REGISTER]],%r11)
234*9880d681SAndroid Build Coastguard Worker; CHECK-FP: lg [[REGISTER]], [[OFFSET]](%r11)
235*9880d681SAndroid Build Coastguard Worker; CHECK-FP: br %r14
236*9880d681SAndroid Build Coastguard Worker  %i0 = load volatile i32 , i32 *%vptr
237*9880d681SAndroid Build Coastguard Worker  %i1 = load volatile i32 , i32 *%vptr
238*9880d681SAndroid Build Coastguard Worker  %i4 = load volatile i32 , i32 *%vptr
239*9880d681SAndroid Build Coastguard Worker  %i5 = load volatile i32 , i32 *%vptr
240*9880d681SAndroid Build Coastguard Worker  %region1 = alloca [524104 x i8], align 8
241*9880d681SAndroid Build Coastguard Worker  %region2 = alloca [524104 x i8], align 8
242*9880d681SAndroid Build Coastguard Worker  %ptr1 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region1, i64 0, i64 8
243*9880d681SAndroid Build Coastguard Worker  %ptr2 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region2, i64 0, i64 8
244*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr1
245*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr2
246*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i0, i32 *%vptr
247*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i1, i32 *%vptr
248*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i4, i32 *%vptr
249*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i5, i32 *%vptr
250*9880d681SAndroid Build Coastguard Worker  ret void
251*9880d681SAndroid Build Coastguard Worker}
252*9880d681SAndroid Build Coastguard Worker
253*9880d681SAndroid Build Coastguard Worker; And again with maximum register pressure.  The only spill slots that the
254*9880d681SAndroid Build Coastguard Worker; NOFP case needs are the emergency ones, so the offsets are the same as for f4.
255*9880d681SAndroid Build Coastguard Worker; However, the FP case uses %r11 as the frame pointer and must therefore
256*9880d681SAndroid Build Coastguard Worker; spill a second register.  This leads to an extra displacement of 8.
257*9880d681SAndroid Build Coastguard Workerdefine void @f11(i32 *%vptr, i8 %byte) {
258*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP-LABEL: f11:
259*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stmg %r6, %r15,
260*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stg [[REGISTER:%r[1-9][0-4]?]], [[OFFSET:160|168]](%r15)
261*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: llilh [[REGISTER]], 8
262*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stc %r3, 0([[REGISTER]],%r15)
263*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: lg [[REGISTER]], [[OFFSET]](%r15)
264*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: lmg %r6, %r15,
265*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: br %r14
266*9880d681SAndroid Build Coastguard Worker;
267*9880d681SAndroid Build Coastguard Worker; CHECK-FP-LABEL: f11:
268*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stmg %r6, %r15,
269*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stg [[REGISTER:%r[1-9][0-4]?]], [[OFFSET:160|168]](%r11)
270*9880d681SAndroid Build Coastguard Worker; CHECK-FP: llilh [[REGISTER]], 8
271*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stc %r3, 8([[REGISTER]],%r11)
272*9880d681SAndroid Build Coastguard Worker; CHECK-FP: lg [[REGISTER]], [[OFFSET]](%r11)
273*9880d681SAndroid Build Coastguard Worker; CHECK-FP: lmg %r6, %r15,
274*9880d681SAndroid Build Coastguard Worker; CHECK-FP: br %r14
275*9880d681SAndroid Build Coastguard Worker  %i0 = load volatile i32 , i32 *%vptr
276*9880d681SAndroid Build Coastguard Worker  %i1 = load volatile i32 , i32 *%vptr
277*9880d681SAndroid Build Coastguard Worker  %i4 = load volatile i32 , i32 *%vptr
278*9880d681SAndroid Build Coastguard Worker  %i5 = load volatile i32 , i32 *%vptr
279*9880d681SAndroid Build Coastguard Worker  %i6 = load volatile i32 , i32 *%vptr
280*9880d681SAndroid Build Coastguard Worker  %i7 = load volatile i32 , i32 *%vptr
281*9880d681SAndroid Build Coastguard Worker  %i8 = load volatile i32 , i32 *%vptr
282*9880d681SAndroid Build Coastguard Worker  %i9 = load volatile i32 , i32 *%vptr
283*9880d681SAndroid Build Coastguard Worker  %i10 = load volatile i32 , i32 *%vptr
284*9880d681SAndroid Build Coastguard Worker  %i11 = load volatile i32 , i32 *%vptr
285*9880d681SAndroid Build Coastguard Worker  %i12 = load volatile i32 , i32 *%vptr
286*9880d681SAndroid Build Coastguard Worker  %i13 = load volatile i32 , i32 *%vptr
287*9880d681SAndroid Build Coastguard Worker  %i14 = load volatile i32 , i32 *%vptr
288*9880d681SAndroid Build Coastguard Worker  %region1 = alloca [524104 x i8], align 8
289*9880d681SAndroid Build Coastguard Worker  %region2 = alloca [524104 x i8], align 8
290*9880d681SAndroid Build Coastguard Worker  %ptr1 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region1, i64 0, i64 8
291*9880d681SAndroid Build Coastguard Worker  %ptr2 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region2, i64 0, i64 8
292*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr1
293*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr2
294*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i0, i32 *%vptr
295*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i1, i32 *%vptr
296*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i4, i32 *%vptr
297*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i5, i32 *%vptr
298*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i6, i32 *%vptr
299*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i7, i32 *%vptr
300*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i8, i32 *%vptr
301*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i9, i32 *%vptr
302*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i10, i32 *%vptr
303*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i11, i32 *%vptr
304*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i12, i32 *%vptr
305*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i13, i32 *%vptr
306*9880d681SAndroid Build Coastguard Worker  store volatile i32 %i14, i32 *%vptr
307*9880d681SAndroid Build Coastguard Worker  ret void
308*9880d681SAndroid Build Coastguard Worker}
309*9880d681SAndroid Build Coastguard Worker
310*9880d681SAndroid Build Coastguard Worker; Repeat f4 in a case where the index register is already occupied.
311*9880d681SAndroid Build Coastguard Workerdefine void @f12(i8 %byte, i64 %index) {
312*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP-LABEL: f12:
313*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: llilh %r1, 8
314*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: agr %r1, %r15
315*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: stc %r2, 0(%r3,%r1)
316*9880d681SAndroid Build Coastguard Worker; CHECK-NOFP: br %r14
317*9880d681SAndroid Build Coastguard Worker;
318*9880d681SAndroid Build Coastguard Worker; CHECK-FP-LABEL: f12:
319*9880d681SAndroid Build Coastguard Worker; CHECK-FP: llilh %r1, 8
320*9880d681SAndroid Build Coastguard Worker; CHECK-FP: agr %r1, %r11
321*9880d681SAndroid Build Coastguard Worker; CHECK-FP: stc %r2, 0(%r3,%r1)
322*9880d681SAndroid Build Coastguard Worker; CHECK-FP: br %r14
323*9880d681SAndroid Build Coastguard Worker  %region1 = alloca [524104 x i8], align 8
324*9880d681SAndroid Build Coastguard Worker  %region2 = alloca [524104 x i8], align 8
325*9880d681SAndroid Build Coastguard Worker  %index1 = add i64 %index, 8
326*9880d681SAndroid Build Coastguard Worker  %ptr1 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region1, i64 0, i64 %index1
327*9880d681SAndroid Build Coastguard Worker  %ptr2 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region2, i64 0, i64 %index1
328*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr1
329*9880d681SAndroid Build Coastguard Worker  store volatile i8 %byte, i8 *%ptr2
330*9880d681SAndroid Build Coastguard Worker  ret void
331*9880d681SAndroid Build Coastguard Worker}
332