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(i8*)
6 define void @t1(i32* %a) {
8 ; CHECK: jmp {{_?}}t1_callee
9 %b = bitcast i32* %a to i8*
10 musttail call void @t1_callee(i8* %b)
14 declare i8* @t2_callee()
17 ; CHECK: jmp {{_?}}t2_callee
18 %v = musttail call i8* @t2_callee()
19 %w = bitcast i8* %v to i32*
23 ; Complex frame layout: stack realignment with dynamic alloca.
24 define void @t3(i32 %n) alignstack(32) nounwind {
29 ; CHECK: andl $-32, %esp
30 ; CHECK: movl %esp, %esi
33 ; CHECK-NEXT: jmp {{_?}}t3_callee
34 %a = alloca i8, i32 %n
35 call void @capture(i8* %a)
36 musttail call void @t3_callee(i32 %n) nounwind
40 declare void @capture(i8*)
41 declare void @t3_callee(i32)
43 ; Test that we actually copy in and out stack arguments that aren't forwarded
44 ; without modification.
45 define i32 @t4({}* %fn, i32 %n, i32 %r) {
47 ; CHECK: incl %[[r:.*]]
48 ; CHECK: decl %[[n:.*]]
49 ; CHECK-DAG: movl %[[r]], {{[0-9]+}}(%esp)
50 ; CHECK-DAG: movl %[[n]], {{[0-9]+}}(%esp)
51 ; CHECK: jmpl *%{{.*}}
56 %fn_cast = bitcast {}* %fn to i32 ({}*, i32, i32)*
57 %r2 = musttail call i32 %fn_cast({}* %fn, i32 %n1, i32 %r1)
61 ; Combine the complex stack frame with the parameter modification.
62 define i32 @t5({}* %fn, i32 %n, i32 %r) alignstack(32) {
65 ; CHECK: movl %esp, %ebp
68 ; CHECK: andl $-32, %esp
69 ; CHECK: movl %esp, %esi
71 ; CHECK: incl %[[r:.*]]
72 ; CHECK: decl %[[n:.*]]
73 ; Store them through ebp, since that's the only stable arg pointer.
74 ; CHECK-DAG: movl %[[r]], {{[0-9]+}}(%ebp)
75 ; CHECK-DAG: movl %[[n]], {{[0-9]+}}(%ebp)
77 ; CHECK: leal {{[-0-9]+}}(%ebp), %esp
80 ; CHECK: jmpl *%{{.*}}
83 %a = alloca i8, i32 %n
84 call void @capture(i8* %a)
87 %fn_cast = bitcast {}* %fn to i32 ({}*, i32, i32)*
88 %r2 = musttail call i32 %fn_cast({}* %fn, i32 %n1, i32 %r1)