diff options
author | Robert Lytton <robert@xmos.com> | 2013-08-01 08:18:55 +0000 |
---|---|---|
committer | Robert Lytton <robert@xmos.com> | 2013-08-01 08:18:55 +0000 |
commit | f2617291e31bc93d3dae2c80d45df5dfb9a70ae5 (patch) | |
tree | b8074742e082495c2cc207215a7f271582b43af5 /test/CodeGen/XCore | |
parent | 98369fb0e72846179814e221d284bcb8b386e599 (diff) | |
download | external_llvm-f2617291e31bc93d3dae2c80d45df5dfb9a70ae5.zip external_llvm-f2617291e31bc93d3dae2c80d45df5dfb9a70ae5.tar.gz external_llvm-f2617291e31bc93d3dae2c80d45df5dfb9a70ae5.tar.bz2 |
XCore target: Add byval handling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187563 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/XCore')
-rw-r--r-- | test/CodeGen/XCore/byVal.ll | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/CodeGen/XCore/byVal.ll b/test/CodeGen/XCore/byVal.ll new file mode 100644 index 0000000..a5d25d2 --- /dev/null +++ b/test/CodeGen/XCore/byVal.ll @@ -0,0 +1,58 @@ +; RUN: llc < %s -march=xcore | FileCheck %s + +; CHECK-LABEL: f0Test +; CHECK: entsp 1 +; CHECK: bl f0 +; CHECK: retsp 1 +%struct.st0 = type { [0 x i32] } +declare void @f0(%struct.st0*) nounwind +define void @f0Test(%struct.st0* byval %s0) nounwind { +entry: + call void @f0(%struct.st0* %s0) nounwind + ret void +} + +; CHECK-LABEL: f1Test +; CHECK: entsp 13 +; CHECK: stw r4, sp[12] +; CHECK: stw r5, sp[11] +; CHECK: mov r4, r0 +; CHECK: ldaw r5, sp[1] +; CHECK: ldc r2, 40 +; CHECK: mov r0, r5 +; CHECK: bl memcpy +; CHECK: mov r0, r5 +; CHECK: bl f1 +; CHECK: mov r0, r4 +; CHECK: ldw r5, sp[11] +; CHECK: ldw r4, sp[12] +; CHECK: retsp 13 +%struct.st1 = type { [10 x i32] } +declare void @f1(%struct.st1*) nounwind +define i32 @f1Test(i32 %i, %struct.st1* byval %s1) nounwind { +entry: + call void @f1(%struct.st1* %s1) nounwind + ret i32 %i +} + +; CHECK-LABEL: f2Test +; CHECK: extsp 4 +; CHECK: stw lr, sp[1] +; CHECK: stw r2, sp[3] +; CHECK: stw r3, sp[4] +; CHECK: ldw r0, r0[0] +; CHECK: stw r0, sp[2] +; CHECK: ldaw r2, sp[2] +; CHECK: mov r0, r1 +; CHECK: mov r1, r2 +; CHECK: bl f2 +; CHECK: ldw lr, sp[1] +; CHECK: ldaw sp, sp[4] +; CHECK: retsp 0 +%struct.st2 = type { i32 } +declare void @f2(i32, %struct.st2*) nounwind +define void @f2Test(%struct.st2* byval %s2, i32 %i, ...) nounwind { +entry: + call void @f2(i32 %i, %struct.st2* %s2) + ret void +} |