1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3
4 int test_and4(unsigned int a)
5 {
6 return __builtin_popcount(a&4);
7 }
8
9 int test_and4l(unsigned long b)
10 {
11 return __builtin_popcountl(b&4);
12 }
13
14 int test_and4ll(unsigned long long c)
15 {
16 return __builtin_popcountll(c&4);
17 }
18
19 int test_shift(unsigned int d)
20 {
21 int bits = 8*sizeof(unsigned int)-1;
22 return __builtin_popcount(d<<31);
23 }
24
25 int test_shiftl(unsigned long e)
26 {
27 int bits = 8*sizeof(unsigned long)-1;
28 return __builtin_popcountl(e<<bits);
29 }
30
31 int test_shiftll(unsigned long long f)
32 {
33 int bits = 8*sizeof(unsigned long long)-1;
34 return __builtin_popcountll(f<<bits);
35 }
36
37 /* { dg-final { scan-tree-dump-times "popcount" 0 "optimized" } } */
38