On Sun, Feb 13, 2011 at 02:11:30PM -0800, Matt Thomas wrote:
> 
> 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 

I didn't say they are the same. But clz can be implemented using
popcount.

> 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.

There is no implementation in src/common for either of this. I have the
code for i386/amd64 on my disk, but it would require adding another
library for little gain.

Joerg

Reply via email to