40 lines · plain
1; Test support for the llvm.returnaddress intrinsic with packed-stack.2 3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s4 5; The current function's return address is in the link register.6attributes #0 = { nounwind "packed-stack" "backchain" "use-soft-float"="true" }7define ptr @rt0() #0 {8entry:9; CHECK-LABEL: rt0:10; CHECK: lgr %r2, %r1411; CHECK: br %r1412 %0 = tail call ptr @llvm.returnaddress(i32 0)13 ret ptr %014}15 16; Check the caller's return address.17define ptr @rtcaller() #0 {18entry:19; CHECK-LABEL: rtcaller:20; CHECK: lg %r1, 152(%r15)21; CHECK lg %r2, 136(%r1)22; CHECK: br %r1423 %0 = tail call ptr @llvm.returnaddress(i32 1)24 ret ptr %025}26 27; Check the caller's caller's return address.28define ptr @rtcallercaller() #0 {29entry:30; CHECK-LABEL: rtcallercaller:31; CHECK: lg %r1, 152(%r15)32; CHECK: lg %r1, 152(%r1)33; CHECK lg %r2, 136(%r1)34; CHECK: br %r1435 %0 = tail call ptr @llvm.returnaddress(i32 2)36 ret ptr %037}38 39declare ptr @llvm.returnaddress(i32) nounwind readnone40