From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH 2/2] arm64: fix fls() Date: Thu, 22 Jan 2015 14:05:12 +0000 Message-ID: <54C111A802000078000582E3@mail.emea.novell.com> References: <54C108910200007800058233@mail.emea.novell.com> <54C10B7E0200007800058256@mail.emea.novell.com> <20150122140115.GF97314@deinos.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YEINm-0005kq-4x for xen-devel@lists.xenproject.org; Thu, 22 Jan 2015 14:05:14 +0000 In-Reply-To: <20150122140115.GF97314@deinos.phlegethon.org> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: Ian Campbell , xen-devel , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org >>> 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). Jan