Debian Codegraph @

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

raw
1 /* { dg-do compile } */
2 /* { dg-options "-march=octeon" } */
3 /* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */
4 /* { dg-final { scan-assembler "\tbbit1\t" } } */
5 /* { dg-final { scan-assembler "\tbbit0\t" } } */
6 /* { dg-final { scan-assembler-times "\tbbit.\t" 6 } } */
7 /* { dg-final { scan-assembler-not "andi\t" } } */
8
9 NOMIPS16 void foo (void);
10
11 NOMIPS16 void
12 f1 (long long i)
13 {
14 if (i & 0x80)
15 foo ();
16 }
17
18 NOMIPS16 void
19 f2 (int i)
20 {
21 if (!(i & 0x80))
22 foo ();
23 }
24
25 /* f3 and f4 are equivalent and may be subject to ICF. The attribute
26 is supposed to prevent that. */
27 NOMIPS16 void __attribute__ ((noipa))
28 f3 (int i)
29 {
30 if (i % 2)
31 foo ();
32 }
33
34 NOMIPS16 void
35 f4 (int i)
36 {
37 if (i & 1)
38 foo ();
39 }
40
41 NOMIPS16 void
42 f5 (long long i)
43 {
44 if ((i >> 3) & 1)
45 foo ();
46 }
47
48 unsigned long long r;
49
50 NOMIPS16 static inline __attribute__((always_inline)) int
51 test_bit(unsigned long long nr, const unsigned long long *addr)
52 {
53 return 1UL & (addr[nr >> 6] >> (nr & 63ULL));
54 }
55
56 NOMIPS16 void
57 f6 ()
58 {
59 if (!test_bit(0, &r))
60 foo ();
61 }