| 1 |
/* { dg-do run { target aarch64*-*-* } } */ |
| 2 |
/* { dg-options "-O2 --save-temps -fno-inline" } */ |
| 3 |
/* { dg-require-effective-target aarch64_big_endian } */ |
| 4 |
|
| 5 |
extern void abort (void); |
| 6 |
|
| 7 |
typedef struct bitfield |
| 8 |
{ |
| 9 |
unsigned short eight1: 8; |
| 10 |
unsigned short four: 4; |
| 11 |
unsigned short eight2: 8; |
| 12 |
unsigned short seven: 7; |
| 13 |
unsigned int sixteen: 16; |
| 14 |
unsigned short eight3: 8; |
| 15 |
unsigned short eight4: 8; |
| 16 |
} bitfield; |
| 17 |
|
| 18 |
bitfield |
| 19 |
bfxil (bitfield a) |
| 20 |
{ |
| 21 |
/* { dg-final { scan-assembler "bfxil\tx\[0-9\]+, x\[0-9\]+, 40, 8" } } */ |
| 22 |
a.eight4 = a.eight2; |
| 23 |
return a; |
| 24 |
} |
| 25 |
|
| 26 |
int |
| 27 |
main (void) |
| 28 |
{ |
| 29 |
static bitfield a; |
| 30 |
bitfield b; |
| 31 |
|
| 32 |
a.eight4 = 9; |
| 33 |
a.eight2 = 57; |
| 34 |
b = bfxil (a); |
| 35 |
|
| 36 |
if (b.eight4 != a.eight2) |
| 37 |
abort (); |
| 38 |
|
| 39 |
return 0; |
| 40 |
} |
| 41 |
|