| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-meb isa_rev>=2 -mgp64" } */ |
| 3 |
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */ |
| 4 |
/* { dg-final { scan-assembler-times "\tins\t|\tdins\t" 1 } } */ |
| 5 |
/* { dg-final { scan-assembler-times "\tsll\t|\tins\t" 1 } } */ |
| 6 |
|
| 7 |
/* When inserting something into the top bit of a 32-bit structure, |
| 8 |
we must make sure that the register remains properly sign-extended. |
| 9 |
There are two ways of doing this: |
| 10 |
|
| 11 |
- use purely 32-bit bit manipulations (a single INS, matched twice here). |
| 12 |
- use a 64-bit bit manipulation (DINS), and sign-extend the result. We |
| 13 |
check for this extension using SLL. */ |
| 14 |
|
| 15 |
struct s |
| 16 |
{ |
| 17 |
int a:3; |
| 18 |
int b:29; |
| 19 |
}; |
| 20 |
|
| 21 |
NOMIPS16 void |
| 22 |
f (int a) |
| 23 |
{ |
| 24 |
struct s s; |
| 25 |
asm volatile ("" : "=r"(s)); |
| 26 |
s.a = a; |
| 27 |
asm volatile ("" :: "r"(s)); |
| 28 |
} |