[InstCombine] Signed saturation patterns
[llvm-complete.git] / test / CodeGen / Thumb / stack_guard_remat.ll
blob9b199ef407bed7d77234857aafd7c0a851b1e66b
1 ; RUN: llc < %s -mtriple=thumb-apple-darwin -relocation-model=pic -no-integrated-as | FileCheck %s -check-prefix=PIC
2 ; RUN: llc < %s -mtriple=thumb-apple-darwin -relocation-model=static -no-integrated-as | FileCheck %s -check-prefix=NO-PIC  -check-prefix=STATIC
3 ; RUN: llc < %s -mtriple=thumb-apple-darwin -relocation-model=dynamic-no-pic -no-integrated-as | FileCheck %s  -check-prefix=NO-PIC -check-prefix=DYNAMIC-NO-PIC
5 ;PIC:        foo2
6 ;PIC:        ldr [[SAVED_GUARD:r[0-9]+]], [[GUARD_STACK_OFFSET:LCPI[0-9_]+]]
7 ;PIC-NEXT:   add [[SAVED_GUARD]], sp
8 ;PIC-NEXT:   ldr [[SAVED_GUARD]], {{\[}}[[SAVED_GUARD]]{{\]}}
9 ;PIC-NEXT:   ldr [[ORIGINAL_GUARD:r[0-9]+]], [[ORIGINAL_GUARD_LABEL:LCPI[0-9_]+]]
10 ;PIC-NEXT: [[LABEL1:LPC[0-9_]+]]:
11 ;PIC-NEXT:   add [[ORIGINAL_GUARD]], pc
12 ;PIC-NEXT:   ldr [[ORIGINAL_GUARD]], {{\[}}[[ORIGINAL_GUARD]]{{\]}}
13 ;PIC-NEXT:   ldr [[ORIGINAL_GUARD]], {{\[}}[[ORIGINAL_GUARD]]{{\]}}
14 ;PIC-NEXT:   subs {{r[0-9]+}}, [[ORIGINAL_GUARD]], [[SAVED_GUARD]]
16 ;PIC:      [[GUARD_STACK_OFFSET]]:
17 ;PIC-NEXT:   .long 1028
18 ;PIC:      [[ORIGINAL_GUARD_LABEL]]:
19 ;PIC-NEXT:   .long L___stack_chk_guard$non_lazy_ptr-([[LABEL1]]+4)
21 ;NO-PIC:   foo2
22 ;NO-PIC:                ldr [[SAVED_GUARD:r[0-9]+]], [[GUARD_STACK_OFFSET:LCPI[0-9_]+]]
23 ;NO-PIC-NEXT:           add [[SAVED_GUARD]], sp
24 ;NO-PIC-NEXT:           ldr [[SAVED_GUARD]], {{\[}}[[SAVED_GUARD]]{{\]}}
25 ;NO-PIC-NEXT:           ldr [[ORIGINAL_GUARD:r[0-9]+]], [[ORIGINAL_GUARD_LABEL:LCPI[0-9_]+]]
26 ;NO-PIC-NOT: LPC
27 ;NO-PIC-NEXT:           ldr [[ORIGINAL_GUARD]], {{\[}}[[ORIGINAL_GUARD]]{{\]}}
28 ;DYNAMIC-NO-PIC-NEXT:   ldr [[ORIGINAL_GUARD]], {{\[}}[[ORIGINAL_GUARD]]{{\]}}
29 ;NO-PIC-NEXT:           subs {{r[0-9]+}}, [[ORIGINAL_GUARD]], [[SAVED_GUARD]]
31 ;STATIC:      [[GUARD_STACK_OFFSET]]:
32 ;STATIC-NEXT:   .long 1028
33 ;STATIC:      [[ORIGINAL_GUARD_LABEL]]:
34 ;STATIC-NEXT:   .long ___stack_chk_guard
36 ;DYNAMIC-NO-PIC:      [[GUARD_STACK_OFFSET]]:
37 ;DYNAMIC-NO-PIC-NEXT:   .long 1028
38 ;DYNAMIC-NO-PIC:      [[ORIGINAL_GUARD_LABEL]]:
39 ;DYNAMIC-NO-PIC-NEXT:   .long L___stack_chk_guard$non_lazy_ptr
41 ; Function Attrs: nounwind ssp
42 define i32 @test_stack_guard_remat() #0 {
43   %a1 = alloca [256 x i32], align 4
44   %1 = bitcast [256 x i32]* %a1 to i8*
45   call void @llvm.lifetime.start.p0i8(i64 1024, i8* %1)
46   %2 = getelementptr inbounds [256 x i32], [256 x i32]* %a1, i32 0, i32 0
47   call void @foo3(i32* %2) #3
48   call void asm sideeffect "foo2", "~{r0},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{sp},~{lr}"()
49   call void @llvm.lifetime.end.p0i8(i64 1024, i8* %1)
50   ret i32 0
53 ; Function Attrs: nounwind
54 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
56 declare void @foo3(i32*)
58 ; Function Attrs: nounwind
59 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
61 attributes #0 = { nounwind ssp "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }