1 ; RUN: llc < %s -mtriple=thumb-apple-ios | FileCheck %s --check-prefix=CHECK --check-prefix=ALIGN4
2 ; RUN: llc < %s -mtriple=thumb-none-eabi | FileCheck %s --check-prefix=CHECK --check-prefix=ALIGN8
3 ; RUN: llc < %s -o %t -filetype=obj -mtriple=thumbv6-apple-ios
4 ; RUN: llvm-objdump -triple=thumbv6-apple-ios -d %t | FileCheck %s --check-prefix=CHECK --check-prefix=ALIGN4
5 ; RUN: llc < %s -o %t -filetype=obj -mtriple=thumbv6-none-eabi
6 ; RUN: llvm-objdump -triple=thumbv6-none-eabi -d %t | FileCheck %s --check-prefix=CHECK --check-prefix=ALIGN8
8 ; Largest stack for which a single tADDspi/tSUBspi is enough
13 %tmp = alloca [ 508 x i8 ] , align 4
17 ; Largest stack for which three tADDspi/tSUBspis are enough
18 define void @test100() {
19 ; CHECK-LABEL: test100:
26 %tmp = alloca [ 1524 x i8 ] , align 4
30 ; Largest stack for which three tADDspi/tSUBspis are enough
31 define void @test100_nofpelim() "no-frame-pointer-elim"="true" {
32 ; CHECK-LABEL: test100_nofpelim:
36 ; ALIGN4: subs r4, r7, #4
37 ; ALIGN8: subs r4, r7, #7
40 %tmp = alloca [ 1524 x i8 ] , align 4
44 ; Smallest stack for which we use a constant pool
45 define void @test2() {
47 ; CHECK: ldr [[TEMP:r[0-7]]],
48 ; CHECK: add sp, [[TEMP]]
49 ; CHECK: ldr [[TEMP:r[0-7]]],
50 ; CHECK: add sp, [[TEMP]]
51 %tmp = alloca [ 1528 x i8 ] , align 4
55 ; Smallest stack for which we use a constant pool
56 define void @test2_nofpelim() "no-frame-pointer-elim"="true" {
57 ; CHECK-LABEL: test2_nofpelim:
58 ; CHECK: ldr [[TEMP:r[0-7]]],
59 ; CHECK: add sp, [[TEMP]]
60 ; ALIGN4: subs r4, r7, #4
61 ; ALIGN8: subs r4, r7, #7
64 %tmp = alloca [ 1528 x i8 ] , align 4
70 ; CHECK: ldr [[TEMP:r[0-7]]],
71 ; CHECK: add sp, [[TEMP]]
72 ; CHECK: ldr [[TEMP2:r[0-7]]],
73 ; CHECK: add [[TEMP2]], sp
74 ; CHECK: ldr [[TEMP3:r[0-7]]],
75 ; CHECK: add sp, [[TEMP3]]
76 %retval = alloca i32, align 4
77 %tmp = alloca i32, align 4
78 %a = alloca [805306369 x i8], align 4
79 store i32 0, i32* %tmp
80 %tmp1 = load i32, i32* %tmp
84 define i32 @test3_nofpelim() "no-frame-pointer-elim"="true" {
85 ; CHECK-LABEL: test3_nofpelim:
86 ; CHECK: ldr [[TEMP:r[0-7]]],
87 ; CHECK: add sp, [[TEMP]]
88 ; CHECK: ldr [[TEMP2:r[0-7]]],
89 ; CHECK: add [[TEMP2]], sp
92 %retval = alloca i32, align 4
93 %tmp = alloca i32, align 4
94 %a = alloca [805306369 x i8], align 8
95 store i32 0, i32* %tmp
96 %tmp1 = load i32, i32* %tmp
100 ; Here, the adds get optimized out because they are dead, but the calculation
101 ; of the address of stack_a is dead but not optimized out. When the address
102 ; calculation gets expanded to two instructions, we need to avoid reading a
104 ; No CHECK lines (just test for crashes), as we hope this will be optimised
106 define i32 @test4() {
108 %stack_a = alloca i8, align 1
109 %stack_b = alloca [256 x i32*], align 4
110 %int = ptrtoint i8* %stack_a to i32
111 %add = add i32 %int, 1
115 %add2 = add i32 %add, 1