From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2B77C04E53 for ; Wed, 15 May 2019 10:15:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64AAF2084A for ; Wed, 15 May 2019 10:15:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726447AbfEOKPL convert rfc822-to-8bit (ORCPT ); Wed, 15 May 2019 06:15:11 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([146.101.78.151]:21146 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725953AbfEOKPL (ORCPT ); Wed, 15 May 2019 06:15:11 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-115-74n14Y4CMIeKYIVFWXZM2w-1; Wed, 15 May 2019 11:15:08 +0100 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Wed, 15 May 2019 11:15:07 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Wed, 15 May 2019 11:15:07 +0100 From: David Laight To: 'Will Deacon' , Robin Murphy CC: Zhangshaokun , Ard Biesheuvel , "linux-arm-kernel@lists.infradead.org" , "netdev@vger.kernel.org" , "ilias.apalodimas@linaro.org" , "huanglingyan (A)" , "steve.capper@arm.com" Subject: RE: [PATCH] arm64: do_csum: implement accelerated scalar version Thread-Topic: [PATCH] arm64: do_csum: implement accelerated scalar version Thread-Index: AQHVCwMrtYHa1Y0LVUWOb1uB691U/KZr90eg Date: Wed, 15 May 2019 10:15:07 +0000 Message-ID: <6e755b2daaf341128cb3b54f36172442@AcuMS.aculab.com> References: <20190218230842.11448-1-ard.biesheuvel@linaro.org> <20190412095243.GA27193@fuggles.cambridge.arm.com> <41b30c72-c1c5-14b2-b2e1-3507d552830d@arm.com> <20190515094704.GC24357@fuggles.cambridge.arm.com> In-Reply-To: <20190515094704.GC24357@fuggles.cambridge.arm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-MC-Unique: 74n14Y4CMIeKYIVFWXZM2w-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ... > > ptr = (u64 *)(buff - offset); > > shift = offset * 8; > > > > /* > > * Head: zero out any excess leading bytes. Shifting back by the same > > * amount should be at least as fast as any other way of handling the > > * odd/even alignment, and means we can ignore it until the very end. > > */ > > data = *ptr++; > > #ifdef __LITTLE_ENDIAN > > data = (data >> shift) << shift; > > #else > > data = (data << shift) >> shift; > > #endif I suspect that #ifdef __LITTLE_ENDIAN data &= ~0ull << shift; #else data &= ~0ull >> shift; #endif is likely to be better. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)