Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757454AbbEVWIV (ORCPT ); Fri, 22 May 2015 18:08:21 -0400 Received: from gate.crashing.org ([63.228.1.57]:44408 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756946AbbEVWIT (ORCPT ); Fri, 22 May 2015 18:08:19 -0400 Date: Fri, 22 May 2015 16:39:56 -0500 From: Segher Boessenkool To: Scott Wood Cc: David Laight , "linux-kernel@vger.kernel.org" , Paul Mackerras , "linuxppc-dev@lists.ozlabs.org" Subject: Re: [PATCH v3 2/2] powerpc: add support for csum_add() Message-ID: <20150522213956.GC7305@gate.crashing.org> References: <1d1362c8aa696e316d3ba97dce2342df6f6ee6cf.1432047904.git.christophe.leroy@c-s.fr> <063D6719AE5E284EB5DD2968C1650D6D1CB3D471@AcuExch.aculab.com> <1432323162.27761.274.camel@freescale.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1432323162.27761.274.camel@freescale.com> User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 919 Lines: 27 On Fri, May 22, 2015 at 02:32:42PM -0500, Scott Wood wrote: > > I'd also have thought that the 64bit C version above would be generally 'good'. > > It doesn't generate the addc/addze sequence. At least with GCC 4.8.2, > it does something like: > > mr tmp0, csum > li tmp1, 0 > li tmp2, 0 > addc tmp3, addend, tmp0 > adde csum, tmp2, tmp1 > add csum, csum, tmp3 Right. Don't expect older compilers to do sane things here. All this begs a question... If it is worth spending so much time micro-optimising this, why not pick the low-hanging fruit first? Having a 32-bit accumulator for ones' complement sums, on a 64-bit system, is not such a great idea. Segher -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/