Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/gcc.dg/tree-ssa/popcount4.c @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 1830386684a0 |
children |
line wrap: on
line source
/* { dg-do compile } */ /* { dg-require-effective-target popcount } */ /* { dg-require-effective-target int32plus } */ /* { dg-options "-O2 -fdump-tree-optimized" } */ const unsigned m1 = 0x55555555UL; const unsigned m2 = 0x33333333UL; const unsigned m4 = 0x0F0F0F0FUL; const unsigned h01 = 0x01010101UL; const int shift = 24; int popcount64c(unsigned x) { x -= (x >> 1) & m1; x = (x & m2) + ((x >> 2) & m2); x = (x + (x >> 4)) & m4; return (x * h01) >> shift; } /* { dg-final { scan-tree-dump-times "\.POPCOUNT" 1 "optimized" } } */