public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: Matthew Wilcox <willy@debian.org>,
	Bernardo Innocenti <bernie@develer.com>,
	Andrew Morton <akpm@zip.com.au>,
	linux-kernel@vger.kernel.org
Subject: Re: do_div vs sector_t
Date: Sun, 13 Jul 2003 18:39:37 +0100	[thread overview]
Message-ID: <20030713183937.F2621@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20030713172622.GA13824@twiddle.net>; from rth@twiddle.net on Sun, Jul 13, 2003 at 10:26:23AM -0700

On Sun, Jul 13, 2003 at 10:26:23AM -0700, Richard Henderson wrote:
> On Fri, Jul 11, 2003 at 11:33:59PM +0100, Matthew Wilcox wrote:
> > Better ideas?
> 
>           if (likely(((n) >> 31 >> 1) == 0)) {
> 

Beware - luckily I don't have to worry about that on ARM (we do our own
thing.)  However, with this code:

int foo(unsigned long long n)
{
        if (((n) >> 31 >> 1) == 0) {
                return 1;
        } else {
                return 0;
        }
}

gcc 3.2.2 on ARM (32-bit) produces some not-very-nice code, consisting of
6 shifts and including placing one register on the stack and completely
ignoring a register which it could freely use instead.

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


  reply	other threads:[~2003-07-13 17:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-11 22:33 do_div vs sector_t Matthew Wilcox
2003-07-11 22:34 ` Andrew Morton
2003-07-11 22:42 ` Neil Brown
2003-07-12  0:14   ` do_div vs sector_t (patch) Nick Piggin
2003-07-12  6:52 ` do_div vs sector_t Christoph Hellwig
2003-07-12  6:58   ` Andrew Morton
2003-07-13 17:26 ` Richard Henderson
2003-07-13 17:39   ` Russell King [this message]
2003-07-13 19:14   ` Bernardo Innocenti
2003-07-13 20:04     ` Matthew Wilcox
2003-07-14  4:07 ` Peter Chubb
  -- strict thread matches above, loose matches on Subject: below --
2003-07-13 18:40 linux

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=20030713183937.F2621@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=akpm@zip.com.au \
    --cc=bernie@develer.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy@debian.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox