libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / popcount4ll.c
blob7abadf6df04fcc47405a4a611a1f9139f25cfc4b
1 /* { dg-do compile } */
2 /* { dg-require-effective-target popcountll } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
5 const unsigned long long m1 = 0x5555555555555555ULL;
6 const unsigned long long m2 = 0x3333333333333333ULL;
7 const unsigned long long m4 = 0x0F0F0F0F0F0F0F0FULL;
8 const unsigned long long h01 = 0x0101010101010101ULL;
9 const int shift = 56;
11 int popcount64c(unsigned long long x)
13 x -= (x >> 1) & m1;
14 x = (x & m2) + ((x >> 2) & m2);
15 x = (x + (x >> 4)) & m4;
16 return (x * h01) >> shift;
19 /* { dg-final { scan-tree-dump-times "\.POPCOUNT" 1 "optimized" { target { lp64 } } } } */
20 /* { dg-final { scan-tree-dump-times "\.POPCOUNT" 2 "optimized" { target { ! lp64 } } } } */