1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -triple x86_64 -O3 -o %t.opt.ll %s \
2f4a2713aSLionel Sambuc // RUN: -fdump-record-layouts > %t.dump.txt
3f4a2713aSLionel Sambuc // RUN: FileCheck -check-prefix=CHECK-RECORD < %t.dump.txt %s
4f4a2713aSLionel Sambuc // RUN: FileCheck -check-prefix=CHECK-OPT < %t.opt.ll %s
5f4a2713aSLionel Sambuc
6f4a2713aSLionel Sambuc /****/
7f4a2713aSLionel Sambuc
8f4a2713aSLionel Sambuc // Check that we don't read off the end a packed 24-bit structure.
9f4a2713aSLionel Sambuc // PR6176
10f4a2713aSLionel Sambuc
11f4a2713aSLionel Sambuc // CHECK-RECORD: *** Dumping IRgen Record Layout
12f4a2713aSLionel Sambuc // CHECK-RECORD: Record: RecordDecl{{.*}}s0
13f4a2713aSLionel Sambuc // CHECK-RECORD: Layout: <CGRecordLayout
14*0a6a1f1dSLionel Sambuc // CHECK-RECORD: LLVMType:%struct.s0 = type { [3 x i8] }
15f4a2713aSLionel Sambuc // CHECK-RECORD: IsZeroInitializable:1
16f4a2713aSLionel Sambuc // CHECK-RECORD: BitFields:[
17f4a2713aSLionel Sambuc // CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:24 IsSigned:1 StorageSize:24 StorageAlignment:1>
18f4a2713aSLionel Sambuc struct __attribute((packed)) s0 {
19f4a2713aSLionel Sambuc int f0 : 24;
20f4a2713aSLionel Sambuc };
21f4a2713aSLionel Sambuc
22f4a2713aSLionel Sambuc struct s0 g0 = { 0xdeadbeef };
23f4a2713aSLionel Sambuc
f0_load(struct s0 * a0)24f4a2713aSLionel Sambuc int f0_load(struct s0 *a0) {
25f4a2713aSLionel Sambuc int size_check[sizeof(struct s0) == 3 ? 1 : -1];
26f4a2713aSLionel Sambuc return a0->f0;
27f4a2713aSLionel Sambuc }
f0_store(struct s0 * a0)28f4a2713aSLionel Sambuc int f0_store(struct s0 *a0) {
29f4a2713aSLionel Sambuc return (a0->f0 = 1);
30f4a2713aSLionel Sambuc }
f0_reload(struct s0 * a0)31f4a2713aSLionel Sambuc int f0_reload(struct s0 *a0) {
32f4a2713aSLionel Sambuc return (a0->f0 += 1);
33f4a2713aSLionel Sambuc }
34f4a2713aSLionel Sambuc
35f4a2713aSLionel Sambuc // CHECK-OPT-LABEL: define i64 @test_0()
36f4a2713aSLionel Sambuc // CHECK-OPT: ret i64 1
37f4a2713aSLionel Sambuc // CHECK-OPT: }
test_0()38f4a2713aSLionel Sambuc unsigned long long test_0() {
39f4a2713aSLionel Sambuc struct s0 g0 = { 0xdeadbeef };
40f4a2713aSLionel Sambuc unsigned long long res = 0;
41f4a2713aSLionel Sambuc res ^= g0.f0;
42f4a2713aSLionel Sambuc res ^= f0_load(&g0) ^ f0_store(&g0) ^ f0_reload(&g0);
43f4a2713aSLionel Sambuc res ^= g0.f0;
44f4a2713aSLionel Sambuc return res;
45f4a2713aSLionel Sambuc }
46f4a2713aSLionel Sambuc
47f4a2713aSLionel Sambuc /****/
48f4a2713aSLionel Sambuc
49f4a2713aSLionel Sambuc // PR5591
50f4a2713aSLionel Sambuc
51f4a2713aSLionel Sambuc // CHECK-RECORD: *** Dumping IRgen Record Layout
52f4a2713aSLionel Sambuc // CHECK-RECORD: Record: RecordDecl{{.*}}s1
53f4a2713aSLionel Sambuc // CHECK-RECORD: Layout: <CGRecordLayout
54*0a6a1f1dSLionel Sambuc // CHECK-RECORD: LLVMType:%struct.s1 = type { [3 x i8] }
55f4a2713aSLionel Sambuc // CHECK-RECORD: IsZeroInitializable:1
56f4a2713aSLionel Sambuc // CHECK-RECORD: BitFields:[
57f4a2713aSLionel Sambuc // CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:10 IsSigned:1 StorageSize:24 StorageAlignment:1>
58f4a2713aSLionel Sambuc // CHECK-RECORD: <CGBitFieldInfo Offset:10 Size:10 IsSigned:1 StorageSize:24 StorageAlignment:1>
59f4a2713aSLionel Sambuc
60f4a2713aSLionel Sambuc #pragma pack(push)
61f4a2713aSLionel Sambuc #pragma pack(1)
62f4a2713aSLionel Sambuc struct __attribute((packed)) s1 {
63f4a2713aSLionel Sambuc signed f0 : 10;
64f4a2713aSLionel Sambuc signed f1 : 10;
65f4a2713aSLionel Sambuc };
66f4a2713aSLionel Sambuc #pragma pack(pop)
67f4a2713aSLionel Sambuc
68f4a2713aSLionel Sambuc struct s1 g1 = { 0xdeadbeef, 0xdeadbeef };
69f4a2713aSLionel Sambuc
f1_load(struct s1 * a0)70f4a2713aSLionel Sambuc int f1_load(struct s1 *a0) {
71f4a2713aSLionel Sambuc int size_check[sizeof(struct s1) == 3 ? 1 : -1];
72f4a2713aSLionel Sambuc return a0->f1;
73f4a2713aSLionel Sambuc }
f1_store(struct s1 * a0)74f4a2713aSLionel Sambuc int f1_store(struct s1 *a0) {
75f4a2713aSLionel Sambuc return (a0->f1 = 1234);
76f4a2713aSLionel Sambuc }
f1_reload(struct s1 * a0)77f4a2713aSLionel Sambuc int f1_reload(struct s1 *a0) {
78f4a2713aSLionel Sambuc return (a0->f1 += 1234);
79f4a2713aSLionel Sambuc }
80f4a2713aSLionel Sambuc
81f4a2713aSLionel Sambuc // CHECK-OPT-LABEL: define i64 @test_1()
82f4a2713aSLionel Sambuc // CHECK-OPT: ret i64 210
83f4a2713aSLionel Sambuc // CHECK-OPT: }
test_1()84f4a2713aSLionel Sambuc unsigned long long test_1() {
85f4a2713aSLionel Sambuc struct s1 g1 = { 0xdeadbeef, 0xdeadbeef };
86f4a2713aSLionel Sambuc unsigned long long res = 0;
87f4a2713aSLionel Sambuc res ^= g1.f0 ^ g1.f1;
88f4a2713aSLionel Sambuc res ^= f1_load(&g1) ^ f1_store(&g1) ^ f1_reload(&g1);
89f4a2713aSLionel Sambuc res ^= g1.f0 ^ g1.f1;
90f4a2713aSLionel Sambuc return res;
91f4a2713aSLionel Sambuc }
92f4a2713aSLionel Sambuc
93f4a2713aSLionel Sambuc /****/
94f4a2713aSLionel Sambuc
95f4a2713aSLionel Sambuc // Check that we don't access beyond the bounds of a union.
96f4a2713aSLionel Sambuc //
97f4a2713aSLionel Sambuc // PR5567
98f4a2713aSLionel Sambuc
99f4a2713aSLionel Sambuc // CHECK-RECORD: *** Dumping IRgen Record Layout
100f4a2713aSLionel Sambuc // CHECK-RECORD: Record: RecordDecl{{.*}}u2
101f4a2713aSLionel Sambuc // CHECK-RECORD: Layout: <CGRecordLayout
102*0a6a1f1dSLionel Sambuc // CHECK-RECORD: LLVMType:%union.u2 = type { i8 }
103f4a2713aSLionel Sambuc // CHECK-RECORD: IsZeroInitializable:1
104f4a2713aSLionel Sambuc // CHECK-RECORD: BitFields:[
105f4a2713aSLionel Sambuc // CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:3 IsSigned:0 StorageSize:8 StorageAlignment:1>
106f4a2713aSLionel Sambuc
107f4a2713aSLionel Sambuc union __attribute__((packed)) u2 {
108f4a2713aSLionel Sambuc unsigned long long f0 : 3;
109f4a2713aSLionel Sambuc };
110f4a2713aSLionel Sambuc
111f4a2713aSLionel Sambuc union u2 g2 = { 0xdeadbeef };
112f4a2713aSLionel Sambuc
f2_load(union u2 * a0)113f4a2713aSLionel Sambuc int f2_load(union u2 *a0) {
114f4a2713aSLionel Sambuc return a0->f0;
115f4a2713aSLionel Sambuc }
f2_store(union u2 * a0)116f4a2713aSLionel Sambuc int f2_store(union u2 *a0) {
117f4a2713aSLionel Sambuc return (a0->f0 = 1234);
118f4a2713aSLionel Sambuc }
f2_reload(union u2 * a0)119f4a2713aSLionel Sambuc int f2_reload(union u2 *a0) {
120f4a2713aSLionel Sambuc return (a0->f0 += 1234);
121f4a2713aSLionel Sambuc }
122f4a2713aSLionel Sambuc
123f4a2713aSLionel Sambuc // CHECK-OPT-LABEL: define i64 @test_2()
124f4a2713aSLionel Sambuc // CHECK-OPT: ret i64 2
125f4a2713aSLionel Sambuc // CHECK-OPT: }
test_2()126f4a2713aSLionel Sambuc unsigned long long test_2() {
127f4a2713aSLionel Sambuc union u2 g2 = { 0xdeadbeef };
128f4a2713aSLionel Sambuc unsigned long long res = 0;
129f4a2713aSLionel Sambuc res ^= g2.f0;
130f4a2713aSLionel Sambuc res ^= f2_load(&g2) ^ f2_store(&g2) ^ f2_reload(&g2);
131f4a2713aSLionel Sambuc res ^= g2.f0;
132f4a2713aSLionel Sambuc return res;
133f4a2713aSLionel Sambuc }
134f4a2713aSLionel Sambuc
135f4a2713aSLionel Sambuc /***/
136f4a2713aSLionel Sambuc
137f4a2713aSLionel Sambuc // PR5039
138f4a2713aSLionel Sambuc
139f4a2713aSLionel Sambuc struct s3 {
140f4a2713aSLionel Sambuc long long f0 : 32;
141f4a2713aSLionel Sambuc long long f1 : 32;
142f4a2713aSLionel Sambuc };
143f4a2713aSLionel Sambuc
144f4a2713aSLionel Sambuc struct s3 g3 = { 0xdeadbeef, 0xdeadbeef };
145f4a2713aSLionel Sambuc
f3_load(struct s3 * a0)146f4a2713aSLionel Sambuc int f3_load(struct s3 *a0) {
147f4a2713aSLionel Sambuc a0->f0 = 1;
148f4a2713aSLionel Sambuc return a0->f0;
149f4a2713aSLionel Sambuc }
f3_store(struct s3 * a0)150f4a2713aSLionel Sambuc int f3_store(struct s3 *a0) {
151f4a2713aSLionel Sambuc a0->f0 = 1;
152f4a2713aSLionel Sambuc return (a0->f0 = 1234);
153f4a2713aSLionel Sambuc }
f3_reload(struct s3 * a0)154f4a2713aSLionel Sambuc int f3_reload(struct s3 *a0) {
155f4a2713aSLionel Sambuc a0->f0 = 1;
156f4a2713aSLionel Sambuc return (a0->f0 += 1234);
157f4a2713aSLionel Sambuc }
158f4a2713aSLionel Sambuc
159f4a2713aSLionel Sambuc // CHECK-OPT-LABEL: define i64 @test_3()
160f4a2713aSLionel Sambuc // CHECK-OPT: ret i64 -559039940
161f4a2713aSLionel Sambuc // CHECK-OPT: }
test_3()162f4a2713aSLionel Sambuc unsigned long long test_3() {
163f4a2713aSLionel Sambuc struct s3 g3 = { 0xdeadbeef, 0xdeadbeef };
164f4a2713aSLionel Sambuc unsigned long long res = 0;
165f4a2713aSLionel Sambuc res ^= g3.f0 ^ g3.f1;
166f4a2713aSLionel Sambuc res ^= f3_load(&g3) ^ f3_store(&g3) ^ f3_reload(&g3);
167f4a2713aSLionel Sambuc res ^= g3.f0 ^ g3.f1;
168f4a2713aSLionel Sambuc return res;
169f4a2713aSLionel Sambuc }
170f4a2713aSLionel Sambuc
171f4a2713aSLionel Sambuc /***/
172f4a2713aSLionel Sambuc
173f4a2713aSLionel Sambuc // This is a case where the bitfield access will straddle an alignment boundary
174f4a2713aSLionel Sambuc // of its underlying type.
175f4a2713aSLionel Sambuc
176f4a2713aSLionel Sambuc struct s4 {
177f4a2713aSLionel Sambuc unsigned f0 : 16;
178f4a2713aSLionel Sambuc unsigned f1 : 28 __attribute__ ((packed));
179f4a2713aSLionel Sambuc };
180f4a2713aSLionel Sambuc
181f4a2713aSLionel Sambuc struct s4 g4 = { 0xdeadbeef, 0xdeadbeef };
182f4a2713aSLionel Sambuc
f4_load(struct s4 * a0)183f4a2713aSLionel Sambuc int f4_load(struct s4 *a0) {
184f4a2713aSLionel Sambuc return a0->f0 ^ a0->f1;
185f4a2713aSLionel Sambuc }
f4_store(struct s4 * a0)186f4a2713aSLionel Sambuc int f4_store(struct s4 *a0) {
187f4a2713aSLionel Sambuc return (a0->f0 = 1234) ^ (a0->f1 = 5678);
188f4a2713aSLionel Sambuc }
f4_reload(struct s4 * a0)189f4a2713aSLionel Sambuc int f4_reload(struct s4 *a0) {
190f4a2713aSLionel Sambuc return (a0->f0 += 1234) ^ (a0->f1 += 5678);
191f4a2713aSLionel Sambuc }
192f4a2713aSLionel Sambuc
193f4a2713aSLionel Sambuc // CHECK-OPT-LABEL: define i64 @test_4()
194f4a2713aSLionel Sambuc // CHECK-OPT: ret i64 4860
195f4a2713aSLionel Sambuc // CHECK-OPT: }
test_4()196f4a2713aSLionel Sambuc unsigned long long test_4() {
197f4a2713aSLionel Sambuc struct s4 g4 = { 0xdeadbeef, 0xdeadbeef };
198f4a2713aSLionel Sambuc unsigned long long res = 0;
199f4a2713aSLionel Sambuc res ^= g4.f0 ^ g4.f1;
200f4a2713aSLionel Sambuc res ^= f4_load(&g4) ^ f4_store(&g4) ^ f4_reload(&g4);
201f4a2713aSLionel Sambuc res ^= g4.f0 ^ g4.f1;
202f4a2713aSLionel Sambuc return res;
203f4a2713aSLionel Sambuc }
204f4a2713aSLionel Sambuc
205f4a2713aSLionel Sambuc /***/
206f4a2713aSLionel Sambuc
207f4a2713aSLionel Sambuc struct s5 {
208f4a2713aSLionel Sambuc unsigned f0 : 2;
209f4a2713aSLionel Sambuc _Bool f1 : 1;
210f4a2713aSLionel Sambuc _Bool f2 : 1;
211f4a2713aSLionel Sambuc };
212f4a2713aSLionel Sambuc
213f4a2713aSLionel Sambuc struct s5 g5 = { 0xdeadbeef, 0xdeadbeef };
214f4a2713aSLionel Sambuc
f5_load(struct s5 * a0)215f4a2713aSLionel Sambuc int f5_load(struct s5 *a0) {
216f4a2713aSLionel Sambuc return a0->f0 ^ a0->f1;
217f4a2713aSLionel Sambuc }
f5_store(struct s5 * a0)218f4a2713aSLionel Sambuc int f5_store(struct s5 *a0) {
219f4a2713aSLionel Sambuc return (a0->f0 = 0xF) ^ (a0->f1 = 0xF) ^ (a0->f2 = 0xF);
220f4a2713aSLionel Sambuc }
f5_reload(struct s5 * a0)221f4a2713aSLionel Sambuc int f5_reload(struct s5 *a0) {
222f4a2713aSLionel Sambuc return (a0->f0 += 0xF) ^ (a0->f1 += 0xF) ^ (a0->f2 += 0xF);
223f4a2713aSLionel Sambuc }
224f4a2713aSLionel Sambuc
225f4a2713aSLionel Sambuc // CHECK-OPT-LABEL: define i64 @test_5()
226f4a2713aSLionel Sambuc // CHECK-OPT: ret i64 2
227f4a2713aSLionel Sambuc // CHECK-OPT: }
test_5()228f4a2713aSLionel Sambuc unsigned long long test_5() {
229f4a2713aSLionel Sambuc struct s5 g5 = { 0xdeadbeef, 0xdeadbeef, 0xdeadbeef };
230f4a2713aSLionel Sambuc unsigned long long res = 0;
231f4a2713aSLionel Sambuc res ^= g5.f0 ^ g5.f1 ^ g5.f2;
232f4a2713aSLionel Sambuc res ^= f5_load(&g5) ^ f5_store(&g5) ^ f5_reload(&g5);
233f4a2713aSLionel Sambuc res ^= g5.f0 ^ g5.f1 ^ g5.f2;
234f4a2713aSLionel Sambuc return res;
235f4a2713aSLionel Sambuc }
236f4a2713aSLionel Sambuc
237f4a2713aSLionel Sambuc /***/
238f4a2713aSLionel Sambuc
239f4a2713aSLionel Sambuc struct s6 {
240f4a2713aSLionel Sambuc _Bool f0 : 2;
241f4a2713aSLionel Sambuc };
242f4a2713aSLionel Sambuc
243f4a2713aSLionel Sambuc struct s6 g6 = { 0xF };
244f4a2713aSLionel Sambuc
f6_load(struct s6 * a0)245f4a2713aSLionel Sambuc int f6_load(struct s6 *a0) {
246f4a2713aSLionel Sambuc return a0->f0;
247f4a2713aSLionel Sambuc }
f6_store(struct s6 * a0)248f4a2713aSLionel Sambuc int f6_store(struct s6 *a0) {
249f4a2713aSLionel Sambuc return a0->f0 = 0x0;
250f4a2713aSLionel Sambuc }
f6_reload(struct s6 * a0)251f4a2713aSLionel Sambuc int f6_reload(struct s6 *a0) {
252f4a2713aSLionel Sambuc return (a0->f0 += 0xF);
253f4a2713aSLionel Sambuc }
254f4a2713aSLionel Sambuc
255f4a2713aSLionel Sambuc // CHECK-OPT-LABEL: define zeroext i1 @test_6()
256f4a2713aSLionel Sambuc // CHECK-OPT: ret i1 true
257f4a2713aSLionel Sambuc // CHECK-OPT: }
test_6()258f4a2713aSLionel Sambuc _Bool test_6() {
259f4a2713aSLionel Sambuc struct s6 g6 = { 0xF };
260f4a2713aSLionel Sambuc unsigned long long res = 0;
261f4a2713aSLionel Sambuc res ^= g6.f0;
262f4a2713aSLionel Sambuc res ^= f6_load(&g6);
263f4a2713aSLionel Sambuc res ^= g6.f0;
264f4a2713aSLionel Sambuc return res;
265f4a2713aSLionel Sambuc }
266f4a2713aSLionel Sambuc
267f4a2713aSLionel Sambuc /***/
268f4a2713aSLionel Sambuc
269f4a2713aSLionel Sambuc // Check that we compute the best alignment possible for each access.
270f4a2713aSLionel Sambuc //
271f4a2713aSLionel Sambuc // CHECK-RECORD: *** Dumping IRgen Record Layout
272f4a2713aSLionel Sambuc // CHECK-RECORD: Record: RecordDecl{{.*}}s7
273f4a2713aSLionel Sambuc // CHECK-RECORD: Layout: <CGRecordLayout
274*0a6a1f1dSLionel Sambuc // CHECK-RECORD: LLVMType:%struct.s7 = type { i32, i32, i32, i8, i32, [12 x i8] }
275f4a2713aSLionel Sambuc // CHECK-RECORD: IsZeroInitializable:1
276f4a2713aSLionel Sambuc // CHECK-RECORD: BitFields:[
277f4a2713aSLionel Sambuc // CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:5 IsSigned:1 StorageSize:8 StorageAlignment:4>
278f4a2713aSLionel Sambuc // CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:29 IsSigned:1 StorageSize:32 StorageAlignment:16>
279f4a2713aSLionel Sambuc
280f4a2713aSLionel Sambuc struct __attribute__((aligned(16))) s7 {
281f4a2713aSLionel Sambuc int a, b, c;
282f4a2713aSLionel Sambuc int f0 : 5;
283f4a2713aSLionel Sambuc int f1 : 29;
284f4a2713aSLionel Sambuc };
285f4a2713aSLionel Sambuc
f7_load(struct s7 * a0)286f4a2713aSLionel Sambuc int f7_load(struct s7 *a0) {
287f4a2713aSLionel Sambuc return a0->f0;
288f4a2713aSLionel Sambuc }
289f4a2713aSLionel Sambuc
290f4a2713aSLionel Sambuc /***/
291f4a2713aSLionel Sambuc
292f4a2713aSLionel Sambuc // This is a case where we narrow the access width immediately.
293f4a2713aSLionel Sambuc
294f4a2713aSLionel Sambuc struct __attribute__((packed)) s8 {
295f4a2713aSLionel Sambuc char f0 : 4;
296f4a2713aSLionel Sambuc char f1;
297f4a2713aSLionel Sambuc int f2 : 4;
298f4a2713aSLionel Sambuc char f3 : 4;
299f4a2713aSLionel Sambuc };
300f4a2713aSLionel Sambuc
301f4a2713aSLionel Sambuc struct s8 g8 = { 0xF };
302f4a2713aSLionel Sambuc
f8_load(struct s8 * a0)303f4a2713aSLionel Sambuc int f8_load(struct s8 *a0) {
304f4a2713aSLionel Sambuc return a0->f0 ^ a0 ->f2 ^ a0->f3;
305f4a2713aSLionel Sambuc }
f8_store(struct s8 * a0)306f4a2713aSLionel Sambuc int f8_store(struct s8 *a0) {
307f4a2713aSLionel Sambuc return (a0->f0 = 0xFD) ^ (a0->f2 = 0xFD) ^ (a0->f3 = 0xFD);
308f4a2713aSLionel Sambuc }
f8_reload(struct s8 * a0)309f4a2713aSLionel Sambuc int f8_reload(struct s8 *a0) {
310f4a2713aSLionel Sambuc return (a0->f0 += 0xFD) ^ (a0->f2 += 0xFD) ^ (a0->f3 += 0xFD);
311f4a2713aSLionel Sambuc }
312f4a2713aSLionel Sambuc
313f4a2713aSLionel Sambuc // CHECK-OPT-LABEL: define i32 @test_8()
314f4a2713aSLionel Sambuc // CHECK-OPT: ret i32 -3
315f4a2713aSLionel Sambuc // CHECK-OPT: }
test_8()316f4a2713aSLionel Sambuc unsigned test_8() {
317f4a2713aSLionel Sambuc struct s8 g8 = { 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef };
318f4a2713aSLionel Sambuc unsigned long long res = 0;
319f4a2713aSLionel Sambuc res ^= g8.f0 ^ g8.f2 ^ g8.f3;
320f4a2713aSLionel Sambuc res ^= f8_load(&g8) ^ f8_store(&g8) ^ f8_reload(&g8);
321f4a2713aSLionel Sambuc res ^= g8.f0 ^ g8.f2 ^ g8.f3;
322f4a2713aSLionel Sambuc return res;
323f4a2713aSLionel Sambuc }
324f4a2713aSLionel Sambuc
325f4a2713aSLionel Sambuc /***/
326f4a2713aSLionel Sambuc
327f4a2713aSLionel Sambuc // This is another case where we narrow the access width immediately.
328f4a2713aSLionel Sambuc //
329f4a2713aSLionel Sambuc // <rdar://problem/7893760>
330f4a2713aSLionel Sambuc
331f4a2713aSLionel Sambuc struct __attribute__((packed)) s9 {
332f4a2713aSLionel Sambuc unsigned f0 : 7;
333f4a2713aSLionel Sambuc unsigned f1 : 7;
334f4a2713aSLionel Sambuc unsigned f2 : 7;
335f4a2713aSLionel Sambuc unsigned f3 : 7;
336f4a2713aSLionel Sambuc unsigned f4 : 7;
337f4a2713aSLionel Sambuc unsigned f5 : 7;
338f4a2713aSLionel Sambuc unsigned f6 : 7;
339f4a2713aSLionel Sambuc unsigned f7 : 7;
340f4a2713aSLionel Sambuc };
341f4a2713aSLionel Sambuc
f9_load(struct s9 * a0)342f4a2713aSLionel Sambuc int f9_load(struct s9 *a0) {
343f4a2713aSLionel Sambuc return a0->f7;
344f4a2713aSLionel Sambuc }
345