linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: PowerTV: Use fls() carefully where static optim

To: Shinya Kuribayashi <skuribay@pobox.com>
Subject: Re: [PATCH] MIPS: PowerTV: Use fls() carefully where static optimization is required
From: David VomLehn <dvomlehn@cisco.com>
Date: Wed, 30 Jun 2010 10:48:20 -0700
Authentication-results: sj-iport-4.cisco.com; dkim=neutral (message not signed) header.i=none
Cc: linux-mips@linux-mips.org
In-reply-to: <4C2755A3.3080600@pobox.com>
References: <4C2755A3.3080600@pobox.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.18 (2008-05-17)
On Sun, Jun 27, 2010 at 08:44:03AM -0500, Shinya Kuribayashi wrote:
> fls()/__fls() defined at <asm/bitops.h>, doesn't use CLZ unless it's
> explicitly requested via <cpu-features-overrides.h>.  In other words,
> as long as depending on cpu_data[0].isa_level, CLZ is nerver used for
> fls()/__fls().
> 
> Looking at leftover clz() in asic_int.c, PowerTV used to use Malta's
> clz() and irq_ffs() as-is, then for some reason made a decision not to
> use clz().
> 
> It's MIPS32 machine and luckily clz() is left there, then let's go back
> to the original shape.
> 
> Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>
> ---
> 
>  Compile checked, and now CLZ is back.
> 
>  arch/mips/powertv/asic/asic_int.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/mips/powertv/asic/asic_int.c 
> b/arch/mips/powertv/asic/asic_int.c
> index 529c44a..e3c08a2 100644
> --- a/arch/mips/powertv/asic/asic_int.c
> +++ b/arch/mips/powertv/asic/asic_int.c
> @@ -86,7 +86,7 @@ static inline int clz(unsigned long x)
>   */
>  static inline unsigned int irq_ffs(unsigned int pending)
>  {
> -     return fls(pending) - 1 + CAUSEB_IP;
> +     return -clz(pending) + 31 - CAUSEB_IP;
>  }
>  
>  /*

Thanks, I'll try this out.

-- 
David VL

<Prev in Thread] Current Thread [Next in Thread>