diff options
author | Job Noorman <jobnoorman@gmail.com> | 2013-10-15 08:19:39 +0000 |
---|---|---|
committer | Job Noorman <jobnoorman@gmail.com> | 2013-10-15 08:19:39 +0000 |
commit | 3edacfa97001b1eda9126bcabd68b15c7d8065f2 (patch) | |
tree | c646000e915d2a534a95f739773c7eec08b702e4 /test | |
parent | 3734f33acc45a1fe470f7149a72bd324f7a52881 (diff) | |
download | external_llvm-3edacfa97001b1eda9126bcabd68b15c7d8065f2.zip external_llvm-3edacfa97001b1eda9126bcabd68b15c7d8065f2.tar.gz external_llvm-3edacfa97001b1eda9126bcabd68b15c7d8065f2.tar.bz2 |
Fix MSP430 calling convention to match MSPGCC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/MSP430/cc_args.ll | 118 | ||||
-rw-r--r-- | test/CodeGen/MSP430/cc_ret.ll | 61 |
2 files changed, 179 insertions, 0 deletions
diff --git a/test/CodeGen/MSP430/cc_args.ll b/test/CodeGen/MSP430/cc_args.ll new file mode 100644 index 0000000..39e99e2 --- /dev/null +++ b/test/CodeGen/MSP430/cc_args.ll @@ -0,0 +1,118 @@ +; RUN: llc < %s | FileCheck %s + +target datalayout = "e-p:16:16:16-i8:8:8-i16:16:16-i32:16:32-n8:16-a0:16:16" +target triple = "msp430---elf" + +define void @test() #0 { +entry: +; CHECK: test: + +; CHECK: mov.w #1, r15 +; CHECK: call #f_i16 + call void @f_i16(i16 1) + +; CHECK: mov.w #772, r14 +; CHECK: mov.w #258, r15 +; CHECK: call #f_i32 + call void @f_i32(i32 16909060) + +; CHECK: mov.w #1800, r12 +; CHECK: mov.w #1286, r13 +; CHECK: mov.w #772, r14 +; CHECK: mov.w #258, r15 +; CHECK: call #f_i64 + call void @f_i64(i64 72623859790382856) + +; CHECK: mov.w #772, r14 +; CHECK: mov.w #258, r15 +; CHECK: mov.w #1800, r12 +; CHECK: mov.w #1286, r13 +; CHECK: call #f_i32_i32 + call void @f_i32_i32(i32 16909060, i32 84281096) + +; CHECK: mov.w #1, r15 +; CHECK: mov.w #772, r13 +; CHECK: mov.w #258, r14 +; CHECK: mov.w #2, r12 +; CHECK: call #f_i16_i32_i16 + call void @f_i16_i32_i16(i16 1, i32 16909060, i16 2) + +; CHECK: mov.w #2, 8(r1) +; CHECK: mov.w #258, 6(r1) +; CHECK: mov.w #772, 4(r1) +; CHECK: mov.w #1286, 2(r1) +; CHECK: mov.w #1800, 0(r1) +; CHECK: mov.w #1, r15 +; CHECK: call #f_i16_i64_i16 + call void @f_i16_i64_i16(i16 1, i64 72623859790382856, i16 2) + + ret void +} + +@g_i16 = common global i16 0, align 2 +@g_i32 = common global i32 0, align 2 +@g_i64 = common global i64 0, align 2 + +define void @f_i16(i16 %a) #0 { +; CHECK: f_i16: +; CHECK: mov.w r15, &g_i16 + store volatile i16 %a, i16* @g_i16, align 2 + ret void +} + +define void @f_i32(i32 %a) #0 { +; CHECK: f_i32: +; CHECK: mov.w r15, &g_i32+2 +; CHECK: mov.w r14, &g_i32 + store volatile i32 %a, i32* @g_i32, align 2 + ret void +} + +define void @f_i64(i64 %a) #0 { +; CHECK: f_i64: +; CHECK: mov.w r15, &g_i64+6 +; CHECK: mov.w r14, &g_i64+4 +; CHECK: mov.w r13, &g_i64+2 +; CHECK: mov.w r12, &g_i64 + store volatile i64 %a, i64* @g_i64, align 2 + ret void +} + +define void @f_i32_i32(i32 %a, i32 %b) #0 { +; CHECK: f_i32_i32: +; CHECK: mov.w r15, &g_i32+2 +; CHECK: mov.w r14, &g_i32 + store volatile i32 %a, i32* @g_i32, align 2 +; CHECK: mov.w r13, &g_i32+2 +; CHECK: mov.w r12, &g_i32 + store volatile i32 %b, i32* @g_i32, align 2 + ret void +} + +define void @f_i16_i32_i16(i16 %a, i32 %b, i16 %c) #0 { +; CHECK: f_i16_i32_i16: +; CHECK: mov.w r15, &g_i16 + store volatile i16 %a, i16* @g_i16, align 2 +; CHECK: mov.w r14, &g_i32+2 +; CHECK: mov.w r13, &g_i32 + store volatile i32 %b, i32* @g_i32, align 2 +; CHECK: mov.w r12, &g_i16 + store volatile i16 %c, i16* @g_i16, align 2 + ret void +} + +define void @f_i16_i64_i16(i16 %a, i64 %b, i16 %c) #0 { +; CHECK: f_i16_i64_i16: +; CHECK: mov.w r15, &g_i16 + store volatile i16 %a, i16* @g_i16, align 2 +;CHECK: mov.w 10(r4), &g_i64+6 +;CHECK: mov.w 8(r4), &g_i64+4 +;CHECK: mov.w 6(r4), &g_i64+2 +;CHECK: mov.w 4(r4), &g_i64 + store volatile i64 %b, i64* @g_i64, align 2 +;CHECK: mov.w 12(r4), &g_i16 + store volatile i16 %c, i16* @g_i16, align 2 + ret void +} + +attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } diff --git a/test/CodeGen/MSP430/cc_ret.ll b/test/CodeGen/MSP430/cc_ret.ll new file mode 100644 index 0000000..c2a9ae6 --- /dev/null +++ b/test/CodeGen/MSP430/cc_ret.ll @@ -0,0 +1,61 @@ +; RUN: llc < %s | FileCheck %s + +target datalayout = "e-p:16:16:16-i8:8:8-i16:16:16-i32:16:32-n8:16-a0:16:16" +target triple = "msp430---elf" + +define void @test() #0 { +entry: +; CHECK: test: + +; CHECK: call #f_i16 +; CHECK: mov.w r15, &g_i16 + %0 = call i16 @f_i16() + store volatile i16 %0, i16* @g_i16 + +; CHECK: call #f_i32 +; CHECK: mov.w r15, &g_i32+2 +; CHECK: mov.w r14, &g_i32 + %1 = call i32 @f_i32() + store volatile i32 %1, i32* @g_i32 + +; CHECK: call #f_i64 +; CHECK: mov.w r15, &g_i64+6 +; CHECK: mov.w r14, &g_i64+4 +; CHECK: mov.w r13, &g_i64+2 +; CHECK: mov.w r12, &g_i64 + %2 = call i64 @f_i64() + store volatile i64 %2, i64* @g_i64 + + ret void +} + +@g_i16 = common global i16 0, align 2 +@g_i32 = common global i32 0, align 2 +@g_i64 = common global i64 0, align 2 + +define i16 @f_i16() #0 { +; CHECK: f_i16: +; CHECK: mov.w #1, r15 +; CHECK: ret + ret i16 1 +} + +define i32 @f_i32() #0 { +; CHECK: f_i32: +; CHECK: mov.w #772, r14 +; CHECK: mov.w #258, r15 +; CHECK: ret + ret i32 16909060 +} + +define i64 @f_i64() #0 { +; CHECK: f_i64: +; CHECK: mov.w #1800, r12 +; CHECK: mov.w #1286, r13 +; CHECK: mov.w #772, r14 +; CHECK: mov.w #258, r15 +; CHECK: ret + ret i64 72623859790382856 +} + +attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } |