1 ; RUN: llc < %s -mcpu=generic -mtriple=i686-linux -verify-machineinstrs | FileCheck %s -check-prefix=X32
2 ; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux -verify-machineinstrs | FileCheck %s -check-prefix=X64
3 ; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux-gnux32 -verify-machineinstrs | FileCheck %s -check-prefix=X32ABI
4 ; RUN: llc < %s -mcpu=generic -mtriple=i686-linux -filetype=obj
5 ; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux -filetype=obj
6 ; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux-gnux32 -filetype=obj
8 ; Just to prevent the alloca from being optimized away
9 declare void @dummy_use(i32*, i32)
11 define i32 @test_basic(i32 %l) #0 {
12 %mem = alloca i32, i32 %l
13 call void @dummy_use (i32* %mem, i32 %l)
14 %terminate = icmp eq i32 %l, 0
15 br i1 %terminate, label %true, label %false
21 %newlen = sub i32 %l, 1
22 %retvalue = call i32 @test_basic(i32 %newlen)
25 ; X32-LABEL: test_basic:
27 ; X32: cmpl %gs:48, %esp
28 ; X32-NEXT: jbe .LBB0_1
30 ; X32: movl %esp, %eax
31 ; X32: subl %ecx, %eax
32 ; X32-NEXT: cmpl %eax, %gs:48
34 ; X32: movl %eax, %esp
37 ; X32-NEXT: pushl %ecx
38 ; X32-NEXT: calll __morestack_allocate_stack_space
39 ; X32-NEXT: addl $16, %esp
43 ; X32-NEXT: calll __morestack
46 ; X64-LABEL: test_basic:
48 ; X64: cmpq %fs:112, %rsp
49 ; X64-NEXT: jbe .LBB0_1
51 ; X64: movq %rsp, %[[RDI:rdi|rax]]
52 ; X64: subq %{{.*}}, %[[RDI]]
53 ; X64-NEXT: cmpq %[[RDI]], %fs:112
55 ; X64: movq %[[RDI]], %rsp
57 ; X64: movq %{{.*}}, %rdi
58 ; X64-NEXT: callq __morestack_allocate_stack_space
59 ; X64: movq %rax, %rdi
61 ; X64: movabsq $24, %r10
62 ; X64-NEXT: movabsq $0, %r11
63 ; X64-NEXT: callq __morestack
66 ; X32ABI-LABEL: test_basic:
68 ; X32ABI: cmpl %fs:64, %esp
69 ; X32ABI-NEXT: jbe .LBB0_1
71 ; X32ABI: movl %esp, %[[EDI:edi|eax]]
72 ; X32ABI: subl %{{.*}}, %[[EDI]]
73 ; X32ABI-NEXT: cmpl %[[EDI]], %fs:64
75 ; X32ABI: movl %[[EDI]], %esp
77 ; X32ABI: movl %{{.*}}, %edi
78 ; X32ABI-NEXT: callq __morestack_allocate_stack_space
79 ; X32ABI: movl %eax, %edi
81 ; X32ABI: movl $24, %r10d
82 ; X32ABI-NEXT: movl $0, %r11d
83 ; X32ABI-NEXT: callq __morestack
88 attributes #0 = { "split-stack" }