1; RUN: llc < %s | FileCheck %s
2
3
4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5target triple = "x86_64-unknown-linux-gnu"
6
7define i32 @foo_noprotect() local_unnamed_addr {
8; CHECK-LABEL: foo_noprotect:
9; CHECK:       # %bb.0:
10; CHECK-NEXT:	pushq	%rbp
11; CHECK-NEXT:   .cfi_def_cfa_offset 16
12; CHECK-NEXT:   .cfi_offset %rbp, -16
13; CHECK-NEXT:   movq	%rsp, %rbp
14; CHECK-NEXT:   .cfi_def_cfa_register %rbp
15; CHECK-NEXT:   andq	$-4096, %rsp                    # imm = 0xF000
16; CHECK-NEXT:   subq	$73728, %rsp                    # imm = 0x12000
17; CHECK-NEXT:   movl	$1, 392(%rsp)
18; CHECK-NEXT:   movl	$1, 28792(%rsp)
19; CHECK-NEXT:   movl	(%rsp), %eax
20; CHECK-NEXT:   movq	%rbp, %rsp
21; CHECK-NEXT:   popq	%rbp
22; CHECK-NEXT:   .cfi_def_cfa %rsp, 8
23; CHECK-NEXT:   retq
24
25
26  %a = alloca i32, i64 18000, align 4096
27  %b0 = getelementptr inbounds i32, i32* %a, i64 98
28  %b1 = getelementptr inbounds i32, i32* %a, i64 7198
29  store volatile i32 1, i32* %b0
30  store volatile i32 1, i32* %b1
31  %c = load volatile i32, i32* %a
32  ret i32 %c
33}
34
35define i32 @foo_protect() local_unnamed_addr #0 {
36; CHECK-LABEL: foo_protect:
37; CHECK:       # %bb.0:
38; CHECK-NEXT:	pushq	%rbp
39; CHECK-NEXT:	.cfi_def_cfa_offset 16
40; CHECK-NEXT:	.cfi_offset %rbp, -16
41; CHECK-NEXT:	movq	%rsp, %rbp
42; CHECK-NEXT:	.cfi_def_cfa_register %rbp
43; CHECK-NEXT:	movq	%rsp, %r11
44; CHECK-NEXT:	andq	$-4096, %r11                    # imm = 0xF000
45; CHECK-NEXT:	cmpq	%rsp, %r11
46; CHECK-NEXT:	je	.LBB1_4
47; CHECK-NEXT:# %bb.1:
48; CHECK-NEXT:	subq	$4096, %rsp                     # imm = 0x1000
49; CHECK-NEXT:	cmpq	%rsp, %r11
50; CHECK-NEXT:	jb	.LBB1_3
51; CHECK-NEXT:.LBB1_2:                                # =>This Inner Loop Header: Depth=1
52; CHECK-NEXT:	movq	$0, (%rsp)
53; CHECK-NEXT:	subq	$4096, %rsp                     # imm = 0x1000
54; CHECK-NEXT:	cmpq	%rsp, %r11
55; CHECK-NEXT:	jb	.LBB1_2
56; CHECK-NEXT:.LBB1_3:
57; CHECK-NEXT:	movq	%r11, %rsp
58; CHECK-NEXT:	movq	$0, (%rsp)
59; CHECK-NEXT:.LBB1_4:
60; CHECK-NEXT:	movq	%rsp, %r11
61; CHECK-NEXT:	subq	$73728, %r11                    # imm = 0x12000
62; CHECK-NEXT:.LBB1_5:                                # =>This Inner Loop Header: Depth=1
63; CHECK-NEXT:	subq	$4096, %rsp                     # imm = 0x1000
64; CHECK-NEXT:	movq	$0, (%rsp)
65; CHECK-NEXT:	cmpq	%r11, %rsp
66; CHECK-NEXT:	jne	.LBB1_5
67; CHECK-NEXT:# %bb.6:
68; CHECK-NEXT:	movl	$1, 392(%rsp)
69; CHECK-NEXT:	movl	$1, 28792(%rsp)
70; CHECK-NEXT:	movl	(%rsp), %eax
71; CHECK-NEXT:	movq	%rbp, %rsp
72; CHECK-NEXT:	popq	%rbp
73; CHECK-NEXT:	.cfi_def_cfa %rsp, 8
74; CHECK-NEXT:	retq
75
76
77
78
79  %a = alloca i32, i64 18000, align 4096
80  %b0 = getelementptr inbounds i32, i32* %a, i64 98
81  %b1 = getelementptr inbounds i32, i32* %a, i64 7198
82  store volatile i32 1, i32* %b0
83  store volatile i32 1, i32* %b1
84  %c = load volatile i32, i32* %a
85  ret i32 %c
86}
87
88attributes #0 =  {"probe-stack"="inline-asm"}
89