[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xen/arm64: Assembly optimized bitops from Linux



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.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.