1; RUN: llc -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck --check-prefix=X86-LINUX %s
2; RUN: llc -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck --check-prefix=X64-LINUX %s
3; RUN: llc -mtriple=x86_64-pc-linux-gnu -code-model=large < %s -o - | FileCheck --check-prefix=X64-LINUX-LARGE %s
4
5declare void @use([40096 x i8]*)
6
7; Ensure calls to __probestack occur for large stack frames
8define void @test() "probe-stack"="__probestack" {
9  %array = alloca [40096 x i8], align 16
10  call void @use([40096 x i8]* %array)
11  ret void
12
13; X86-LINUX-LABEL:       test:
14; X86-LINUX:             movl $40124, %eax # imm = 0x9CBC
15; X86-LINUX-NEXT:        calll __probestack
16; X86-LINUX-NEXT:        subl %eax, %esp
17
18; X64-LINUX-LABEL:       test:
19; X64-LINUX:             movl $40104, %eax # imm = 0x9CA8
20; X64-LINUX-NEXT:        callq __probestack
21; X64-LINUX-NEXT:        subq %rax, %rsp
22
23; X64-LINUX-LARGE-LABEL: test:
24; X64-LINUX-LARGE:       movl $40104, %eax # imm = 0x9CA8
25; X64-LINUX-LARGE-NEXT:  movabsq $__probestack, %r11
26; X64-LINUX-LARGE-NEXT:  callq *%r11
27; X64-LINUX-LARGE-NEXT:  subq %rax, %rsp
28
29}
30