]>
Commit | Line | Data |
---|---|---|
a4aca1ed HPN |
1 | /* { dg-do compile } */ |
2 | /* { dg-require-effective-target size32plus } */ | |
3 | /* { dg-options "-fdump-rtl-final -O2" } */ | |
8d268d75 | 4 | /* { dg-additional-options "-DALIGN_VAR" { target { ! non_strict_align } } } */ |
a4aca1ed HPN |
5 | |
6 | /* Assignments to a whole struct of suitable size (32 bytes) must not be | |
7 | picked apart into field accesses. */ | |
8 | ||
9 | typedef struct { | |
10 | unsigned int f0 : 4; | |
11 | unsigned int f1 : 11; | |
12 | unsigned int f2 : 10; | |
13 | unsigned int f3 : 7; | |
14 | } t0; | |
15 | ||
8d268d75 TV |
16 | static t0 a0[] |
17 | #ifdef ALIGN_VAR | |
18 | __attribute__((aligned (4))) | |
19 | #endif | |
20 | = { | |
a4aca1ed HPN |
21 | { .f0 = 7, .f1 = 99, .f3 = 1, }, |
22 | { .f0 = 7, .f1 = 251, .f3 = 1, }, | |
23 | { .f0 = 8, .f1 = 127, .f3 = 5, }, | |
24 | { .f0 = 5, .f1 = 1, .f3 = 1, }, | |
25 | { .f0 = 5, .f1 = 1, .f3 = 1, }, | |
26 | { .f0 = 5, .f1 = 1, .f3 = 1, }, | |
27 | }; | |
28 | ||
29 | void | |
30 | foo(void) | |
31 | { | |
32 | __SIZE_TYPE__ i; | |
33 | __SIZE_TYPE__ base = 0x000a0000; | |
34 | for (i = 0; i < (sizeof (a0) / sizeof ((a0)[0])); i++) { | |
35 | *(volatile t0 *) (base + 44 + i * 4) = a0[i]; | |
36 | } | |
37 | } | |
38 | ||
39 | /* The only volatile accesses should be the obvious writes. */ | |
8d268d75 TV |
40 | /* { dg-final { scan-rtl-dump-times {\(mem/v} 6 "final" } } */ |
41 | /* { dg-final { scan-rtl-dump-times {\(set \(mem/v} 6 "final" } } */ |