xref: /aosp_15_r20/external/llvm/test/CodeGen/SystemZ/frame-11.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; Test the stackrestore builtin.
2*9880d681SAndroid Build Coastguard Worker;
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerdeclare i8 *@llvm.stacksave()
6*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.stackrestore(i8 *)
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; we should use a frame pointer and tear down the frame based on %r11
9*9880d681SAndroid Build Coastguard Worker; rather than %r15.
10*9880d681SAndroid Build Coastguard Workerdefine void @f1(i32 %count1, i32 %count2) {
11*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1:
12*9880d681SAndroid Build Coastguard Worker; CHECK: stmg %r11, %r15, 88(%r15)
13*9880d681SAndroid Build Coastguard Worker; CHECK: aghi %r15, -160
14*9880d681SAndroid Build Coastguard Worker; CHECK: lgr %r11, %r15
15*9880d681SAndroid Build Coastguard Worker; CHECK: lgr %r15, %r{{[0-5]}}
16*9880d681SAndroid Build Coastguard Worker; CHECK: lmg %r11, %r15, 248(%r11)
17*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
18*9880d681SAndroid Build Coastguard Worker  %src = call i8 *@llvm.stacksave()
19*9880d681SAndroid Build Coastguard Worker  %array1 = alloca i8, i32 %count1
20*9880d681SAndroid Build Coastguard Worker  store volatile i8 0, i8 *%array1
21*9880d681SAndroid Build Coastguard Worker  call void @llvm.stackrestore(i8 *%src)
22*9880d681SAndroid Build Coastguard Worker  %array2 = alloca i8, i32 %count2
23*9880d681SAndroid Build Coastguard Worker  store volatile i8 0, i8 *%array2
24*9880d681SAndroid Build Coastguard Worker  ret void
25*9880d681SAndroid Build Coastguard Worker}
26