]> git.ipfire.org Git - thirdparty/gcc.git/blame - 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
CommitLineData
144aee70 1/* PR tree-optimization/94800 */
5b43f6ac 2/* { dg-do compile } */
144aee70
JJ
3/* { dg-require-effective-target popcountll } */
4/* { dg-options "-O2 -fdump-tree-optimized" } */
5
6const unsigned long long m1 = 0x5555555555555555ULL;
7const unsigned long long m2 = 0x3333333333333333ULL;
8const unsigned long long m4 = 0x0F0F0F0F0F0F0F0FULL;
9const int shift = 56;
10
11int 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
5b43f6ac
JR
22/* { dg-final { scan-tree-dump-times "\.POPCOUNT" 1 "optimized" { target { lp64 } } } } */
23/* { dg-final { scan-tree-dump-times "\.POPCOUNT" 2 "optimized" { target { ! lp64 } } } } */