Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=i686-windows | FileCheck %s -check-prefix=CHECK 
      2 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=LINUX64
      3 
      4 declare void @param1(i32 %a)
      5 declare i32 @param2_ret(i32 %a, i32 %b)
      6 declare i64 @param2_ret64(i32 %a, i32 %b)
      7 declare void @param2(i32 %a, i32 %b)
      8 declare void @param3(i32 %a, i32 %b, i32 %c)
      9 declare void @param8(i64, i64, i64, i64, i64, i64, i64, i64)
     10 
     11 
     12 define void @test() minsize nounwind {
     13 ; CHECK-LABEL: test:
     14 ; CHECK: calll _param1
     15 ; CHECK-NEXT: popl %eax
     16 ; CHECK: calll _param2
     17 ; CHECK-NEXT: popl %eax
     18 ; CHECK-NEXT: popl %ecx
     19 ; CHECK: calll _param2_ret
     20 ; CHECK-NEXT: popl %ecx
     21 ; CHECK-NEXT: popl %edx
     22 ; CHECK-NEXT: pushl %eax
     23 ; CHECK: calll _param3
     24 ; CHECK-NEXT: addl $12, %esp
     25 ; CHECK: calll _param2_ret64
     26 ; CHECK-NEXT: popl %ecx
     27 ; CHECK-NEXT: popl %ecx
     28   call void @param1(i32 1)
     29   call void @param2(i32 1, i32 2)
     30   %ret = call i32 @param2_ret(i32 1, i32 2)
     31   call void @param3(i32 1, i32 2, i32 %ret)
     32   %ret64 = call i64 @param2_ret64(i32 1, i32 2)  
     33   ret void
     34 }
     35 
     36 define void @negative(i32 %k) {
     37 ; CHECK-LABEL: negative:
     38 ; CHECK: calll _param1
     39 ; CHECK-NEXT: addl $4, %esp
     40 ; CHECK: calll _param2
     41 ; CHECK-NEXT: addl $8, %esp
     42 ; CHECK: calll _param3
     43 ; CHECK-NEXT: movl %ebp, %esp
     44   %v = alloca i32, i32 %k
     45   call void @param1(i32 1)
     46   call void @param2(i32 1, i32 2)
     47   call void @param3(i32 1, i32 2, i32 3)
     48   ret void
     49 }
     50 
     51 define void @spill(i32 inreg %a, i32 inreg %b, i32 inreg %c) minsize nounwind {
     52 ; CHECK-LABEL: spill:
     53 ; CHECK-DAG: movl %ecx,
     54 ; CHECK-DAG: movl %edx,
     55 ; CHECK: calll _param2_ret
     56 ; CHECK-NEXT: popl %ecx
     57 ; CHECK-NEXT: popl %edx
     58 ; CHECK-DAG: movl {{.*}}, %ecx
     59 ; CHECK-DAG: movl {{.*}}, %edx
     60 ; CHECK: calll _spill
     61   %i = call i32 @param2_ret(i32 1, i32 2)
     62   call void @spill(i32 %a, i32 %b, i32 %c)
     63   ret void
     64 }
     65 
     66 define void @test_linux64(i32 %size) minsize nounwind {
     67 ; LINUX64-LABEL: test_linux64:
     68 ; LINUX64: pushq %rbp
     69 ; LINUX64: callq param8
     70 ; LINUX64-NEXT: popq %rax
     71 ; LINUX64-NEXT: popq %rcx
     72 
     73   %a = alloca i64, i32 %size, align 8
     74   call void @param8(i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8)
     75   ret void
     76 }
     77