Debian Codegraph @

llvm/test/CodeGen/MSP430/struct_layout.ll

raw
1 ; RUN: llc < %s | FileCheck %s
2
3 target 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)
10 define void @foo() {
11 %1 = alloca %struct.X
12 %2 = alloca %struct.X
13 %3 = alloca %struct.X
14 %4 = getelementptr inbounds %struct.X, ptr %1, i32 0, i32 0
15 store i8 1, ptr %4
16 %5 = getelementptr inbounds %struct.X, ptr %2, i32 0, i32 0
17 store i8 1, ptr %5
18 %6 = getelementptr inbounds %struct.X, ptr %3, i32 0, i32 0
19 store i8 1, ptr %6
20 ret void
21 }
22
23 ; CHECK-LABEL: @bar
24 ; CHECK: sub #4, r1
25 ; CHECK: mov.b #1, 3(r1)
26 define void @bar() {
27 %1 = alloca [3 x %struct.X]
28 %2 = getelementptr inbounds [3 x %struct.X], ptr %1, i16 0, i16 0
29 %3 = getelementptr inbounds %struct.X, ptr %2, i32 0, i32 0
30 store i8 1, ptr %3
31 %4 = getelementptr inbounds [3 x %struct.X], ptr %1, i16 0, i16 1
32 %5 = getelementptr inbounds %struct.X, ptr %4, i32 0, i32 0
33 store i8 1, ptr %5
34 %6 = getelementptr inbounds [3 x %struct.X], ptr %1, i16 0, i16 2
35 %7 = getelementptr inbounds %struct.X, ptr %6, i32 0, i32 0
36 store i8 1, ptr %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)
45 define void @baz() {
46 %1 = alloca %struct.Y, align 2
47 %2 = alloca %struct.Y, align 2
48 %3 = getelementptr inbounds %struct.Y, ptr %1, i32 0, i32 0
49 store i8 1, ptr %3, align 2
50 %4 = getelementptr inbounds %struct.Y, ptr %1, i32 0, i32 1
51 store i16 2, ptr %4, align 2
52 %5 = getelementptr inbounds %struct.Y, ptr %2, i32 0, i32 0
53 store i8 1, ptr %5, align 2
54 %6 = getelementptr inbounds %struct.Y, ptr %2, i32 0, i32 1
55 store i16 2, ptr %6, align 2
56 ret void
57 }