Dan Gohman | 36a0947 | 2009-09-08 23:54:48 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -tailcallopt -march=x86-64 | FileCheck %s |
Dan Gohman | 98ca4f2 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 2 | |
Arnold Schwaighofer | d2ef523 | 2008-04-30 09:19:47 +0000 | [diff] [blame] | 3 | ; Check that lowered arguments on the stack do not overwrite each other. |
Dan Gohman | 98ca4f2 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 4 | ; Add %in1 %p1 to a different temporary register (%eax). |
| 5 | ; CHECK: movl %edi, %eax |
Dan Gohman | 98ca4f2 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 6 | ; Move param %in1 to temp register (%r10d). |
| 7 | ; CHECK: movl 40(%rsp), %r10d |
Evan Cheng | d36076e | 2009-10-18 19:57:27 +0000 | [diff] [blame] | 8 | ; Move result of addition to stack. |
| 9 | ; CHECK: movl %eax, 40(%rsp) |
Daniel Dunbar | 6242495 | 2009-11-13 01:01:58 +0000 | [diff] [blame^] | 10 | ; Move param %in2 to stack. |
| 11 | ; CHECK: movl %r10d, 32(%rsp) |
Dan Gohman | 98ca4f2 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 12 | ; Eventually, do a TAILCALL |
| 13 | ; CHECK: TAILCALL |
Arnold Schwaighofer | d2ef523 | 2008-04-30 09:19:47 +0000 | [diff] [blame] | 14 | |
Evan Cheng | d36076e | 2009-10-18 19:57:27 +0000 | [diff] [blame] | 15 | declare fastcc i32 @tailcallee(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %a, i32 %b) nounwind |
Arnold Schwaighofer | d2ef523 | 2008-04-30 09:19:47 +0000 | [diff] [blame] | 16 | |
Evan Cheng | d36076e | 2009-10-18 19:57:27 +0000 | [diff] [blame] | 17 | define fastcc i32 @tailcaller(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %in1, i32 %in2) nounwind { |
Arnold Schwaighofer | d2ef523 | 2008-04-30 09:19:47 +0000 | [diff] [blame] | 18 | entry: |
| 19 | %tmp = add i32 %in1, %p1 |
Arnold Schwaighofer | bbd8c33 | 2009-06-12 16:26:57 +0000 | [diff] [blame] | 20 | %retval = tail call fastcc i32 @tailcallee(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %in2,i32 %tmp) |
Arnold Schwaighofer | d2ef523 | 2008-04-30 09:19:47 +0000 | [diff] [blame] | 21 | ret i32 %retval |
| 22 | } |
| 23 | |