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