OSDN Git Service

gcc/testsuite/
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / mips / octeon-bbit-1.c
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -march=octeon" } */
3 /* { dg-final { scan-assembler-times "\tbbit1\t" 4 } } */
4 /* { dg-final { scan-assembler-times "\tbbit0\t" 2 } } */
5 /* { dg-final { scan-assembler-not "andi\t" } } */
6
7 NOMIPS16 void foo (void);
8
9 NOMIPS16 void
10 f1 (long long i)
11 {
12   if (i & 0x80)
13     foo ();
14 }
15
16 NOMIPS16 void
17 f2 (int i)
18 {
19   if (!(i & 0x80))
20     foo ();
21 }
22
23 NOMIPS16 void
24 f3 (int i)
25 {
26   if (i % 2)
27     foo ();
28 }
29
30 NOMIPS16 void
31 f4 (int i)
32 {
33   if (i & 1)
34     foo ();
35 }
36
37 NOMIPS16 void
38 f5 (long long i)
39 {
40   if ((i >> 3) & 1)
41     foo ();
42 }
43
44 unsigned long long r;
45
46 NOMIPS16 static inline __attribute__((always_inline)) int
47 test_bit(unsigned long long nr, const unsigned long long *addr)
48 {
49   return 1UL & (addr[nr >> 6] >> (nr & 63ULL));
50 }
51
52 NOMIPS16 void
53 f6 ()
54 {
55   if (!test_bit(0, &r))
56     foo ();
57 }