From: Tim Deegan Subject: Re: [PATCH] xen/arm64: Assembly optimized bitops from Linux Date: Wed, 5 Jun 2013 11:16:18 +0100 Message-ID: <20130605101618.GA42977@ocelot.phlegethon.org> References: <1370363007-29138-1-git-send-email-ian.campbell@citrix.com> <20130604172000.GB29202@ocelot.phlegethon.org> <1370423905.24512.148.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1370423905.24512.148.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: julien.grall@citrix.com, xen-devel@lists.xen.org, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org Hi, At 10:18 +0100 on 05 Jun (1370427505), Ian Campbell wrote: > On Tue, 2013-06-04 at 18:20 +0100, Tim Deegan wrote: > > At 17:23 +0100 on 04 Jun (1370366607), Ian Campbell wrote: > > > + and w3, w0, #31 // Get bit offset > > > + eor w0, w0, w3 // Clear low bits > > > > Not 'bic w0, w0, #31'? The EOR has a dependence on the previous > > instruction. (Ditto for testop below). > > Interesting question. > > The 32-bit version uses a right shift, which it then undoes by turning > the right shift in the following add into the appropriate left shift. That seems about equivalent to me (in as much as I have no idea of the relative costs of lsr and bic). > I'll put this to the Linux ARM guys but would prefer to keep the code in > sync (as far as possible) for now. Fair enough. > Your questioning this did cause me to look again and I think I was wrong > to change: > add x1, x1, x0, lsr #3 // Get word offset > into > add x1, x1, x0, lsr #2 // Get word offset > > The difference between 4-byte and 8-byte offsetting is already accounted > for in the masking. The #3 relates to the number of bits in a byte, not > the number of bytes in a word. Erk. Yes, that seems right. :) Tim.