blob: 107bdf9de3e7af18ca1040406f6eb490f9526ced [file] [log] [blame]
Dan Gohmand84ea472009-12-07 19:04:31 +00001; RUN: llc < %s -tailcallopt -march=x86-64 -post-RA-scheduler=true | FileCheck %s
Dan Gohman98ca4f22009-08-05 01:29:28 +00002
Arnold Schwaighoferd2ef5232008-04-30 09:19:47 +00003; Check that lowered arguments on the stack do not overwrite each other.
Dan Gohman98ca4f22009-08-05 01:29:28 +00004; Add %in1 %p1 to a different temporary register (%eax).
Dan Gohman584fedf2010-06-21 22:17:20 +00005; CHECK: movl 32(%rsp), %eax
Dan Gohman98ca4f22009-08-05 01:29:28 +00006; Move param %in1 to temp register (%r10d).
7; CHECK: movl 40(%rsp), %r10d
Dan Gohman584fedf2010-06-21 22:17:20 +00008; Add %in1 %p1 to a different temporary register (%eax).
9; CHECK: addl %edi, %eax
Daniel Dunbar62424952009-11-13 01:01:58 +000010; Move param %in2 to stack.
11; CHECK: movl %r10d, 32(%rsp)
Dan Gohman10190cc2009-11-16 23:43:42 +000012; Move result of addition to stack.
13; CHECK: movl %eax, 40(%rsp)
Dan Gohman98ca4f22009-08-05 01:29:28 +000014; Eventually, do a TAILCALL
15; CHECK: TAILCALL
Arnold Schwaighoferd2ef5232008-04-30 09:19:47 +000016
Evan Chengd36076e2009-10-18 19:57:27 +000017declare fastcc i32 @tailcallee(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %a, i32 %b) nounwind
Arnold Schwaighoferd2ef5232008-04-30 09:19:47 +000018
Evan Chengd36076e2009-10-18 19:57:27 +000019define fastcc i32 @tailcaller(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %in1, i32 %in2) nounwind {
Arnold Schwaighoferd2ef5232008-04-30 09:19:47 +000020entry:
21 %tmp = add i32 %in1, %p1
Arnold Schwaighoferbbd8c332009-06-12 16:26:57 +000022 %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 +000023 ret i32 %retval
24}
25