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: ja .LBB0_2
32 ; X32-NEXT: calll __morestack
35 ; X32: movl %esp, %eax
36 ; X32: subl %ecx, %eax
37 ; X32-NEXT: cmpl %eax, %gs:48
39 ; X32: movl %eax, %esp
42 ; X32-NEXT: pushl %ecx
43 ; X32-NEXT: calll __morestack_allocate_stack_space
44 ; X32-NEXT: addl $16, %esp
46 ; X64-LABEL: test_basic:
48 ; X64: cmpq %fs:112, %rsp
49 ; X64-NEXT: ja .LBB0_2
51 ; X64: movabsq $24, %r10
52 ; X64-NEXT: movabsq $0, %r11
53 ; X64-NEXT: callq __morestack
56 ; X64: movq %rsp, %[[RDI:rdi|rax]]
57 ; X64: subq %{{.*}}, %[[RDI]]
58 ; X64-NEXT: cmpq %[[RDI]], %fs:112
60 ; X64: movq %[[RDI]], %rsp
62 ; X64: movq %{{.*}}, %rdi
63 ; X64-NEXT: callq __morestack_allocate_stack_space
64 ; X64: movq %rax, %rdi
66 ; X32ABI-LABEL: test_basic:
68 ; X32ABI: cmpl %fs:64, %esp
69 ; X32ABI-NEXT: ja .LBB0_2
71 ; X32ABI: movl $24, %r10d
72 ; X32ABI-NEXT: movl $0, %r11d
73 ; X32ABI-NEXT: callq __morestack
76 ; X32ABI: movl %esp, %[[EDI:edi|eax]]
77 ; X32ABI: subl %{{.*}}, %[[EDI]]
78 ; X32ABI-NEXT: cmpl %[[EDI]], %fs:64
80 ; X32ABI: movl %[[EDI]], %esp
82 ; X32ABI: movl %{{.*}}, %edi
83 ; X32ABI-NEXT: callq __morestack_allocate_stack_space
84 ; X32ABI: movl %eax, %edi
88 attributes #0 = { "split-stack" }