1 ; RUN: llc < %s | FileCheck %s
3 target datalayout = "e-p:16:16:16-i8:8:8-i16:16:16-i32:16:32-n8:16"
4 target triple = "msp430---elf"
6 ; Pass large structures by reference (MSP430 EABI p. 3.5)
10 define %s @fred() #0 {
12 ; CHECK: mov #2314, 14(r12)
13 ; CHECK: mov #2828, 12(r12)
14 ; CHECK: mov #3342, 10(r12)
15 ; CHECK: mov #3840, 8(r12)
16 ; CHECK: mov #258, 6(r12)
17 ; CHECK: mov #772, 4(r12)
18 ; CHECK: mov #1286, 2(r12)
19 ; CHECK: mov #1800, 0(r12)
20 ret %s {i64 72623859790382856, i64 651345242494996224}
23 %struct.S = type { i16, i16, i16 }
25 @a = common global i16 0, align 2
26 @b = common global i16 0, align 2
27 @c = common global i16 0, align 2
29 define void @test() #1 {
31 %1 = alloca %struct.S, align 2
33 ; CHECK-NEXT: call #sret
34 call void @sret(%struct.S* nonnull sret %1) #3
38 define void @sret(%struct.S* noalias nocapture sret) #0 {
40 ; CHECK: mov &a, 0(r12)
41 ; CHECK: mov &b, 2(r12)
42 ; CHECK: mov &c, 4(r12)
43 %2 = getelementptr inbounds %struct.S, %struct.S* %0, i16 0, i32 0
44 %3 = load i16, i16* @a, align 2
45 store i16 %3, i16* %2, align 2
46 %4 = getelementptr inbounds %struct.S, %struct.S* %0, i16 0, i32 1
47 %5 = load i16, i16* @b, align 2
48 store i16 %5, i16* %4, align 2
49 %6 = getelementptr inbounds %struct.S, %struct.S* %0, i16 0, i32 2
50 %7 = load i16, i16* @c, align 2
51 store i16 %7, i16* %6, align 2
55 attributes #0 = { nounwind }