1 ; Test support for the llvm.returnaddress intrinsic with packed-stack.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; The current function's return address is in the link register.
6 attributes #0 = { nounwind "packed-stack" "backchain" "use-soft-float"="true" }
10 ; CHECK: lgr %r2, %r14
12 %0 = tail call ptr @llvm.returnaddress(i32 0)
16 ; Check the caller's return address.
17 define ptr @rtcaller() #0 {
19 ; CHECK-LABEL: rtcaller:
20 ; CHECK: lg %r1, 152(%r15)
21 ; CHECK lg %r2, 136(%r1)
23 %0 = tail call ptr @llvm.returnaddress(i32 1)
27 ; Check the caller's caller's return address.
28 define ptr @rtcallercaller() #0 {
30 ; CHECK-LABEL: rtcallercaller:
31 ; CHECK: lg %r1, 152(%r15)
32 ; CHECK: lg %r1, 152(%r1)
33 ; CHECK lg %r2, 136(%r1)
35 %0 = tail call ptr @llvm.returnaddress(i32 2)
39 declare ptr @llvm.returnaddress(i32) nounwind readnone