(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
popcount4ll.c
       1  /* { dg-do compile } */
       2  /* { dg-require-effective-target popcountll } */
       3  /* { dg-options "-O2 -fdump-tree-optimized" } */
       4  
       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;
      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      return (x * h01) >> shift;
      17  }
      18  
      19  /* { dg-final { scan-tree-dump-times "\.POPCOUNT" 1 "optimized" { target { lp64 } } } } */
      20  /* { dg-final { scan-tree-dump-times "\.POPCOUNT" 2 "optimized" { target { ! lp64 } } } } */