1 ; RUN: llc < %s -march=avr | FileCheck %s
3 declare void @foo(i16*, i16*, i8*)
5 define void @test1(i16 %x) {
9 ; CHECK-NEXT: in [[SPCOPY1:r[0-9]+]], 61
10 ; CHECK-NEXT: in [[SPCOPY2:r[0-9]+]], 62
11 ; allocate first dynalloca
12 ; CHECK: in {{.*}}, 61
13 ; CHECK: in {{.*}}, 62
18 ; CHECK-NEXT: out 62, {{.*}}
19 ; CHECK-NEXT: out 63, r0
20 ; CHECK-NEXT: out 61, {{.*}}
22 ; CHECK: std Z+12, {{.*}}
23 ; CHECK: std Z+13, {{.*}}
24 ; CHECK: std Z+7, {{.*}}
29 ; CHECK-NEXT: out 62, [[SPCOPY2]]
30 ; CHECK-NEXT: out 63, r0
31 ; CHECK-NEXT: out 61, [[SPCOPY1]]
33 %vla = alloca i16, i16 %x
34 %add = shl nsw i16 %x, 1
35 %vla1 = alloca i8, i16 %add
36 %arrayidx = getelementptr inbounds [8 x i16], [8 x i16]* %a, i16 0, i16 2
37 store i16 3, i16* %arrayidx
38 %arrayidx2 = getelementptr inbounds i16, i16* %vla, i16 6
39 store i16 4, i16* %arrayidx2
40 %arrayidx3 = getelementptr inbounds i8, i8* %vla1, i16 7
41 store i8 44, i8* %arrayidx3
42 %arraydecay = getelementptr inbounds [8 x i16], [8 x i16]* %a, i16 0, i16 0
43 call void @foo(i16* %arraydecay, i16* %vla, i8* %vla1)
47 declare void @foo2(i16*, i64, i64, i64)
49 ; Test that arguments are passed through pushes into the call instead of
50 ; allocating the call frame space in the prologue. Also test that SP is restored
51 ; after the call frame is restored and not before.
52 define void @dynalloca2(i16 %x) {
53 ; CHECK-LABEL: dynalloca2:
54 ; CHECK: in [[SPCOPY1:r[0-9]+]], 61
55 ; CHECK: in [[SPCOPY2:r[0-9]+]], 62
61 ; CHECK-NEXT: in r30, 61
62 ; CHECK-NEXT: in r31, 62
63 ; CHECK-NEXT: adiw r30, 8
64 ; CHECK-NEXT: in r0, 63
66 ; CHECK-NEXT: out 62, r31
67 ; CHECK-NEXT: out 63, r0
68 ; CHECK-NEXT: out 61, r30
72 ; CHECK-NEXT: out 62, r7
73 ; CHECK-NEXT: out 63, r0
74 ; CHECK-NEXT: out 61, r6
75 %vla = alloca i16, i16 %x
76 call void @foo2(i16* %vla, i64 0, i64 0, i64 0)