All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shinya Kuribayashi <skuribay@pobox.com>
To: dvomlehn@cisco.com
Cc: linux-mips@linux-mips.org
Subject: [PATCH] MIPS: PowerTV: Use fls() carefully where static optimization is required
Date: Sun, 27 Jun 2010 22:44:03 +0900	[thread overview]
Message-ID: <4C2755A3.3080600@pobox.com> (raw)

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;
 }
 
 /*
-- 
1.7.1

             reply	other threads:[~2010-06-27 13:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-27 13:44 Shinya Kuribayashi [this message]
2010-06-30 17:48 ` [PATCH] MIPS: PowerTV: Use fls() carefully where static optimization is required David VomLehn
2010-06-30 22:01 ` David VomLehn
2010-07-02 14:13   ` Shinya Kuribayashi
2010-07-02 21:32     ` David VomLehn
2010-07-03 14:31       ` Shinya Kuribayashi
2010-07-03 17:03         ` Maciej W. Rozycki
2010-07-05  0:33           ` Shinya Kuribayashi
2010-07-05 11:43             ` Ralf Baechle
2010-07-05 13:35             ` Maciej W. Rozycki
2010-07-06 11:17               ` Shinya Kuribayashi
2010-07-06  1:22         ` Ralf Baechle
2010-07-11 14:01     ` Shinya Kuribayashi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C2755A3.3080600@pobox.com \
    --to=skuribay@pobox.com \
    --cc=dvomlehn@cisco.com \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.