1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 int test_and4(unsigned int a
)
6 return __builtin_popcount(a
&4);
9 int test_and4l(unsigned long b
)
11 return __builtin_popcountl(b
&4);
14 int test_and4ll(unsigned long long c
)
16 return __builtin_popcountll(c
&4);
19 int test_shift(unsigned int d
)
21 int bits
= 8*sizeof(unsigned int)-1;
22 return __builtin_popcount(d
<<31);
25 int test_shiftl(unsigned long e
)
27 int bits
= 8*sizeof(unsigned long)-1;
28 return __builtin_popcountl(e
<<bits
);
31 int test_shiftll(unsigned long long f
)
33 int bits
= 8*sizeof(unsigned long long)-1;
34 return __builtin_popcountll(f
<<bits
);
37 /* { dg-final { scan-tree-dump-times "popcount" 0 "optimized" } } */