diff options
author | Shih-wei Liao <sliao@google.com> | 2010-02-10 11:10:31 -0800 |
---|---|---|
committer | Shih-wei Liao <sliao@google.com> | 2010-02-10 11:10:31 -0800 |
commit | e264f62ca09a8f65c87a46d562a4d0f9ec5d457e (patch) | |
tree | 59e3d57ef656cef79afa708ae0a3daf25cd91fcf /test/CodeGen/X86/tailcallbyval64.ll | |
download | external_llvm-e264f62ca09a8f65c87a46d562a4d0f9ec5d457e.zip external_llvm-e264f62ca09a8f65c87a46d562a4d0f9ec5d457e.tar.gz external_llvm-e264f62ca09a8f65c87a46d562a4d0f9ec5d457e.tar.bz2 |
Check in LLVM r95781.
Diffstat (limited to 'test/CodeGen/X86/tailcallbyval64.ll')
-rw-r--r-- | test/CodeGen/X86/tailcallbyval64.ll | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/CodeGen/X86/tailcallbyval64.ll b/test/CodeGen/X86/tailcallbyval64.ll new file mode 100644 index 0000000..7c685b8 --- /dev/null +++ b/test/CodeGen/X86/tailcallbyval64.ll @@ -0,0 +1,29 @@ +; RUN: llc < %s -march=x86-64 -tailcallopt | grep TAILCALL +; Expect 2 rep;movs because of tail call byval lowering. +; RUN: llc < %s -march=x86-64 -tailcallopt | grep rep | wc -l | grep 2 +; A sequence of copyto/copyfrom virtual registers is used to deal with byval +; lowering appearing after moving arguments to registers. The following two +; checks verify that the register allocator changes those sequences to direct +; moves to argument register where it can (for registers that are not used in +; byval lowering - not rsi, not rdi, not rcx). +; Expect argument 4 to be moved directly to register edx. +; RUN: llc < %s -march=x86-64 -tailcallopt | grep movl | grep {7} | grep edx +; Expect argument 6 to be moved directly to register r8. +; RUN: llc < %s -march=x86-64 -tailcallopt | grep movl | grep {17} | grep r8 + +%struct.s = type { i64, i64, i64, i64, i64, i64, i64, i64, + i64, i64, i64, i64, i64, i64, i64, i64, + i64, i64, i64, i64, i64, i64, i64, i64 } + +declare fastcc i64 @tailcallee(%struct.s* byval %a, i64 %val, i64 %val2, i64 %val3, i64 %val4, i64 %val5) + + +define fastcc i64 @tailcaller(i64 %b, %struct.s* byval %a) { +entry: + %tmp2 = getelementptr %struct.s* %a, i32 0, i32 1 + %tmp3 = load i64* %tmp2, align 8 + %tmp4 = tail call fastcc i64 @tailcallee(%struct.s* %a byval, i64 %tmp3, i64 %b, i64 7, i64 13, i64 17) + ret i64 %tmp4 +} + + |