public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Miller <davem@davemloft.net>,
	mingo@kernel.org, hpa@zytor.com, x86@kernel.org,
	linux-arch@vger.kernel.org
Subject: Re: x86: faster strncpy_from_user()
Date: Wed, 11 Apr 2012 11:25:01 +1000	[thread overview]
Message-ID: <1334107501.2984.19.camel@pasglop> (raw)
In-Reply-To: <CA+55aFw9-cVKP4MUpO6pCLbpHavrB1qbJ1NeiXEBbNupZ0iYKA@mail.gmail.com>

On Tue, 2012-04-10 at 17:57 -0700, Linus Torvalds wrote:
> On Tue, Apr 10, 2012 at 5:50 PM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> >
> > .. and you don't have a double shift, right? So you'd need to do two
> > shifts and the or for each word.
> 
> Actually, if sparc has a "rotate" instruction, you can do with a
> single shift (rotate) per word loop.
> 
> You need to set up a mask register based on the alignment, and
> pre-load the first word, but if you do have a rotate you can rotate
> and then use "and mask" first to generate the "high bits" of the
> current word, and then use the "andn mask" to generate the low bits of
> the next word. So then you just need a single rotate per loop, and
> some (very minor) loop prep.
> 
> Of course, RISC people tended to throw out rotate too, so maybe you
> don't have even that.

Well, we do have a very nice & flexible rotate & mask on ppc at
least :-)

Cheers,
Ben.

  parent reply	other threads:[~2012-04-11  1:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-06 21:32 x86: faster strncpy_from_user() Linus Torvalds
2012-04-06 21:49 ` Linus Torvalds
2012-04-10 22:35 ` Benjamin Herrenschmidt
2012-04-10 22:50   ` Linus Torvalds
2012-04-10 23:29     ` David Miller
2012-04-10 23:33       ` H. Peter Anvin
2012-04-10 23:56         ` Benjamin Herrenschmidt
2012-04-10 23:25   ` David Miller
2012-04-11  0:34     ` Linus Torvalds
2012-04-11  0:43       ` David Miller
2012-04-11  0:50         ` Linus Torvalds
2012-04-11  0:57           ` Linus Torvalds
2012-04-11  1:09             ` David Miller
2012-04-11  1:18               ` Linus Torvalds
2012-04-11  1:25             ` Benjamin Herrenschmidt [this message]
2012-04-11  8:22               ` Geert Uytterhoeven

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=1334107501.2984.19.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=hpa@zytor.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.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