blob: 69018aa13dd2c33db02d54171a2280331641f57c [file] [log] [blame]
Dan Gohman0a063102009-09-08 23:54:48 +00001; RUN: llc < %s -tailcallopt -march=x86-64 | FileCheck %s
Dan Gohman9178de12009-08-05 01:29:28 +00002
Arnold Schwaighoferfda6f1a2008-04-30 09:19:47 +00003; Check that lowered arguments on the stack do not overwrite each other.
Dan Gohman9178de12009-08-05 01:29:28 +00004; Add %in1 %p1 to a different temporary register (%eax).
5; CHECK: movl %edi, %eax
Dan Gohman9178de12009-08-05 01:29:28 +00006; Move param %in1 to temp register (%r10d).
7; CHECK: movl 40(%rsp), %r10d
Arnold Schwaighoferfda6f1a2008-04-30 09:19:47 +00008; Move param %in2 to stack.
Dan Gohman9178de12009-08-05 01:29:28 +00009; CHECK: movl %r10d, 32(%rsp)
Evan Cheng6e2f5a42009-10-18 19:57:27 +000010; Move result of addition to stack.
11; CHECK: movl %eax, 40(%rsp)
Dan Gohman9178de12009-08-05 01:29:28 +000012; Eventually, do a TAILCALL
13; CHECK: TAILCALL
Arnold Schwaighoferfda6f1a2008-04-30 09:19:47 +000014
Evan Cheng6e2f5a42009-10-18 19:57:27 +000015declare fastcc i32 @tailcallee(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %a, i32 %b) nounwind
Arnold Schwaighoferfda6f1a2008-04-30 09:19:47 +000016
Evan Cheng6e2f5a42009-10-18 19:57:27 +000017define fastcc i32 @tailcaller(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %in1, i32 %in2) nounwind {
Arnold Schwaighoferfda6f1a2008-04-30 09:19:47 +000018entry:
19 %tmp = add i32 %in1, %p1
Arnold Schwaighofera8726f02009-06-12 16:26:57 +000020 %retval = tail call fastcc i32 @tailcallee(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %in2,i32 %tmp)
Arnold Schwaighoferfda6f1a2008-04-30 09:19:47 +000021 ret i32 %retval
22}
23