From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754152AbcEPRGa (ORCPT ); Mon, 16 May 2016 13:06:30 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:41097 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753704AbcEPRG2 (ORCPT ); Mon, 16 May 2016 13:06:28 -0400 Date: Mon, 16 May 2016 19:06:08 +0200 From: Peter Zijlstra To: Zhaoxiu Zeng Cc: linux-kernel@vger.kernel.org, bp@suse.de, gnomes@lxorguk.ukuu.org.uk, andi@firstfloor.org, dvyukov@google.com, Zhaoxiu Zeng , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Denys Vlasenko Subject: Re: [patch V4 09/31] bitops: Add x86-specific parity functions Message-ID: <20160516170608.GV3192@twins.programming.kicks-ass.net> References: <1462955158-28394-1-git-send-email-zengzhaoxiu@163.com> <1462958205-24890-1-git-send-email-zengzhaoxiu@163.com> <20160511093139.GA3206@twins.programming.kicks-ass.net> <08232c92-c3ab-9f3e-7c04-a815b04993db@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <08232c92-c3ab-9f3e-7c04-a815b04993db@163.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 16, 2016 at 11:49:05PM +0800, Zhaoxiu Zeng wrote: > On 2016/5/11 17:31, Peter Zijlstra wrote: > > Please use the GEN_*_RMWcc() stuff to avoid the setpo where possible. > > Setpo is better. > In most cases, we need to store the parity, or compare it with other variables. > > For example, in drivers/net/ethernet/broadcom/tg3.c, > > static int tg3_test_nvram(struct tg3 *tp) > { > ...... > if (parity8(data[i]) == !!parity[i]) > goto out; > ...... > } > > If use GEN_BINARY_RMWcc stuff, > > static inline unsigned int __arch_parity8(unsigned int w) > { > GEN_BINARY_RMWcc("testb", w, "er", 0xff, "%0", "po"); > } blergh; GCC does indeed make a mess of that. It looks we'll need the cc-output stuff for this in order for GCC to generates sane code for that :/