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 i8* @fp0() nounwind {
6entry:
7; CHECK-LABEL: fp0:
8; CHECK: la   %r2, 0(%r15)
9; CHECK: br   %r14
10  %0 = tail call i8* @llvm.frameaddress(i32 0)
11  ret i8* %0
12}
13
14; Check that the frame address is correct in a presence
15; of a stack frame.
16define i8* @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 i8* @llvm.frameaddress(i32 0)
25  ret i8* %1
26}
27
28declare i8* @llvm.frameaddress(i32) nounwind readnone
29