From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michel =?ISO-8859-1?Q?D=E4nzer?= Subject: Re: [Patch v2 1/4] Replace i2f() in r600_blit.c with an optimized version. Date: Tue, 14 Aug 2012 12:33:29 +0200 Message-ID: <1344940409.17900.503.camel@thor.local> References: <1344706222-3018-1-git-send-email-svfuerst@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail.gna.ch (darkcity.gna.ch [195.226.6.51]) by gabe.freedesktop.org (Postfix) with ESMTP id 0038B9E844 for ; Tue, 14 Aug 2012 03:33:42 -0700 (PDT) In-Reply-To: <1344706222-3018-1-git-send-email-svfuerst@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Steven Fuerst Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Sam, 2012-08-11 at 10:30 -0700, Steven Fuerst wrote: = > We use __fls() to find the most significant bit. Using that, the > loop can be avoided. A second trick is to use the behaviour of the > rotate instructions to expand the range of the unsigned int to float > conversion to the full 32 bits in a branchless way. > = > The routine is now exact up to 2^24. Above that, we truncate which > is equivalent to rounding towards zero. > = > Signed-off-by: Steven Fuerst It might be better to reorder the series to use a shared int2float first and then optimize that. Either way though, although I haven't really looked into the floating point encoding aspects, the series is Reviewed-by: Michel D=E4nzer -- = Earthling Michel D=E4nzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer