All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: Shinya Kuribayashi <skuribay@pobox.com>,
	David VomLehn <dvomlehn@cisco.com>,
	linux-mips@linux-mips.org
Subject: Re: [PATCH] MIPS: PowerTV: Use fls() carefully where static optimization is required
Date: Mon, 05 Jul 2010 09:33:36 +0900	[thread overview]
Message-ID: <4C312860.3020005@renesas.com> (raw)
In-Reply-To: <alpine.LFD.2.00.1007031748350.11778@eddie.linux-mips.org>

Hi,

On 7/4/2010 2:03 AM, Maciej W. Rozycki wrote:
>  Malta also supports a couple of MIPS IV processors too, so please be 
> careful about such assumptions.

Ah, that's the answer I'm looking for, thanks!  So current irq_ffs()
form (clz() is enabled only when CONFIG_CPU_MIPS32/64 is selected) is
well-suited for Malta platform, and it seems better to leave them as
they are.  I'll drop the patch from my list.

>> +	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.

I see, cpu_has_clo_clz doesn't work well for platforms such as Malta.
Malta can support several ISAs at a time, which is very valuable, but
hard to be optimized :-)

>  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.

Hm.  It might be simpler, but it's not the purpose of irq_ffs(), IMHO.

-- 
Shinya Kuribayashi
Renesas Electronics

  reply	other threads:[~2010-07-05  0:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-27 13:44 [PATCH] MIPS: PowerTV: Use fls() carefully where static optimization is required Shinya Kuribayashi
2010-06-30 17:48 ` 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 [this message]
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=4C312860.3020005@renesas.com \
    --to=shinya.kuribayashi.px@renesas.com \
    --cc=dvomlehn@cisco.com \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.org \
    --cc=skuribay@pobox.com \
    /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.