Debian Codegraph @

gcc/testsuite/gcc.target/pru/qbbs-1.c

raw
1 /* Test QBBS recognition */
2
3 /* { dg-do run } */
4 /* { dg-options "-O1" } */
5
6 /* -O1 in the options is significant. Without it bit-check-and-branch
7 operation may not be optimized to QBBS. */
8
9 extern void abort (void);
10
11 unsigned int
12 test_qbbs_reg (unsigned int a, unsigned int b, unsigned int val)
13 {
14 if (val & (1 << 19))
15 return a;
16 return b;
17 }
18
19 int
20 main (int argc, char** argv)
21 {
22 if (test_qbbs_reg (101, 505, (1u << 19)) != 101)
23 abort();
24 if (test_qbbs_reg (101, 505, (1u << 18)) != 505)
25 abort();
26
27 return 0;
28 }
29