| 1 |
/* The bitfield type (int) may be shared, but slices are not de-duplicated. |
| 2 |
|
| 3 |
In this testcase, it is expected to see a total of 6 CTF slices and 2 CTF |
| 4 |
integer types for the bitfields - unsigned long long and signed long long. |
| 5 |
|
| 6 |
cts_offset is the offset of the bitfield into a machine word. |
| 7 |
TBD - hardcoding cts_offset checks into the testcase will cause it to break |
| 8 |
across targets with different BIT_PER_WORD. Is there a way to add |
| 9 |
cts_offset related checks in the testcase? */ |
| 10 |
|
| 11 |
/* { dg-do compile } */ |
| 12 |
/* { dg-options "-O0 -gctf -dA" } */ |
| 13 |
|
| 14 |
/* { dg-final { scan-assembler-times "\[\t \]0x6\[\t \]+\[^\n\]*cts_type" 3 } } */ |
| 15 |
/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cts_type" 3 } } */ |
| 16 |
|
| 17 |
/* { dg-final { scan-assembler-times "\[\t \]0xf\[\t \]+\[^\n\]*cts_bits" 2 } } */ |
| 18 |
/* { dg-final { scan-assembler-times "\[\t \]0x21\[\t \]+\[^\n\]*cts_bits" 2 } } */ |
| 19 |
/* { dg-final { scan-assembler-times "\[\t \]0x10\[\t \]+\[^\n\]*cts_bits" 2 } } */ |
| 20 |
|
| 21 |
/* { dg-final { scan-assembler-times "ascii \"long long unsigned int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ |
| 22 |
/* { dg-final { scan-assembler-times "ascii \"long long int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ |
| 23 |
|
| 24 |
struct fields |
| 25 |
{ |
| 26 |
unsigned long long u1 : 15; |
| 27 |
unsigned long long u2 : 33; |
| 28 |
unsigned long long u3 : 16; |
| 29 |
signed long long s1 : 15; |
| 30 |
signed long long s2 : 33; |
| 31 |
signed long long s3 : 16; |
| 32 |
} flags; |
| 33 |
|
| 34 |
int i = 33; |
| 35 |
|
| 36 |
int main () |
| 37 |
{ |
| 38 |
return flags.u1 + i; |
| 39 |
} |