Debian Codegraph @

gcc/testsuite/gcc.target/mips/octeon-bbit-3.c

raw
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 void foo (bitfield_t*);
35
36 bitfield_t bar;
37
38 NOMIPS16 void
39 f ()
40 {
41 foo(&bar);
42 if (bar.a != 0x1)
43 abort ();
44 else if (!bar.c)
45 abort1 ();
46 else
47 exit (0);
48 }