1 ; Test support for the llvm.returnaddress intrinsic.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; The current function's return address is in the link register.
6 define ptr @rt0() norecurse nounwind readnone {
11 %0 = tail call ptr @llvm.returnaddress(i32 0)
15 ; Check the caller's return address.
16 define ptr @rtcaller() nounwind "backchain" {
18 ; CHECK-LABEL: rtcaller:
19 ; CHECK: lg %r1, 0(%r15)
20 ; CHECK lg %r2, 112(%r1)
22 %0 = tail call ptr @llvm.returnaddress(i32 1)
26 ; Check the caller's caller's return address.
27 define ptr @rtcallercaller() nounwind "backchain" {
29 ; CHECK-LABEL: rtcallercaller:
30 ; CHECK: lg %r1, 0(%r15)
31 ; CHECK: lg %r1, 0(%r1)
32 ; CHECK lg %r2, 112(%r1)
34 %0 = tail call ptr @llvm.returnaddress(i32 2)
38 declare ptr @llvm.returnaddress(i32) nounwind readnone