• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
2
3; Test lowering of @llvm.frameaddress with packed-stack.
4
5; With back chain
6attributes #0 = { nounwind "packed-stack" "backchain" "use-soft-float"="true" }
7define i8* @fp0() #0 {
8entry:
9; CHECK-LABEL: fp0:
10; CHECK:      la   %r2, 152(%r15)
11; CHECK-NEXT: br   %r14
12  %0 = tail call i8* @llvm.frameaddress(i32 0)
13  ret i8* %0
14}
15
16define i8* @fp0f() #0 {
17entry:
18; CHECK-LABEL: fp0f:
19; CHECK:      lgr	%r1, %r15
20; CHECK-NEXT: aghi	%r15, -16
21; CHECK-NEXT: stg	%r1, 152(%r15)
22; CHECK-NEXT: la	%r2, 168(%r15)
23; CHECK-NEXT: aghi	%r15, 16
24; CHECK-NEXT: br	%r14
25  %0 = alloca i64, align 8
26  %1 = tail call i8* @llvm.frameaddress(i32 0)
27  ret i8* %1
28}
29
30; Without back chain
31
32attributes #1 = { nounwind "packed-stack" }
33define i8* @fp1() #1 {
34entry:
35; CHECK-LABEL: fp1:
36; CHECK:      lghi %r2, 0
37; CHECK-NEXT: br   %r14
38  %0 = tail call i8* @llvm.frameaddress(i32 0)
39  ret i8* %0
40}
41
42define i8* @fp1f() #1 {
43entry:
44; CHECK-LABEL: fp1f:
45; CHECK:      aghi	%r15, -8
46; CHECK-NEXT: lghi	%r2, 0
47; CHECK-NEXT: aghi	%r15, 8
48; CHECK-NEXT: br	%r14
49  %0 = alloca i64, align 8
50  %1 = tail call i8* @llvm.frameaddress(i32 0)
51  ret i8* %1
52}
53
54declare i8* @llvm.frameaddress(i32) nounwind readnone
55