| To: | Shinya Kuribayashi <skuribay@pobox.com> |
|---|---|
| Subject: | Re: [PATCH] MIPS: PowerTV: Use fls() carefully where static optimization is required |
| From: | "Maciej W. Rozycki" <macro@linux-mips.org> |
| Date: | Sat, 3 Jul 2010 18:03:24 +0100 (BST) |
| Cc: | David VomLehn <dvomlehn@cisco.com>, linux-mips@linux-mips.org |
| In-reply-to: | <4C2F49D0.60200@pobox.com> |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| References: | <4C2755A3.3080600@pobox.com> <20100630220124.GA576@dvomlehn-lnx2.corp.sa.net> <4C2DF427.7080508@pobox.com> <20100702213219.GA390@dvomlehn-lnx2.corp.sa.net> <4C2F49D0.60200@pobox.com> |
| Sender: | linux-mips-bounce@linux-mips.org |
| User-agent: | Alpine 2.00 (LFD 1167 2008-08-23) |
On Sat, 3 Jul 2010, Shinya Kuribayashi wrote:
> Ok, now I've come to the same conclusion. Revised patch will be like
> this. Malta is a development platform supporting various types of
> MIPS32/MIPS64 cores, hence use cpu_has_clo_clz directly. The same goes
> to MIPSSim.
Malta also supports a couple of MIPS IV processors too, so please be
careful about such assumptions.
> + if (__builtin_constant_p(cpu_has_clo_clz) && cpu_has_clo_clz) {
> + int x;
> + __asm__(
> + " .set push \n"
> + " .set mips32 \n"
> + " clz %0, %1 \n"
> + " .set pop \n"
> + : "=r" (x)
> + : "r" (pending));
> +
> + return -x + 31 - CAUSEB_IP;
> + }
Hmm, ".set mips32" looks dodgy here. For pre-MIPS32/64 platforms this
code should never make it to the assembler and if it did, then a
build-time error is better than a run-time problem.
It might be simpler just to use __builtin_ffs() for this variant though.
Inline assembly is better avoided unless absolutely required. Not even
mentioning readability.
Maciej
|
| Previous by Date: | Re: [PATCH] MIPS: PowerTV: Use fls() carefully where static optimization is required, Shinya Kuribayashi |
|---|---|
| Next by Date: | Re: [PATCH v2 16/26] fbdev: Add JZ4740 framebuffer driver, Lars-Peter Clausen |
| Previous by Thread: | Re: [PATCH] MIPS: PowerTV: Use fls() carefully where static optimization is required, Shinya Kuribayashi |
| Next by Thread: | Re: [PATCH] MIPS: PowerTV: Use fls() carefully where static optimization is required, Shinya Kuribayashi |
| Indexes: | [Date] [Thread] [Top] [All Lists] |