1 ; Like frame-02.ll, but with long doubles rather than floats. Some of the
2 ; cases are slightly different because we need to allocate pairs of FPRs.
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
6 ; This function should require all FPRs, but no other spill slots.
7 ; We need to save and restore 8 of the 16 FPRs, so the frame size
8 ; should be exactly 8 * 8 = 64. The CFA offset is 160
9 ; (the caller-allocated part of the frame) + 64.
10 define void @f1(ptr %ptr) {
12 ; CHECK: aghi %r15, -64
13 ; CHECK: .cfi_def_cfa_offset 224
14 ; CHECK: std %f8, 56(%r15)
15 ; CHECK: std %f9, 48(%r15)
16 ; CHECK: std %f10, 40(%r15)
17 ; CHECK: std %f11, 32(%r15)
18 ; CHECK: std %f12, 24(%r15)
19 ; CHECK: std %f13, 16(%r15)
20 ; CHECK: std %f14, 8(%r15)
21 ; CHECK: std %f15, 0(%r15)
22 ; CHECK: .cfi_offset %f8, -168
23 ; CHECK: .cfi_offset %f9, -176
24 ; CHECK: .cfi_offset %f10, -184
25 ; CHECK: .cfi_offset %f11, -192
26 ; CHECK: .cfi_offset %f12, -200
27 ; CHECK: .cfi_offset %f13, -208
28 ; CHECK: .cfi_offset %f14, -216
29 ; CHECK: .cfi_offset %f15, -224
30 ; ...main function body...
31 ; CHECK: ld %f8, 56(%r15)
32 ; CHECK: ld %f9, 48(%r15)
33 ; CHECK: ld %f10, 40(%r15)
34 ; CHECK: ld %f11, 32(%r15)
35 ; CHECK: ld %f12, 24(%r15)
36 ; CHECK: ld %f13, 16(%r15)
37 ; CHECK: ld %f14, 8(%r15)
38 ; CHECK: ld %f15, 0(%r15)
39 ; CHECK: aghi %r15, 64
41 %l0 = load volatile fp128, ptr %ptr
42 %l1 = load volatile fp128, ptr %ptr
43 %l4 = load volatile fp128, ptr %ptr
44 %l5 = load volatile fp128, ptr %ptr
45 %l8 = load volatile fp128, ptr %ptr
46 %l9 = load volatile fp128, ptr %ptr
47 %l12 = load volatile fp128, ptr %ptr
48 %l13 = load volatile fp128, ptr %ptr
49 %add0 = fadd fp128 %l0, %l0
50 %add1 = fadd fp128 %l1, %add0
51 %add4 = fadd fp128 %l4, %add1
52 %add5 = fadd fp128 %l5, %add4
53 %add8 = fadd fp128 %l8, %add5
54 %add9 = fadd fp128 %l9, %add8
55 %add12 = fadd fp128 %l12, %add9
56 %add13 = fadd fp128 %l13, %add12
57 store volatile fp128 %add0, ptr %ptr
58 store volatile fp128 %add1, ptr %ptr
59 store volatile fp128 %add4, ptr %ptr
60 store volatile fp128 %add5, ptr %ptr
61 store volatile fp128 %add8, ptr %ptr
62 store volatile fp128 %add9, ptr %ptr
63 store volatile fp128 %add12, ptr %ptr
64 store volatile fp128 %add13, ptr %ptr
68 ; Like f1, but requires one fewer FPR pair. We allocate in numerical order,
69 ; so %f13+%f15 is the pair that gets dropped.
70 define void @f2(ptr %ptr) {
72 ; CHECK: aghi %r15, -48
73 ; CHECK: .cfi_def_cfa_offset 208
74 ; CHECK: std %f8, 40(%r15)
75 ; CHECK: std %f9, 32(%r15)
76 ; CHECK: std %f10, 24(%r15)
77 ; CHECK: std %f11, 16(%r15)
78 ; CHECK: std %f12, 8(%r15)
79 ; CHECK: std %f14, 0(%r15)
80 ; CHECK: .cfi_offset %f8, -168
81 ; CHECK: .cfi_offset %f9, -176
82 ; CHECK: .cfi_offset %f10, -184
83 ; CHECK: .cfi_offset %f11, -192
84 ; CHECK: .cfi_offset %f12, -200
85 ; CHECK: .cfi_offset %f14, -208
88 ; ...main function body...
89 ; CHECK: ld %f8, 40(%r15)
90 ; CHECK: ld %f9, 32(%r15)
91 ; CHECK: ld %f10, 24(%r15)
92 ; CHECK: ld %f11, 16(%r15)
93 ; CHECK: ld %f12, 8(%r15)
94 ; CHECK: ld %f14, 0(%r15)
95 ; CHECK: aghi %r15, 48
97 %l0 = load volatile fp128, ptr %ptr
98 %l1 = load volatile fp128, ptr %ptr
99 %l4 = load volatile fp128, ptr %ptr
100 %l5 = load volatile fp128, ptr %ptr
101 %l8 = load volatile fp128, ptr %ptr
102 %l9 = load volatile fp128, ptr %ptr
103 %l12 = load volatile fp128, ptr %ptr
104 %add0 = fadd fp128 %l0, %l0
105 %add1 = fadd fp128 %l1, %add0
106 %add4 = fadd fp128 %l4, %add1
107 %add5 = fadd fp128 %l5, %add4
108 %add8 = fadd fp128 %l8, %add5
109 %add9 = fadd fp128 %l9, %add8
110 %add12 = fadd fp128 %l12, %add9
111 store volatile fp128 %add0, ptr %ptr
112 store volatile fp128 %add1, ptr %ptr
113 store volatile fp128 %add4, ptr %ptr
114 store volatile fp128 %add5, ptr %ptr
115 store volatile fp128 %add8, ptr %ptr
116 store volatile fp128 %add9, ptr %ptr
117 store volatile fp128 %add12, ptr %ptr
121 ; Like f1, but requires only one call-saved FPR pair. We allocate in
122 ; numerical order so the pair should be %f8+%f10.
123 define void @f3(ptr %ptr) {
125 ; CHECK: aghi %r15, -16
126 ; CHECK: .cfi_def_cfa_offset 176
127 ; CHECK: std %f8, 8(%r15)
128 ; CHECK: std %f10, 0(%r15)
129 ; CHECK: .cfi_offset %f8, -168
130 ; CHECK: .cfi_offset %f10, -176
137 ; ...main function body...
138 ; CHECK: ld %f8, 8(%r15)
139 ; CHECK: ld %f10, 0(%r15)
140 ; CHECK: aghi %r15, 16
142 %l0 = load volatile fp128, ptr %ptr
143 %l1 = load volatile fp128, ptr %ptr
144 %l4 = load volatile fp128, ptr %ptr
145 %l5 = load volatile fp128, ptr %ptr
146 %l8 = load volatile fp128, ptr %ptr
147 %add0 = fadd fp128 %l0, %l0
148 %add1 = fadd fp128 %l1, %add0
149 %add4 = fadd fp128 %l4, %add1
150 %add5 = fadd fp128 %l5, %add4
151 %add8 = fadd fp128 %l8, %add5
152 store volatile fp128 %add0, ptr %ptr
153 store volatile fp128 %add1, ptr %ptr
154 store volatile fp128 %add4, ptr %ptr
155 store volatile fp128 %add5, ptr %ptr
156 store volatile fp128 %add8, ptr %ptr
160 ; This function should use all call-clobbered FPRs but no call-saved ones.
161 ; It shouldn't need to create a frame.
162 define void @f4(ptr %ptr) {
174 %l0 = load volatile fp128, ptr %ptr
175 %l1 = load volatile fp128, ptr %ptr
176 %l4 = load volatile fp128, ptr %ptr
177 %l5 = load volatile fp128, ptr %ptr
178 %add0 = fadd fp128 %l0, %l0
179 %add1 = fadd fp128 %l1, %add0
180 %add4 = fadd fp128 %l4, %add1
181 %add5 = fadd fp128 %l5, %add4
182 store volatile fp128 %add0, ptr %ptr
183 store volatile fp128 %add1, ptr %ptr
184 store volatile fp128 %add4, ptr %ptr
185 store volatile fp128 %add5, ptr %ptr