Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/popcount2.c

raw
1 /* { dg-do run } */
2 /* { dg-require-effective-target popcountl } */
3 /* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
4
5 int
6 __attribute__ ((noinline, noclone))
7 foo (long b)
8 {
9 int c = 0;
10
11 while (b) {
12 b &= b - 1;
13 c++;
14 }
15 return c;
16 }
17
18 int main()
19 {
20 if (foo (7) != 3)
21 __builtin_abort ();
22 if (foo (0) != 0)
23 __builtin_abort ();
24 if (foo (0xff) != 8)
25 __builtin_abort ();
26 return 0;
27 }
28
29 /* { dg-final { scan-tree-dump-times "__builtin_popcount|\\.POPCOUNT" 1 "optimized" } } */