On Tue, Jan 14, 2020 at 1:37 PM Vineet Gupta <Vineet.Gupta1@xxxxxxxxxxxx> wrote: > > On 1/14/20 12:42 PM, Arnd Bergmann wrote: > > > > What's wrong with the generic version on little-endian? Any > > chance you can find a way to make it work as well for you as > > this copy? > > find_zero() by default doesn't use pop count instructions. Don't you think the generic find_zero() is likely just as fast as the pop count instruction? On 32-bit, I think it's like a shift and a mask and a couple of additions. The 64-bit case has a multiply that is likely expensive unless you have a good multiplication unit (but what 64-bit architecture doesn't?), but the generic 32-bit LE code should already be pretty close to optimal, and it might not be worth it to worry about it. (The big-endian case is very different, and architectures really can do much better. But LE allows for bit tricks using the carry chain) Linus