1; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 2 3; The current function's frame address is the address of 4; the optional back chain slot. 5define ptr @fp0() nounwind { 6entry: 7; CHECK-LABEL: fp0: 8; CHECK: la %r2, 0(%r15) 9; CHECK: br %r14 10 %0 = tail call ptr @llvm.frameaddress(i32 0) 11 ret ptr %0 12} 13 14; Check that the frame address is correct in a presence 15; of a stack frame. 16define ptr @fp0f() nounwind { 17entry: 18; CHECK-LABEL: fp0f: 19; CHECK: aghi %r15, -168 20; CHECK: la %r2, 168(%r15) 21; CHECK: aghi %r15, 168 22; CHECK: br %r14 23 %0 = alloca i64, align 8 24 %1 = tail call ptr @llvm.frameaddress(i32 0) 25 ret ptr %1 26} 27 28; Check the caller's frame address. 29define ptr @fpcaller() nounwind "backchain" { 30entry: 31; CHECK-LABEL: fpcaller: 32; CHECK: lg %r2, 0(%r15) 33; CHECK: br %r14 34 %0 = tail call ptr @llvm.frameaddress(i32 1) 35 ret ptr %0 36} 37 38; Check the caller's frame address. 39define ptr @fpcallercaller() nounwind "backchain" { 40entry: 41; CHECK-LABEL: fpcallercaller: 42; CHECK: lg %r1, 0(%r15) 43; CHECK: lg %r2, 0(%r1) 44; CHECK: br %r14 45 %0 = tail call ptr @llvm.frameaddress(i32 2) 46 ret ptr %0 47} 48 49declare ptr @llvm.frameaddress(i32) nounwind readnone 50