[WinEH] Add some test cases I forgot to add to previous commits
[oota-llvm.git] / test / CodeGen / AArch64 / stack_guard_remat.ll
1 ; RUN: llc < %s -mtriple=arm64-apple-ios -relocation-model=pic -no-integrated-as | FileCheck %s -check-prefix=DARWIN
2 ; RUN: llc < %s -mtriple=arm64-apple-ios -relocation-model=static -no-integrated-as | FileCheck %s -check-prefix=DARWIN
3 ; RUN: llc < %s -mtriple=aarch64-linux-gnu -relocation-model=pic -no-integrated-as | FileCheck %s -check-prefix=PIC-LINUX
4 ; RUN: llc < %s -mtriple=aarch64-linux-gnu -relocation-model=static -code-model=large -no-integrated-as | FileCheck %s -check-prefix=STATIC-LARGE
5 ; RUN: llc < %s -mtriple=aarch64-linux-gnu -relocation-model=static -code-model=small -no-integrated-as | FileCheck %s -check-prefix=STATIC-SMALL
6
7 ; DARWIN: foo2
8 ; DARWIN: adrp [[R0:x[0-9]+]], ___stack_chk_guard@GOTPAGE
9 ; DARWIN: ldr [[R1:x[0-9]+]], {{\[}}[[R0]], ___stack_chk_guard@GOTPAGEOFF{{\]}}
10 ; DARWIN: ldr {{x[0-9]+}}, {{\[}}[[R1]]{{\]}}
11
12 ; PIC-LINUX: foo2
13 ; PIC-LINUX: adrp [[R0:x[0-9]+]], :got:__stack_chk_guard
14 ; PIC-LINUX: ldr [[R1:x[0-9]+]], {{\[}}[[R0]], :got_lo12:__stack_chk_guard{{\]}}
15 ; PIC-LINUX: ldr {{x[0-9]+}}, {{\[}}[[R1]]{{\]}}
16
17 ; STATIC-LARGE: foo2
18 ; STATIC-LARGE: movz [[R0:x[0-9]+]], #:abs_g3:__stack_chk_guard
19 ; STATIC-LARGE: movk [[R0]], #:abs_g2_nc:__stack_chk_guard
20 ; STATIC-LARGE: movk [[R0]], #:abs_g1_nc:__stack_chk_guard
21 ; STATIC-LARGE: movk [[R0]], #:abs_g0_nc:__stack_chk_guard
22 ; STATIC-LARGE: ldr {{x[0-9]+}}, {{\[}}[[R0]]{{\]}}
23
24 ; STATIC-SMALL: foo2
25 ; STATIC-SMALL: adrp [[R0:x[0-9]+]], __stack_chk_guard
26 ; STATIC-SMALL: ldr {{x[0-9]+}}, {{\[}}[[R0]], :lo12:__stack_chk_guard{{\]}}
27
28 define i32 @test_stack_guard_remat() #0 {
29 entry:
30   %a1 = alloca [256 x i32], align 4
31   %0 = bitcast [256 x i32]* %a1 to i8*
32   call void @llvm.lifetime.start(i64 1024, i8* %0)
33   %arraydecay = getelementptr inbounds [256 x i32], [256 x i32]* %a1, i64 0, i64 0
34   call void @foo3(i32* %arraydecay)
35   call void asm sideeffect "foo2", "~{w0},~{w1},~{w2},~{w3},~{w4},~{w5},~{w6},~{w7},~{w8},~{w9},~{w10},~{w11},~{w12},~{w13},~{w14},~{w15},~{w16},~{w17},~{w18},~{w19},~{w20},~{w21},~{w22},~{w23},~{w24},~{w25},~{w26},~{w27},~{w28},~{w29},~{w30}"()
36   call void @llvm.lifetime.end(i64 1024, i8* %0)
37   ret i32 0
38 }
39
40 ; Function Attrs: nounwind
41 declare void @llvm.lifetime.start(i64, i8* nocapture)
42
43 declare void @foo3(i32*)
44
45 ; Function Attrs: nounwind
46 declare void @llvm.lifetime.end(i64, i8* nocapture)
47
48 attributes #0 = { nounwind sspstrong "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" }