xref: /aosp_15_r20/external/llvm/test/CodeGen/Thumb2/2011-04-21-FILoweringBug.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=thumbv7-apple-darwin | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; Use sp, #imm to lower frame indices when the offset is multiple of 4
4*9880d681SAndroid Build Coastguard Worker; and in the range of 0-1020. This saves code size by utilizing
5*9880d681SAndroid Build Coastguard Worker; 16-bit instructions.
6*9880d681SAndroid Build Coastguard Worker; rdar://9321541
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Workerdefine i32 @t() nounwind {
9*9880d681SAndroid Build Coastguard Workerentry:
10*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: t:
11*9880d681SAndroid Build Coastguard Worker; CHECK: sub sp, #12
12*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: sub
13*9880d681SAndroid Build Coastguard Worker; CHECK: add r0, sp, #4
14*9880d681SAndroid Build Coastguard Worker; CHECK: add r1, sp, #8
15*9880d681SAndroid Build Coastguard Worker; CHECK: mov r2, sp
16*9880d681SAndroid Build Coastguard Worker  %size = alloca i32, align 4
17*9880d681SAndroid Build Coastguard Worker  %count = alloca i32, align 4
18*9880d681SAndroid Build Coastguard Worker  %index = alloca i32, align 4
19*9880d681SAndroid Build Coastguard Worker  %0 = call i32 @foo(i32* %count, i32* %size, i32* %index) nounwind
20*9880d681SAndroid Build Coastguard Worker  ret i32 %0
21*9880d681SAndroid Build Coastguard Worker}
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Workerdeclare i32 @foo(i32*, i32*, i32*)
24