71 lines · plain
1; Test the allocation of emergency spill slots.2;3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s4 5; For frames of size less than 4096 - 2*160, no emercengy spill slot6; 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 %r1411 %y = alloca [471 x i64], align 812 store volatile i64 %x, ptr %y13 ret void14}15 16; If the frame size is at least 4096 - 2*160, we do need the emergency17; 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 %r1422 %y = alloca [472 x i64], align 823 store volatile i64 %x, ptr %y24 ret void25}26 27; However, if there are incoming stack arguments, those also need to be28; in reach, so the maximum frame size without emergency spill slots is29; 4096 - 2*160 - <size of incoming stack arguments>. Check the maximum30; 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 %r1435 %y = alloca [470 x i64], align 836 store volatile i64 %x, ptr %y37 ret void38}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 %r1445 %y = alloca [471 x i64], align 846 store volatile i64 %x, ptr %y47 ret void48}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 %r1456 %y = alloca [469 x i64], align 857 store volatile i64 %x, ptr %y58 ret void59}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 %r1466 %y = alloca [470 x i64], align 867 store volatile i64 %x, ptr %y68 ret void69}70 71