blob: 7c685b85807e0faa412e1c65425441b8f5791a30 [file] [log] [blame]
Dan Gohman0a063102009-09-08 23:54:48 +00001; RUN: llc < %s -march=x86-64 -tailcallopt | grep TAILCALL
Arnold Schwaighofera38df102008-04-12 18:11:06 +00002; Expect 2 rep;movs because of tail call byval lowering.
Dan Gohman0a063102009-09-08 23:54:48 +00003; RUN: llc < %s -march=x86-64 -tailcallopt | grep rep | wc -l | grep 2
Arnold Schwaighofera38df102008-04-12 18:11:06 +00004; A sequence of copyto/copyfrom virtual registers is used to deal with byval
5; lowering appearing after moving arguments to registers. The following two
6; checks verify that the register allocator changes those sequences to direct
7; moves to argument register where it can (for registers that are not used in
8; byval lowering - not rsi, not rdi, not rcx).
9; Expect argument 4 to be moved directly to register edx.
Dan Gohman0a063102009-09-08 23:54:48 +000010; RUN: llc < %s -march=x86-64 -tailcallopt | grep movl | grep {7} | grep edx
Arnold Schwaighofera38df102008-04-12 18:11:06 +000011; Expect argument 6 to be moved directly to register r8.
Dan Gohman0a063102009-09-08 23:54:48 +000012; RUN: llc < %s -march=x86-64 -tailcallopt | grep movl | grep {17} | grep r8
Arnold Schwaighofera38df102008-04-12 18:11:06 +000013
14%struct.s = type { i64, i64, i64, i64, i64, i64, i64, i64,
15 i64, i64, i64, i64, i64, i64, i64, i64,
16 i64, i64, i64, i64, i64, i64, i64, i64 }
17
18declare fastcc i64 @tailcallee(%struct.s* byval %a, i64 %val, i64 %val2, i64 %val3, i64 %val4, i64 %val5)
19
20
21define fastcc i64 @tailcaller(i64 %b, %struct.s* byval %a) {
22entry:
23 %tmp2 = getelementptr %struct.s* %a, i32 0, i32 1
24 %tmp3 = load i64* %tmp2, align 8
25 %tmp4 = tail call fastcc i64 @tailcallee(%struct.s* %a byval, i64 %tmp3, i64 %b, i64 7, i64 13, i64 17)
26 ret i64 %tmp4
27}
28
29