1 ; RUN: llc -mtriple=i686-- < %s | FileCheck %s
2 ; RUN: llc -mtriple=i686-- -O0 < %s | FileCheck %s
3 ; RUN: llc -mtriple=i686-- -disable-tail-calls < %s | FileCheck %s
5 declare void @t1_callee(ptr)
6 define void @t1(ptr %a) {
8 ; CHECK: jmp {{_?}}t1_callee
9 musttail call void @t1_callee(ptr %a)
13 declare ptr @t2_callee()
16 ; CHECK: jmp {{_?}}t2_callee
17 %v = musttail call ptr @t2_callee()
21 ; Complex frame layout: stack realignment with dynamic alloca.
22 define void @t3(i32 %n) alignstack(32) nounwind {
27 ; CHECK: andl $-32, %esp
28 ; CHECK: movl %esp, %esi
31 ; CHECK-NEXT: jmp {{_?}}t3_callee
32 %a = alloca i8, i32 %n
33 call void @capture(ptr %a)
34 musttail call void @t3_callee(i32 %n) nounwind
38 declare void @capture(ptr)
39 declare void @t3_callee(i32)
41 ; Test that we actually copy in and out stack arguments that aren't forwarded
42 ; without modification.
43 define i32 @t4(ptr %fn, i32 %n, i32 %r) {
45 ; CHECK: incl %[[r:.*]]
46 ; CHECK: decl %[[n:.*]]
47 ; CHECK-DAG: movl %[[r]], {{[0-9]+}}(%esp)
48 ; CHECK-DAG: movl %[[n]], {{[0-9]+}}(%esp)
49 ; CHECK: jmpl *%{{.*}}
54 %r2 = musttail call i32 %fn(ptr %fn, i32 %n1, i32 %r1)
58 ; Combine the complex stack frame with the parameter modification.
59 define i32 @t5(ptr %fn, i32 %n, i32 %r) alignstack(32) {
62 ; CHECK: movl %esp, %ebp
65 ; CHECK: andl $-32, %esp
66 ; CHECK: movl %esp, %esi
68 ; CHECK: incl %[[r:.*]]
69 ; CHECK: decl %[[n:.*]]
70 ; Store them through ebp, since that's the only stable arg pointer.
71 ; CHECK-DAG: movl %[[r]], {{[0-9]+}}(%ebp)
72 ; CHECK-DAG: movl %[[n]], {{[0-9]+}}(%ebp)
74 ; CHECK: leal {{[-0-9]+}}(%ebp), %esp
77 ; CHECK: jmpl *%{{.*}}
80 %a = alloca i8, i32 %n
81 call void @capture(ptr %a)
84 %r2 = musttail call i32 %fn(ptr %fn, i32 %n1, i32 %r1)