xref: /aosp_15_r20/external/llvm/test/CodeGen/AArch64/arm64-big-stack.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Workertarget triple = "arm64-apple-macosx10"
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; Check that big stacks are generated correctly.
5*9880d681SAndroid Build Coastguard Worker; Currently, this is done by a sequence of sub instructions,
6*9880d681SAndroid Build Coastguard Worker; which can encode immediate with a 12 bits mask an optionally
7*9880d681SAndroid Build Coastguard Worker; shift left (up to 12). I.e., 16773120 is the biggest value.
8*9880d681SAndroid Build Coastguard Worker; <rdar://12513931>
9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: foo:
10*9880d681SAndroid Build Coastguard Worker; CHECK: sub sp, sp, #4095, lsl #12
11*9880d681SAndroid Build Coastguard Worker; CHECK: sub sp, sp, #4095, lsl #12
12*9880d681SAndroid Build Coastguard Worker; CHECK: sub sp, sp, #2, lsl #12
13*9880d681SAndroid Build Coastguard Workerdefine void @foo() nounwind ssp {
14*9880d681SAndroid Build Coastguard Workerentry:
15*9880d681SAndroid Build Coastguard Worker  %buffer = alloca [33554432 x i8], align 1
16*9880d681SAndroid Build Coastguard Worker  %arraydecay = getelementptr inbounds [33554432 x i8], [33554432 x i8]* %buffer, i64 0, i64 0
17*9880d681SAndroid Build Coastguard Worker  call void @doit(i8* %arraydecay) nounwind
18*9880d681SAndroid Build Coastguard Worker  ret void
19*9880d681SAndroid Build Coastguard Worker}
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Workerdeclare void @doit(i8*)
22