7b73f43a1f45d55d6d908ebc861ae6f589e6d05d
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.target / mips / octeon-bbit-3.c
1 /* { dg-do compile } */
2
3 /* Force big-endian because for little-endian, combine generates this:
4
5  (if_then_else (ne (zero_extract:DI (subreg:DI (truncate:SI (reg:DI 196)) 0) 
6                  (const_int 1) 
7                  (const_int 0)) 
8              (const_int 0)) 
9          (label_ref 20) 
10          (pc))) 
11
12   which does not get recognized as a valid bbit pattern.  The
13   middle-end should be able to simplify this further.  */
14 /* { dg-options "-march=octeon -meb" } */
15 /* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */
16
17 /* { dg-final { scan-assembler-times "\tbbit\[01\]\t|\tbgez\t|\tbltz\t" 2 } } */
18 /* { dg-final { scan-assembler-not "ext\t" } } */
19
20 void abort (void);
21 void abort1 (void);
22 void exit (int);
23
24 typedef unsigned long long ulong64;
25
26 typedef struct bitfield_s {
27   ulong64 a:1;
28   ulong64 b:29;
29   ulong64 c:1;
30   ulong64 d:15;
31   ulong64 f:18;
32 } bitfield_t;
33
34 bitfield_t bar;
35
36 NOMIPS16 void
37 f ()
38 {
39   foo(&bar);
40   if (bar.a != 0x1)
41     abort ();
42   else if (!bar.c)
43     abort1 ();
44   else
45     exit (0);
46 }