Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp354687imu; Mon, 5 Nov 2018 01:56:11 -0800 (PST) X-Google-Smtp-Source: AJdET5eF1PrOv6N9aSuk5v4j+qDkZpOC0WbB6pcylhgm6yDXKstHHBaiNnmzLXRfvvQJ8yGlB7Wr X-Received: by 2002:a63:af18:: with SMTP id w24mr19677355pge.385.1541411771577; Mon, 05 Nov 2018 01:56:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541411771; cv=none; d=google.com; s=arc-20160816; b=XU+JeNgZ4+Uh9rX32rQMM3q4XSSnahg2EdYC+DskbtmJ/bt+uhsTVekCsOx82TDzgx Y2zA9pxk5gmPnTjK7gu6mFA4ya3LHkZFlVBtQ2pSH8M5xFRIG98QhGmCDO+G3kqNO9fp d+dAawpQMEW7XDquPZ79It6JTv3DRe9pV8mDnn5iBjWnXehxS4U4QS6tdaB/+dH/zB7+ P/nzMZf77LtMTPWK6zagGjI51ePmI6t/D8rv8QafB706T7Modo+rYr9bIRfp3XZYZzm6 2MexRK0zq6VpasXxQq50pb32N3n5x8ImC+FWiZYRkiamlTdW6fRv3ecBgPif5axREt2f z0qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=x2BIR0uEZ3b1e7Vek3XTZZvKsHLDlfmsDzj5Pu5Kuf4=; b=lU5bvIGMxqhrAZsY4h6Bf9mLSo8Mb3MKZu493c9zQU5YB/v8b7iMTV0UDoyg16sGwD IZKnEN6JdNV66Cu24YYpIx1LAK5mwR8pzujpREaeDXO1DvSuOeXkXFwck3i5SHcOOEju rvYtVoN/P+mXhTX6JvGvjt3jF+a31Habt4NCgTTnVsrl6EPKbxyLnm1mB271CROhns+R 7wy1w33Dzf0DAUFTdrX73v3xA05+izmThtka8Osb0xRLtuN7Okzjk8yuHT1h94oEHUJM MhXWLRFu0u6mVevw9CcREXfwqMsaNqGmNaIi6X5iT/9TCUS090xxDzP8vrAKqEXyhx4k yAag== ARC-Authentication-Results: i=1; mx.google.com; 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 e7-v6si43138228pgn.82.2018.11.05.01.55.56; Mon, 05 Nov 2018 01:56:11 -0800 (PST) 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; 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 S1728928AbeKETOA (ORCPT + 99 others); Mon, 5 Nov 2018 14:14:00 -0500 Received: from terminus.zytor.com ([198.137.202.136]:56891 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726086AbeKETOA (ORCPT ); Mon, 5 Nov 2018 14:14:00 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id wA59stYv284424 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 5 Nov 2018 01:54:55 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id wA59stlo284421; Mon, 5 Nov 2018 01:54:55 -0800 Date: Mon, 5 Nov 2018 01:54:55 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Uros Bizjak Message-ID: Cc: hpa@zytor.com, bp@suse.de, linux-kernel@vger.kernel.org, mingo@kernel.org, mingo@redhat.com, tglx@linutronix.de, ubizjak@gmail.com Reply-To: mingo@redhat.com, tglx@linutronix.de, ubizjak@gmail.com, hpa@zytor.com, bp@suse.de, linux-kernel@vger.kernel.org, mingo@kernel.org In-Reply-To: <20181014202354.21281-1-ubizjak@gmail.com> References: <20181014202354.21281-1-ubizjak@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86: Use POPCNT mnemonics in arch_hweight.h Git-Commit-ID: 566b62a3676caed1f8c626e26066ff3ae3a38918 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=2.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q,FREEMAIL_FORGED_REPLYTO autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 566b62a3676caed1f8c626e26066ff3ae3a38918 Gitweb: https://git.kernel.org/tip/566b62a3676caed1f8c626e26066ff3ae3a38918 Author: Uros Bizjak AuthorDate: Sun, 14 Oct 2018 22:23:54 +0200 Committer: Borislav Petkov CommitDate: Mon, 5 Nov 2018 10:42:32 +0100 x86: Use POPCNT mnemonics in arch_hweight.h Recently, the minimum required version of binutils was changed to 2.20, which supports POPCNT instruction mnemonics. Replace the byte-wise specification of POPCNT with those proper mnemonics. [ bp: massage commit message and remove line breaks. ] Signed-off-by: Uros Bizjak Signed-off-by: Borislav Petkov CC: "H. Peter Anvin" CC: Ingo Molnar CC: Thomas Gleixner Link: http://lkml.kernel.org/r/20181014202354.21281-1-ubizjak@gmail.com --- arch/x86/include/asm/arch_hweight.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/arch_hweight.h b/arch/x86/include/asm/arch_hweight.h index 34a10b2d5b73..fc0693569f7a 100644 --- a/arch/x86/include/asm/arch_hweight.h +++ b/arch/x86/include/asm/arch_hweight.h @@ -5,15 +5,9 @@ #include #ifdef CONFIG_64BIT -/* popcnt %edi, %eax */ -#define POPCNT32 ".byte 0xf3,0x0f,0xb8,0xc7" -/* popcnt %rdi, %rax */ -#define POPCNT64 ".byte 0xf3,0x48,0x0f,0xb8,0xc7" #define REG_IN "D" #define REG_OUT "a" #else -/* popcnt %eax, %eax */ -#define POPCNT32 ".byte 0xf3,0x0f,0xb8,0xc0" #define REG_IN "a" #define REG_OUT "a" #endif @@ -24,7 +18,7 @@ static __always_inline unsigned int __arch_hweight32(unsigned int w) { unsigned int res; - asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT) + asm (ALTERNATIVE("call __sw_hweight32", "popcntl %1, %0", X86_FEATURE_POPCNT) : "="REG_OUT (res) : REG_IN (w)); @@ -52,7 +46,7 @@ static __always_inline unsigned long __arch_hweight64(__u64 w) { unsigned long res; - asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT) + asm (ALTERNATIVE("call __sw_hweight64", "popcntq %1, %0", X86_FEATURE_POPCNT) : "="REG_OUT (res) : REG_IN (w));