From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752483AbcHHSzd (ORCPT ); Mon, 8 Aug 2016 14:55:33 -0400 Received: from mail.skyhub.de ([78.46.96.112]:54427 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752132AbcHHSz2 (ORCPT ); Mon, 8 Aug 2016 14:55:28 -0400 Date: Mon, 8 Aug 2016 20:55:09 +0200 From: Borislav Petkov To: Linus Torvalds Cc: Ville =?utf-8?B?U3lyasOkbMOk?= , Linux Kernel Mailing List , the arch/x86 maintainers , Borislav Petkov , "H . Peter Anvin" , Andy Lutomirski , Brian Gerst , Denys Vlasenko , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Jiri Kosina Subject: Re: [PATCH] x86/hweight: Don't clobber %rdi Message-ID: <20160808185509.GG511@nazgul.tnic> References: <1470677729-10561-1-git-send-email-ville.syrjala@linux.intel.com> <20160808180430.GE511@nazgul.tnic> <20160808183726.GA22641@nazgul.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. --