• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s | FileCheck %s
2
3target triple = "msp430"
4
5%struct.X = type { i8 }
6
7; CHECK-LABEL: @foo
8; CHECK: sub   #4, r1
9; CHECK: mov.b   #1, 3(r1)
10define void @foo() {
11  %1 = alloca %struct.X
12  %2 = alloca %struct.X
13  %3 = alloca %struct.X
14  %4 = getelementptr inbounds %struct.X, %struct.X* %1, i32 0, i32 0
15  store i8 1, i8* %4
16  %5 = getelementptr inbounds %struct.X, %struct.X* %2, i32 0, i32 0
17  store i8 1, i8* %5
18  %6 = getelementptr inbounds %struct.X, %struct.X* %3, i32 0, i32 0
19  store i8 1, i8* %6
20  ret void
21}
22
23; CHECK-LABEL: @bar
24; CHECK: sub   #4, r1
25; CHECK: mov.b   #1, 3(r1)
26define void @bar() {
27  %1 = alloca [3 x %struct.X]
28  %2 = getelementptr inbounds [3 x %struct.X], [3 x %struct.X]* %1, i16 0, i16 0
29  %3 = getelementptr inbounds %struct.X, %struct.X* %2, i32 0, i32 0
30  store i8 1, i8* %3
31  %4 = getelementptr inbounds [3 x %struct.X], [3 x %struct.X]* %1, i16 0, i16 1
32  %5 = getelementptr inbounds %struct.X, %struct.X* %4, i32 0, i32 0
33  store i8 1, i8* %5
34  %6 = getelementptr inbounds [3 x %struct.X], [3 x %struct.X]* %1, i16 0, i16 2
35  %7 = getelementptr inbounds %struct.X, %struct.X* %6, i32 0, i32 0
36  store i8 1, i8* %7
37  ret void
38}
39
40%struct.Y = type { i8, i16 }
41
42; CHECK-LABEL: @baz
43; CHECK: sub   #8, r1
44; CHECK: mov   #2, 6(r1)
45define void @baz() {
46  %1 = alloca %struct.Y, align 2
47  %2 = alloca %struct.Y, align 2
48  %3 = getelementptr inbounds %struct.Y, %struct.Y* %1, i32 0, i32 0
49  store i8 1, i8* %3, align 2
50  %4 = getelementptr inbounds %struct.Y, %struct.Y* %1, i32 0, i32 1
51  store i16 2, i16* %4, align 2
52  %5 = getelementptr inbounds %struct.Y, %struct.Y* %2, i32 0, i32 0
53  store i8 1, i8* %5, align 2
54  %6 = getelementptr inbounds %struct.Y, %struct.Y* %2, i32 0, i32 1
55  store i16 2, i16* %6, align 2
56  ret void
57}
58