Dan Gohman | 98ca4f2 | 2009-08-05 01:29:28 +0000 | [diff] [blame^] | 1 | ; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 | FileCheck %s |
| 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 |
| 6 | ; CHECK: addl 32(%rsp), %eax |
| 7 | ; Move param %in1 to temp register (%r10d). |
| 8 | ; CHECK: movl 40(%rsp), %r10d |
Arnold Schwaighofer | d2ef523 | 2008-04-30 09:19:47 +0000 | [diff] [blame] | 9 | ; Move result of addition to stack. |
Dan Gohman | 98ca4f2 | 2009-08-05 01:29:28 +0000 | [diff] [blame^] | 10 | ; CHECK: movl %eax, 40(%rsp) |
Arnold Schwaighofer | d2ef523 | 2008-04-30 09:19:47 +0000 | [diff] [blame] | 11 | ; Move param %in2 to stack. |
Dan Gohman | 98ca4f2 | 2009-08-05 01:29:28 +0000 | [diff] [blame^] | 12 | ; CHECK: movl %r10d, 32(%rsp) |
| 13 | ; Eventually, do a TAILCALL |
| 14 | ; CHECK: TAILCALL |
Arnold Schwaighofer | d2ef523 | 2008-04-30 09:19:47 +0000 | [diff] [blame] | 15 | |
Arnold Schwaighofer | bbd8c33 | 2009-06-12 16:26:57 +0000 | [diff] [blame] | 16 | declare fastcc i32 @tailcallee(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %a, i32 %b) |
Arnold Schwaighofer | d2ef523 | 2008-04-30 09:19:47 +0000 | [diff] [blame] | 17 | |
Arnold Schwaighofer | bbd8c33 | 2009-06-12 16:26:57 +0000 | [diff] [blame] | 18 | define fastcc i32 @tailcaller(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %in1, i32 %in2) { |
Arnold Schwaighofer | d2ef523 | 2008-04-30 09:19:47 +0000 | [diff] [blame] | 19 | entry: |
| 20 | %tmp = add i32 %in1, %p1 |
Arnold Schwaighofer | bbd8c33 | 2009-06-12 16:26:57 +0000 | [diff] [blame] | 21 | %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] | 22 | ret i32 %retval |
| 23 | } |
| 24 | |