Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3207535ybi; Mon, 29 Jul 2019 02:46:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmRZmGiVzV1n5PjuU7/FMCNJYvjvm+tYdVNDs9XprC6Fx5uDE1yb4PgBGXB983Lqh9vRQu X-Received: by 2002:a62:2ad3:: with SMTP id q202mr36511621pfq.161.1564393606061; Mon, 29 Jul 2019 02:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564393606; cv=none; d=google.com; s=arc-20160816; b=ajhrKT/oLDZJwW49Z7DuP84mn9+VJERmF93JOTPGPG8+Vu9X53Xu9poEf4sTMfz5Fb asb8Vyau02ng3oQ2nL7cYYWItIXe4pjIQ/F2cUeTWSAQflaJGrjED2yCOYH2nFuItTwB wmyy3h4mclgPBVwwQ/hNv/13OuYAXWhDpGzlksd3a7lepJa+VqIxLPrltXEmn49nhqmH HXZtP+MjE33rqQKWvqfzJqi6R/jW5OoA1UYerT3CpmP7MuhFarDFvDf2QxWVpw2I5/0q dp6EY+gfa8FD52dtEXk06Isz9l3lkv7yQrTVQWvY/9wvlZ/ZJMpC2NVlA81FmRMhRvbQ wdBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=bVzta0BJYrJudw8AwRhFwUnSytnSHUT+J8mdnn5TxzU=; b=q66OcqzRnk0jvQ/snw7vHlLBIXo9XjLeiYZ8TWgyoHclXVyUSdkEHRPv+RrJCzskAm wylNyFE9wVT/KPPiXlwXJbm12lI+kGCiubyMNVZbl04yj+MdL55DpCewJQzwqzRNhh8E w8zQKR9OrofJ7kMQgn33k3u2gridu6s0ZuUP99BVPnGw90RileX3jRs4KiwSF+HUGsPE dqeOo8r3rHyamxyOWF+Zkq7xcM9j2NDHHDNfhKekPeLwYK9LOFJZ582dFvBQUqNx8AF/ Z6R2CZ2+NqLy69JzELDjTtZ4OzOYoQ7txB/npDARQsXmh5Wn474ahrdgC+0VoUf9UrRw 50fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=pPN6yXoC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si26450978plw.379.2019.07.29.02.46.30; Mon, 29 Jul 2019 02:46:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=pPN6yXoC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728103AbfG2Jnp (ORCPT + 99 others); Mon, 29 Jul 2019 05:43:45 -0400 Received: from merlin.infradead.org ([205.233.59.134]:44646 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728025AbfG2Jnm (ORCPT ); Mon, 29 Jul 2019 05:43:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=bVzta0BJYrJudw8AwRhFwUnSytnSHUT+J8mdnn5TxzU=; b=pPN6yXoC0TkroJbJB2/F6SDvM LTj+TZpnHQST8RlEOXcv1gNm7h2Nj9/bN0B9AYu7fOnbvMuzjT2Dm1Iewyx9cgZLtp1HT4mETjOeD QjPpa4+JmFskOFY7C4o7ZufxBIWbWcq6FIWOjBiBprxmnXr3JtWuL++kk6/X3tCGl0/F+8ubeeIuJ Qp6lqetBqzH13i81En8P31P7lWkc+gRSzHVDdCbf88khDvHZOxs98rWIOuDY4uLIL/82k28O9Rant sbyx+s2lCw18h+WQg3fhxxE49mp3TlUklVaFVKRyXuSVihs4WAAVYTDRwpxrKzahMo1GPwy35ZUhE HeIcZ8YPA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hs2Bn-00009C-UY; Mon, 29 Jul 2019 09:43:32 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 93F622025E7A9; Mon, 29 Jul 2019 11:43:29 +0200 (CEST) Date: Mon, 29 Jul 2019 11:43:29 +0200 From: Peter Zijlstra To: Alexey Dobriyan Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86: drop REG_OUT macro from hweight functions Message-ID: <20190729094329.GW31381@hirez.programming.kicks-ass.net> References: <20190728115140.GA32463@avx2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190728115140.GA32463@avx2> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 28, 2019 at 02:51:40PM +0300, Alexey Dobriyan wrote: > Output register is always RAX/EAX. > > Signed-off-by: Alexey Dobriyan > --- > > arch/x86/include/asm/arch_hweight.h | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > --- a/arch/x86/include/asm/arch_hweight.h > +++ b/arch/x86/include/asm/arch_hweight.h > @@ -6,10 +6,8 @@ > > #ifdef CONFIG_64BIT > #define REG_IN "D" > -#define REG_OUT "a" > #else > #define REG_IN "a" > -#define REG_OUT "a" > #endif > > static __always_inline unsigned int __arch_hweight32(unsigned int w) > @@ -17,7 +15,7 @@ static __always_inline unsigned int __arch_hweight32(unsigned int w) > unsigned int res; > > asm (ALTERNATIVE("call __sw_hweight32", "popcntl %1, %0", X86_FEATURE_POPCNT) > - : "="REG_OUT (res) > + : "=a" (res) > : REG_IN (w)); > > return res; > @@ -45,7 +43,7 @@ static __always_inline unsigned long __arch_hweight64(__u64 w) > unsigned long res; > > asm (ALTERNATIVE("call __sw_hweight64", "popcntq %1, %0", X86_FEATURE_POPCNT) > - : "="REG_OUT (res) > + : "=a" (res) > : REG_IN (w)); > > return res; I _think_ something like the below should also work: (fwiw _ASM_ARG 5 and 6 are broken, as are all the QLWB variants) --- diff --git a/arch/x86/include/asm/arch_hweight.h b/arch/x86/include/asm/arch_hweight.h index ba88edd0d58b..88704612b2f7 100644 --- a/arch/x86/include/asm/arch_hweight.h +++ b/arch/x86/include/asm/arch_hweight.h @@ -3,22 +3,15 @@ #define _ASM_X86_HWEIGHT_H #include - -#ifdef CONFIG_64BIT -#define REG_IN "D" -#define REG_OUT "a" -#else -#define REG_IN "a" -#define REG_OUT "a" -#endif +#include static __always_inline unsigned int __arch_hweight32(unsigned int w) { unsigned int res; asm (ALTERNATIVE("call __sw_hweight32", "popcntl %1, %0", X86_FEATURE_POPCNT) - : "="REG_OUT (res) - : REG_IN (w)); + : "=a" (res) + : _ASM_ARG1 (w)); return res; } @@ -45,8 +38,8 @@ static __always_inline unsigned long __arch_hweight64(__u64 w) unsigned long res; asm (ALTERNATIVE("call __sw_hweight64", "popcntq %1, %0", X86_FEATURE_POPCNT) - : "="REG_OUT (res) - : REG_IN (w)); + : "=a" (res) + : _ASM_ARG1 (w)); return res; }