Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/popcount-max.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fno-tree-loop-optimize -fdump-tree-optimized" } */
3
4 #define PREC (__CHAR_BIT__)
5
6 __INT32_TYPE__ count1 (unsigned char b) {
7 int c = 0;
8
9 while (b) {
10 b &= b - 1;
11 c++;
12 }
13 if (c <= PREC)
14 return 0;
15 else
16 return 34567;
17 }
18
19 __INT32_TYPE__ count2 (unsigned char b) {
20 int c = 0;
21
22 while (b) {
23 b &= b - 1;
24 c++;
25 }
26 if (c <= PREC - 1)
27 return 0;
28 else
29 return 76543;
30 }
31
32 /* { dg-final { scan-tree-dump-times "34567" 0 "optimized" } } */
33 /* { dg-final { scan-tree-dump-times "76543" 1 "optimized" } } */