Re: [PATCH] x86/hweight: Don't clobber %rdi
From: Borislav Petkov
Date: Mon Aug 08 2016 - 14:55:35 EST
On Mon, Aug 08, 2016 at 11:45:58AM -0700, Linus Torvalds wrote:
> That would work (although the clobbered registers have a different
> syntax than the in/out registers), but it would be wrong, in my
> opinion.
>
> We want the actual POPCNT instruction to be the common case, and that
> instruction does *not* clobber any other registers than the output.
Ok, that's a good point. We would be punishing the common case.
> So I think it's much better to just say: "the __sw_hweight functions
> should have the same semantics as popcnt" (although without the eflags
> rules that we don't care about).
>
> There's nothing wrong with keeping it as assembly language - it's not
> like it's a maintenance headache once it is written.
Yap, makes a whole lotta sense to me.
Thanks!
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--