From: Tim Deegan Subject: Re: [PATCH 2/2] arm64: fix fls() Date: Thu, 22 Jan 2015 15:29:07 +0100 Message-ID: <20150122142907.GG97314@deinos.phlegethon.org> References: <54C108910200007800058233@mail.emea.novell.com> <54C10B7E0200007800058256@mail.emea.novell.com> <20150122140115.GF97314@deinos.phlegethon.org> <54C111A802000078000582E3@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YEIkx-0007Re-Bc for xen-devel@lists.xenproject.org; Thu, 22 Jan 2015 14:29:11 +0000 Content-Disposition: inline In-Reply-To: <54C111A802000078000582E3@mail.emea.novell.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: Jan Beulich Cc: Ian Campbell , xen-devel , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org At 14:05 +0000 on 22 Jan (1421931912), Jan Beulich wrote: > >>> On 22.01.15 at 15:01, wrote: > > At 13:38 +0000 on 22 Jan (1421930334), Jan Beulich wrote: > >> It using CLZ on a 64-bit register while specifying the input operand as > >> only 32 bits wide is wrong: An operand intentionally shrunk down to 32 > >> bits at the source level doesn't imply respective zero extension also > >> happens at the machine instruction level, and hence the wrong result > >> could get returned. > >> > >> Add suitable inline assembly abstraction so that the function can > >> remain shared between arm32 and arm64. > > > > Would casting the asm arguments to unsigned long DTRT withuot > > needing #ifdefs? > > The input one - yes, I think so. But it wouldn't be me to introduce > such (suspicious) casts, and I also think it is better to use 32-bit > instruction variants where possible (which quite certainly won't > perform worse than the 64-bit ones, but may perform better). Ah, I had misunderstood - I thought the new runes were just enforcing correct extension of the arguments. Using a 32-bit instruction does indeed sound better. Tim.