1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3 /* { dg-require-effective-target int32plus } */
5 int test_and4(unsigned int a
)
7 return __builtin_popcount(a
&4);
10 int test_and4l(unsigned long b
)
12 return __builtin_popcountl(b
&4);
15 int test_and4ll(unsigned long long c
)
17 return __builtin_popcountll(c
&4);
20 int test_shift(unsigned int d
)
22 int bits
= 8*sizeof(unsigned int)-1;
23 return __builtin_popcount(d
<<31);
26 int test_shiftl(unsigned long e
)
28 int bits
= 8*sizeof(unsigned long)-1;
29 return __builtin_popcountl(e
<<bits
);
32 int test_shiftll(unsigned long long f
)
34 int bits
= 8*sizeof(unsigned long long)-1;
35 return __builtin_popcountll(f
<<bits
);
38 /* { dg-final { scan-tree-dump-times "popcount" 0 "optimized" } } */