43c62c113f87d5a020cd1e8f61c6dc23e1fc27a2
[oota-llvm.git] / test / CodeGen / X86 / stack-probe-size.ll
1 ; This test is attempting to detect that the compiler correctly generates stack
2 ; probe calls when the size of the local variables exceeds the specified stack
3 ; probe size.
4 ;
5 ; Testing the default value of 4096 bytes makes sense, because the default
6 ; stack probe size equals the page size (4096 bytes for all x86 targets), and
7 ; this is unlikely to change in the future.
8 ;
9 ; RUN: llc -mtriple=i686-windows-msvc < %s | FileCheck %s
10 ; RUN: llc -mtriple=i686-windows-coreclr < %s | FileCheck %s
11
12 target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
13
14 define i32 @test1() "stack-probe-size"="0" {
15   %buffer = alloca [4095 x i8]
16
17   ret i32 0
18
19 ; CHECK-LABEL: _test1:
20 ; CHECK-NOT: subl $4095, %esp
21 ; CHECK: movl $4095, %eax
22 ; CHECK: calll __chkstk
23 }
24
25 define i32 @test2() {
26   %buffer = alloca [4095 x i8]
27
28   ret i32 0
29
30 ; CHECK-LABEL: _test2:
31 ; CHECK-NOT: movl $4095, %eax
32 ; CHECK: subl $4095, %esp
33 ; CHECK-NOT: calll __chkstk
34 }
35
36 define i32 @test3() "stack-probe-size"="8192" {
37   %buffer = alloca [4095 x i8]
38
39   ret i32 0
40
41 ; CHECK-LABEL: _test3:
42 ; CHECK-NOT: movl $4095, %eax
43 ; CHECK: subl $4095, %esp
44 ; CHECK-NOT: calll __chkstk
45 }
46
47 define i32 @test4() "stack-probe-size"="0" {
48   %buffer = alloca [4096 x i8]
49
50   ret i32 0
51
52 ; CHECK-LABEL: _test4:
53 ; CHECK-NOT: subl $4096, %esp
54 ; CHECK: movl $4096, %eax
55 ; CHECK: calll __chkstk
56 }
57
58 define i32 @test5() {
59   %buffer = alloca [4096 x i8]
60
61   ret i32 0
62
63 ; CHECK-LABEL: _test5:
64 ; CHECK-NOT: subl $4096, %esp
65 ; CHECK: movl $4096, %eax
66 ; CHECK: calll __chkstk
67 }
68
69 define i32 @test6() "stack-probe-size"="8192" {
70   %buffer = alloca [4096 x i8]
71
72   ret i32 0
73
74 ; CGECK-LABEL: _test6:
75 ; CGECK-NOT: movl $4096, %eax
76 ; CGECK: subl $4096, %esp
77 ; CGECK-NOT: calll __chkstk
78 }