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