Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mcpu=generic -mtriple=i686-linux -segmented-stacks -verify-machineinstrs | FileCheck %s -check-prefix=X32
      2 ; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux  -segmented-stacks -verify-machineinstrs | FileCheck %s -check-prefix=X64
      3 ; RUN: llc < %s -mcpu=generic -mtriple=i686-linux -segmented-stacks -filetype=obj
      4 ; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux -segmented-stacks -filetype=obj
      5 
      6 ; Just to prevent the alloca from being optimized away
      7 declare void @dummy_use(i32*, i32)
      8 
      9 define i32 @test_basic(i32 %l) {
     10         %mem = alloca i32, i32 %l
     11         call void @dummy_use (i32* %mem, i32 %l)
     12         %terminate = icmp eq i32 %l, 0
     13         br i1 %terminate, label %true, label %false
     14 
     15 true:
     16         ret i32 0
     17 
     18 false:
     19         %newlen = sub i32 %l, 1
     20         %retvalue = call i32 @test_basic(i32 %newlen)
     21         ret i32 %retvalue
     22 
     23 ; X32:      test_basic:
     24 
     25 ; X32:      cmpl %gs:48, %esp
     26 ; X32-NEXT: ja      .LBB0_2
     27 
     28 ; X32:      pushl $4
     29 ; X32-NEXT: pushl $12
     30 ; X32-NEXT: calll __morestack
     31 ; X32-NEXT: ret
     32 
     33 ; X32:      movl %esp, %eax
     34 ; X32-NEXT: subl %ecx, %eax
     35 ; X32-NEXT: cmpl %eax, %gs:48
     36 
     37 ; X32:      movl %eax, %esp
     38 
     39 ; X32:      subl $12, %esp
     40 ; X32-NEXT: pushl %ecx
     41 ; X32-NEXT: calll __morestack_allocate_stack_space
     42 ; X32-NEXT: addl $16, %esp
     43 
     44 ; X64:      test_basic:
     45 
     46 ; X64:      cmpq %fs:112, %rsp
     47 ; X64-NEXT: ja      .LBB0_2
     48 
     49 ; X64:      movabsq $24, %r10
     50 ; X64-NEXT: movabsq $0, %r11
     51 ; X64-NEXT: callq __morestack
     52 ; X64-NEXT: ret
     53 
     54 ; X64:      movq %rsp, %rdi
     55 ; X64-NEXT: subq %rax, %rdi
     56 ; X64-NEXT: cmpq %rdi, %fs:112
     57 
     58 ; X64:      movq %rdi, %rsp
     59 
     60 ; X64:      movq %rax, %rdi
     61 ; X64-NEXT: callq __morestack_allocate_stack_space
     62 ; X64-NEXT: movq %rax, %rdi
     63 
     64 }
     65