1 ; RUN: llc < %s -mtriple=i686-windows | FileCheck %s
2 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=LINUX64
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 declare i32 @param8_ret(i64, i64, i64, i64, i64, i64, i64, i64)
13 define void @test() minsize nounwind {
15 ; CHECK: calll _param1
16 ; CHECK-NEXT: popl %eax
17 ; CHECK: calll _param2
18 ; CHECK-NEXT: popl %eax
19 ; CHECK-NEXT: popl %ecx
20 ; CHECK: calll _param2_ret
21 ; CHECK-NEXT: popl %ecx
22 ; CHECK-NEXT: popl %edx
23 ; CHECK-NEXT: pushl %eax
24 ; CHECK: calll _param3
25 ; CHECK-NEXT: addl $12, %esp
26 ; CHECK: calll _param2_ret64
27 ; CHECK-NEXT: popl %ecx
28 ; CHECK-NEXT: popl %ecx
29 call void @param1(i32 1)
30 call void @param2(i32 1, i32 2)
31 %ret = call i32 @param2_ret(i32 1, i32 2)
32 call void @param3(i32 1, i32 2, i32 %ret)
33 %ret64 = call i64 @param2_ret64(i32 1, i32 2)
37 define void @negative(i32 %k) {
38 ; CHECK-LABEL: negative:
39 ; CHECK: calll _param1
40 ; CHECK-NEXT: addl $4, %esp
41 ; CHECK: calll _param2
42 ; CHECK-NEXT: addl $8, %esp
43 ; CHECK: calll _param3
44 ; CHECK-NEXT: movl %ebp, %esp
45 %v = alloca i32, i32 %k
46 call void @param1(i32 1)
47 call void @param2(i32 1, i32 2)
48 call void @param3(i32 1, i32 2, i32 3)
52 define void @spill(i32 inreg %a, i32 inreg %b, i32 inreg %c) minsize nounwind {
54 ; CHECK-DAG: movl %ecx,
55 ; CHECK-DAG: movl %edx,
56 ; CHECK: calll _param2_ret
57 ; CHECK-NEXT: popl %ecx
58 ; CHECK-NEXT: popl %edx
59 ; CHECK-DAG: movl {{.*}}, %ecx
60 ; CHECK-DAG: movl {{.*}}, %edx
62 %i = call i32 @param2_ret(i32 1, i32 2)
63 call void @spill(i32 inreg %a, i32 inreg %b, i32 inreg %c)
67 define void @test_linux64(i32 %size) minsize nounwind {
68 ; LINUX64-LABEL: test_linux64:
70 ; LINUX64: callq param8
71 ; LINUX64-NEXT: popq %rax
72 ; LINUX64-NEXT: popq %rcx
74 %a = alloca i64, i32 %size, align 8
75 call void @param8(i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8)
79 define i32 @test_linux64_i32(i32 %size) minsize nounwind {
80 ; LINUX64-LABEL: test_linux64_i32:
81 ; LINUX64: callq param8_ret
82 ; LINUX64-NOT: popq %rax
84 %a = alloca i64, i32 %size, align 8
85 %r = call i32 @param8_ret(i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8)