From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752629AbbAYHfn (ORCPT ); Sun, 25 Jan 2015 02:35:43 -0500 Received: from shards.monkeyblade.net ([149.20.54.216]:60538 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752421AbbAYHfl (ORCPT ); Sun, 25 Jan 2015 02:35:41 -0500 Date: Sat, 24 Jan 2015 23:35:40 -0800 (PST) Message-Id: <20150124.233540.192666118515975126.davem@davemloft.net> To: linux@rasmusvillemoes.dk Cc: jcliburn@gmail.com, chris.snook@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] atheros/atlx: Simplify bit manipulations From: David Miller In-Reply-To: <1422011212-30095-1-git-send-email-linux@rasmusvillemoes.dk> References: <1422011212-30095-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: Mew version 6.5 on Emacs 24.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.7 (shards.monkeyblade.net [149.20.54.216]); Sat, 24 Jan 2015 23:35:41 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rasmus Villemoes Date: Fri, 23 Jan 2015 12:06:52 +0100 > The code 'if (foo & X) foo &= ~X;' is semantically equivalent to > simply 'foo &= ~X;', but gcc generates about four instructions for the > former, one for the latter. Similarly, if X consists of a single bit, > 'if (!(foo & X)) X |= X;' can be replaced by 'foo |= X;'. > > In the atl2 case, gcc does know how to merge the new adjacent > operations, so altogether this gives a nice little code size > reduction of about 80 bytes. > > Signed-off-by: Rasmus Villemoes I agree with the feedback given that these open-coded sequences should be replaced with the appropriate PCI helpers instead of edited further.