PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / popcount2.c
blob9096c6bee04e27b6ec7e23fb86bc6b9a3e1f4406
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
4 int
5 __attribute__ ((noinline, noclone))
6 foo (long b)
8 int c = 0;
10 while (b) {
11 b &= b - 1;
12 c++;
14 return c;
17 int main()
19 if (foo (7) != 3)
20 __builtin_abort ();
21 if (foo (0) != 0)
22 __builtin_abort ();
23 if (foo (0xff) != 8)
24 __builtin_abort ();
25 return 0;
28 /* { dg-final { scan-tree-dump-times "__builtin_popcount" 1 "optimized" } } */