Debian Codegraph @

gcc/testsuite/gcc.dg/fold-popcount-8.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3
4 int foo1(unsigned int x, unsigned int y)
5 {
6 return __builtin_popcount (x&y) + __builtin_popcount (x|y);
7 }
8
9 int foo2(unsigned int x, unsigned int y)
10 {
11 return __builtin_popcount (x&y) + __builtin_popcount (y|x);
12 }
13
14 int foo3(unsigned int x, unsigned int y)
15 {
16 return __builtin_popcount (x|y) + __builtin_popcount (x&y);
17 }
18
19 int foo4(unsigned int x, unsigned int y)
20 {
21 return __builtin_popcount (x|y) + __builtin_popcount (y&x);
22 }
23
24 /* { dg-final { scan-tree-dump-not " & " "optimized" } } */
25 /* { dg-final { scan-tree-dump-not " \\| " "optimized" } } */