• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mcpu=generic -mtriple=i686-linux -verify-machineinstrs | FileCheck %s -check-prefix=X86
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
7
8; Just to prevent the alloca from being optimized away
9declare void @dummy_use(i32*, i32)
10
11define 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
16
17true:
18        ret i32 0
19
20false:
21        %newlen = sub i32 %l, 1
22        %retvalue = call i32 @test_basic(i32 %newlen)
23        ret i32 %retvalue
24
25; X86-LABEL:      test_basic:
26
27; X86:      cmpl %gs:48, %esp
28; X86-NEXT: jbe	.LBB0_1
29
30; X86:      movl %esp, %eax
31; X86:      subl %ecx, %eax
32; X86-NEXT: cmpl %eax, %gs:48
33
34; X86:      movl %eax, %esp
35
36; X86:      subl $12, %esp
37; X86-NEXT: pushl %ecx
38; X86-NEXT: calll __morestack_allocate_stack_space
39; X86-NEXT: addl $16, %esp
40
41; X86:      pushl $4
42; X86-NEXT: pushl $12
43; X86-NEXT: calll __morestack
44; X86-NEXT: ret
45
46; X64-LABEL:      test_basic:
47
48; X64:      cmpq %fs:112, %rsp
49; X64-NEXT: jbe      .LBB0_1
50
51; X64:      movq %rsp, %[[RDI:rdi|rax]]
52; X64:      subq %{{.*}}, %[[RDI]]
53; X64-NEXT: cmpq %[[RDI]], %fs:112
54
55; X64:      movq %[[RDI]], %rsp
56
57; X64:      movq %{{.*}}, %rdi
58; X64-NEXT: callq __morestack_allocate_stack_space
59; X64:      movq %rax, %rdi
60
61; X64:      movabsq $24, %r10
62; X64-NEXT: movabsq $0, %r11
63; X64-NEXT: callq __morestack
64; X64-NEXT: ret
65
66; X32ABI-LABEL:      test_basic:
67
68; X32ABI:      cmpl %fs:64, %esp
69; X32ABI-NEXT: jbe      .LBB0_1
70
71; X32ABI:      movl %esp, %[[EDI:edi|eax]]
72; X32ABI:      subl %{{.*}}, %[[EDI]]
73; X32ABI-NEXT: cmpl %[[EDI]], %fs:64
74
75; X32ABI:      movl %[[EDI]], %esp
76
77; X32ABI:      movl %{{.*}}, %edi
78; X32ABI-NEXT: callq __morestack_allocate_stack_space
79; X32ABI:      movl %eax, %edi
80
81; X32ABI:      movl $24, %r10d
82; X32ABI-NEXT: movl $0, %r11d
83; X32ABI-NEXT: callq __morestack
84; X32ABI-NEXT: ret
85
86}
87
88attributes #0 = { "split-stack" }
89