| 1 |
/* PR tree-optimization/46620 */ |
| 2 |
/* SRA bitfield grouping used to lose track at padding bitfields in |
| 3 |
the middle of a word. */ |
| 4 |
/* { dg-do run } */ |
| 5 |
/* { dg-options "-O2" } */ |
| 6 |
|
| 7 |
#include <stdlib.h> |
| 8 |
|
| 9 |
struct PCT |
| 10 |
{ |
| 11 |
unsigned char pi1 : 4; |
| 12 |
unsigned char pi2 : 3; |
| 13 |
unsigned char pif : 5; |
| 14 |
|
| 15 |
unsigned char sl : 2; |
| 16 |
unsigned char uc : 1; |
| 17 |
unsigned char st : 1; |
| 18 |
|
| 19 |
unsigned char p : 1; |
| 20 |
unsigned char cs : 1; |
| 21 |
unsigned char ss : 1; |
| 22 |
|
| 23 |
unsigned char pc : 3; |
| 24 |
unsigned char dmv : 4; |
| 25 |
unsigned char cv : 4; |
| 26 |
}; |
| 27 |
|
| 28 |
struct rt |
| 29 |
{ |
| 30 |
struct rt* d; |
| 31 |
void (*edo)(void * const); |
| 32 |
short lId; |
| 33 |
char dac; |
| 34 |
}; |
| 35 |
|
| 36 |
struct pedr |
| 37 |
{ |
| 38 |
struct rt re; |
| 39 |
struct PCT pc; |
| 40 |
unsigned char mid; |
| 41 |
} ; |
| 42 |
|
| 43 |
void __attribute__((__noinline__)) |
| 44 |
rei(struct rt* const me, unsigned short anId, void *ad ) |
| 45 |
{ |
| 46 |
asm volatile (""); |
| 47 |
} |
| 48 |
|
| 49 |
void __attribute__((__noinline__)) |
| 50 |
pedrdo(void * const p) |
| 51 |
{ |
| 52 |
asm volatile (""); |
| 53 |
} |
| 54 |
|
| 55 |
void __attribute__((__noinline__)) |
| 56 |
pedri (struct pedr* const me, struct PCT ppc, unsigned char pmid) |
| 57 |
{ |
| 58 |
rei(&(me->re), 0x7604, 0); |
| 59 |
me->pc = ppc; |
| 60 |
me->mid = pmid; |
| 61 |
(me)->re.edo = pedrdo; |
| 62 |
} |
| 63 |
|
| 64 |
int main() |
| 65 |
{ |
| 66 |
struct PCT ps; |
| 67 |
struct pedr pm; |
| 68 |
|
| 69 |
pm.pc.dmv = 0; |
| 70 |
ps.dmv = 1; |
| 71 |
pedri(&pm, ps, 32); |
| 72 |
|
| 73 |
if (pm.pc.dmv != 1) |
| 74 |
abort (); |
| 75 |
exit (0); |
| 76 |
} |