On Feb 13, 2011, at 12:10 PM, Joerg Sonnenberger wrote: > On Sun, Feb 13, 2011 at 10:44:45AM -0800, Matt Thomas wrote: >> CountBitsInByte should be replaced by __builtin_popcount so that >> machines with a popcount instruction can use it. > > Which ones? There is no assembler version of popcount at the moment. > SPARC64 doesn't use it for ffs(), the AMD64 one has to be detected via > CPUID. The libgcc version is pretty bad. But code can use the popcount > family...
popcnt != clz alpha ev6 i386 has a sse2 popcnt power5 has a popcntb sparcv9 has one but none of the UltraSparc implement it. Also, use a count-leading instruction might be useful with a faster popcount.