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 ; CHECK: subs r4, r7, #7
39 %tmp = alloca [ 1524 x i8 ] , align 4
43 ; Smallest stack for which we use a constant pool
44 define void @test2() {
46 ; CHECK: ldr [[TEMP:r[0-7]]],
47 ; CHECK: add sp, [[TEMP]]
48 ; CHECK: ldr [[TEMP:r[0-7]]],
49 ; CHECK: add sp, [[TEMP]]
50 %tmp = alloca [ 1528 x i8 ] , align 4
54 ; Smallest stack for which we use a constant pool
55 define void @test2_nofpelim() "no-frame-pointer-elim"="true" {
56 ; CHECK-LABEL: test2_nofpelim:
57 ; CHECK: ldr [[TEMP:r[0-7]]],
58 ; CHECK: add sp, [[TEMP]]
59 ; CHECK: subs r4, r7, #7
62 %tmp = alloca [ 1528 x i8 ] , align 4
68 ; CHECK: ldr [[TEMP:r[0-7]]],
69 ; CHECK: add sp, [[TEMP]]
70 ; CHECK: ldr [[TEMP2:r[0-7]]],
71 ; CHECK: add [[TEMP2]], sp
72 ; CHECK: ldr [[TEMP3:r[0-7]]],
73 ; CHECK: add sp, [[TEMP3]]
74 %retval = alloca i32, align 4
75 %tmp = alloca i32, align 4
76 %a = alloca [805306369 x i8], align 4
77 store i32 0, i32* %tmp
78 %tmp1 = load i32, i32* %tmp
82 define i32 @test3_nofpelim() "no-frame-pointer-elim"="true" {
83 ; CHECK-LABEL: test3_nofpelim:
84 ; CHECK: ldr [[TEMP:r[0-7]]],
85 ; CHECK: add sp, [[TEMP]]
86 ; CHECK: ldr [[TEMP2:r[0-7]]],
87 ; CHECK: add [[TEMP2]], sp
90 %retval = alloca i32, align 4
91 %tmp = alloca i32, align 4
92 %a = alloca [805306369 x i8], align 8
93 store i32 0, i32* %tmp
94 %tmp1 = load i32, i32* %tmp
98 ; Here, the adds get optimized out because they are dead, but the calculation
99 ; of the address of stack_a is dead but not optimized out. When the address
100 ; calculation gets expanded to two instructions, we need to avoid reading a
102 ; No CHECK lines (just test for crashes), as we hope this will be optimised
104 define i32 @test4() {
106 %stack_a = alloca i8, align 1
107 %stack_b = alloca [256 x i32*], align 4
108 %int = ptrtoint i8* %stack_a to i32
109 %add = add i32 %int, 1
113 %add2 = add i32 %add, 1