1 ; Test the allocation of emergency spill slots.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; For frames of size less than 4096 - 2*160, no emercengy spill slot
6 ; is required. Check the maximum such case.
7 define void @f1(i64 %x) {
9 ; CHECK: stg %r2, 160(%r15)
11 %y = alloca [471 x i64], align 8
12 %ptr = getelementptr inbounds [471 x i64], [471 x i64]* %y, i64 0, i64 0
13 store volatile i64 %x, i64* %ptr
17 ; If the frame size is at least 4096 - 2*160, we do need the emergency
18 ; spill slots. Check the minimum such case.
19 define void @f2(i64 %x) {
21 ; CHECK: stg %r2, 176(%r15)
23 %y = alloca [472 x i64], align 8
24 %ptr = getelementptr inbounds [472 x i64], [472 x i64]* %y, i64 0, i64 0
25 store volatile i64 %x, i64* %ptr
29 ; However, if there are incoming stack arguments, those also need to be
30 ; in reach, so the maximum frame size without emergency spill slots is
31 ; 4096 - 2*160 - <size of incoming stack arguments>. Check the maximum
32 ; case where we still need no emergency spill slots ...
33 define void @f3(i64 %x, i64 %r3, i64 %r4, i64 %r5, i64 %r6, i64 %stack) {
35 ; CHECK: stg %r2, 160(%r15)
37 %y = alloca [470 x i64], align 8
38 %ptr = getelementptr inbounds [470 x i64], [470 x i64]* %y, i64 0, i64 0
39 store volatile i64 %x, i64* %ptr
43 ; ... and the minimum case where we do.
44 define void @f4(i64 %x, i64 %r3, i64 %r4, i64 %r5, i64 %r6, i64 %stack) {
46 ; CHECK: stg %r2, 176(%r15)
48 %y = alloca [471 x i64], align 8
49 %ptr = getelementptr inbounds [471 x i64], [471 x i64]* %y, i64 0, i64 0
50 store volatile i64 %x, i64* %ptr
54 ; Try again for the case of two stack arguments.
55 ; Check the maximum case where we still need no emergency spill slots ...
56 define void @f5(i64 %x, i64 %r3, i64 %r4, i64 %r5, i64 %r6, i64 %stack1, i64 %stack2) {
58 ; CHECK: stg %r2, 160(%r15)
60 %y = alloca [469 x i64], align 8
61 %ptr = getelementptr inbounds [469 x i64], [469 x i64]* %y, i64 0, i64 0
62 store volatile i64 %x, i64* %ptr
66 ; ... and the minimum case where we do.
67 define void @f6(i64 %x, i64 %r3, i64 %r4, i64 %r5, i64 %r6, i64 %stack1, i64 %stack2) {
69 ; CHECK: stg %r2, 176(%r15)
71 %y = alloca [470 x i64], align 8
72 %ptr = getelementptr inbounds [470 x i64], [470 x i64]* %y, i64 0, i64 0
73 store volatile i64 %x, i64* %ptr