blob: 060ce0f7aab4fb22c7517114a92e1ac66f9d7953 [file] [log] [blame]
NAKAMURA Takumi7754f852011-01-26 02:04:09 +00001; RUN: llc < %s -tailcallopt -mtriple=x86_64-linux -post-RA-scheduler=true | FileCheck %s
2; RUN: llc < %s -tailcallopt -mtriple=x86_64-win32 -post-RA-scheduler=true | FileCheck %s
3
4; FIXME: Redundant unused stack allocation could be eliminated.
NAKAMURA Takumi419f2322011-02-27 08:47:19 +00005; CHECK: subq ${{24|72}}, %rsp
Dan Gohman98ca4f22009-08-05 01:29:28 +00006
Arnold Schwaighoferd2ef5232008-04-30 09:19:47 +00007; Check that lowered arguments on the stack do not overwrite each other.
Dan Gohman98ca4f22009-08-05 01:29:28 +00008; Add %in1 %p1 to a different temporary register (%eax).
Jakob Stoklund Olesenb0e47cd2011-04-05 00:32:44 +00009; CHECK: movl [[A1:32|144]](%rsp), [[R1:%e..]]
Dan Gohman98ca4f22009-08-05 01:29:28 +000010; Move param %in1 to temp register (%r10d).
Jakob Stoklund Olesenb0e47cd2011-04-05 00:32:44 +000011; CHECK: movl [[A2:40|152]](%rsp), [[R2:%[a-z0-9]+]]
Dan Gohman584fedf2010-06-21 22:17:20 +000012; Add %in1 %p1 to a different temporary register (%eax).
Jakob Stoklund Olesenb0e47cd2011-04-05 00:32:44 +000013; CHECK: addl {{%edi|%ecx}}, [[R1]]
Daniel Dunbar62424952009-11-13 01:01:58 +000014; Move param %in2 to stack.
Jakob Stoklund Olesenb0e47cd2011-04-05 00:32:44 +000015; CHECK: movl [[R2]], [[A1]](%rsp)
Dan Gohman10190cc2009-11-16 23:43:42 +000016; Move result of addition to stack.
Jakob Stoklund Olesenb0e47cd2011-04-05 00:32:44 +000017; CHECK: movl [[R1]], [[A2]](%rsp)
Dan Gohman98ca4f22009-08-05 01:29:28 +000018; Eventually, do a TAILCALL
19; CHECK: TAILCALL
Arnold Schwaighoferd2ef5232008-04-30 09:19:47 +000020
Evan Chengd36076e2009-10-18 19:57:27 +000021declare 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 +000022
Evan Chengd36076e2009-10-18 19:57:27 +000023define 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 +000024entry:
25 %tmp = add i32 %in1, %p1
Arnold Schwaighoferbbd8c332009-06-12 16:26:57 +000026 %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 +000027 ret i32 %retval
28}