2014-04-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / mips / ins-2.c
blob916bc4b5e2dda3bae1dd5eeed1bf1f54273356cd
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 } } */
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:
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. */
15 struct s
17 int a:3;
18 int b:29;
21 NOMIPS16 void
22 f (int a)
24 struct s s;
25 asm volatile ("" : "=r"(s));
26 s.a = a;
27 asm volatile ("" :: "r"(s));