blob: c81327e5143a77a413732500d4fe8a12cd7f61df [file] [log] [blame]
Arnold Schwaighoferd2ef5232008-04-30 09:19:47 +00001; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 | grep TAILCALL
2; Check that lowered arguments on the stack do not overwrite each other.
3; Move param %in1 to temp register (%eax).
4; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -x86-asm-syntax=att | grep {movl 40(%rsp), %eax}
5; Add %in1 %p1 to another temporary register (%r9d).
Arnold Schwaighoferbbd8c332009-06-12 16:26:57 +00006; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -x86-asm-syntax=att | grep {movl %edi, %r10d}
7; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -x86-asm-syntax=att | grep {addl 32(%rsp), %r10d}
Arnold Schwaighoferd2ef5232008-04-30 09:19:47 +00008; Move result of addition to stack.
Arnold Schwaighoferbbd8c332009-06-12 16:26:57 +00009; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -x86-asm-syntax=att | grep {movl %r10d, 40(%rsp)}
Arnold Schwaighoferd2ef5232008-04-30 09:19:47 +000010; Move param %in2 to stack.
11; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -x86-asm-syntax=att | grep {movl %eax, 32(%rsp)}
12
Arnold Schwaighoferbbd8c332009-06-12 16:26:57 +000013declare fastcc i32 @tailcallee(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %a, i32 %b)
Arnold Schwaighoferd2ef5232008-04-30 09:19:47 +000014
Arnold Schwaighoferbbd8c332009-06-12 16:26:57 +000015define fastcc i32 @tailcaller(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %in1, i32 %in2) {
Arnold Schwaighoferd2ef5232008-04-30 09:19:47 +000016entry:
17 %tmp = add i32 %in1, %p1
Arnold Schwaighoferbbd8c332009-06-12 16:26:57 +000018 %retval = tail call fastcc i32 @tailcallee(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %in2,i32 %tmp)
Arnold Schwaighoferd2ef5232008-04-30 09:19:47 +000019 ret i32 %retval
20}
21