Re: [PATCH -v2] x86/hweight: Get rid of the special calling convention

From: H. Peter Anvin
Date: Thu May 12 2016 - 00:56:09 EST


On May 11, 2016 4:24:09 AM PDT, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>On Wed, May 11, 2016 at 07:15:19AM -0400, Brian Gerst wrote:
>
>> I think he meant the out of line version would be asm, so you could
>> control what registers were clobbered.
>
>Yeah, it might save a few cycles on the call, but given that most
>machines should have popcnt these days is it worth the hassle/cost of
>duplicating the lib/hweight.c magic in asm (and remember, twice, once
>for 32bit and once for 64bit) ?

I was thinking it isn't really very complex code even in assembly as it is super-regular; you can even crib the gcc-generated code if you wish.
--
Sent from my Android device with K-9 Mail. Please excuse brevity and formatting.