]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/tree-ssa/popcount5ll.c
Fix profile update in tree_transform_and_unroll_loop
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / popcount5ll.c
1 /* PR tree-optimization/94800 */
2 /* { dg-do compile } */
3 /* { dg-require-effective-target popcountll } */
4 /* { dg-options "-O2 -fdump-tree-optimized" } */
5
6 const unsigned long long m1 = 0x5555555555555555ULL;
7 const unsigned long long m2 = 0x3333333333333333ULL;
8 const unsigned long long m4 = 0x0F0F0F0F0F0F0F0FULL;
9 const int shift = 56;
10
11 int popcount64c(unsigned long long x)
12 {
13 x -= (x >> 1) & m1;
14 x = (x & m2) + ((x >> 2) & m2);
15 x = (x + (x >> 4)) & m4;
16 x += (x << 8);
17 x += (x << 16);
18 x += (x << 32);
19 return x >> shift;
20 }
21
22 /* { dg-final { scan-tree-dump-times "\.POPCOUNT" 1 "optimized" { target { lp64 } } } } */
23 /* { dg-final { scan-tree-dump-times "\.POPCOUNT" 2 "optimized" { target { ! lp64 } } } } */