From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Christophe LEROY <christophe.leroy@c-s.fr>,
Mathieu Malaterre <malat@debian.org>
Cc: Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 5/5] powerpc/lib: inline memcmp() for small constant sizes
Date: Thu, 17 May 2018 23:44:15 +1000 [thread overview]
Message-ID: <d981664a47150acbe5eab9c666c9ce6676848037.camel@kernel.crashing.org> (raw)
In-Reply-To: <c184c807-dac0-0617-f449-492f5b6eeec1@c-s.fr>
On Thu, 2018-05-17 at 15:21 +0200, Christophe LEROY wrote:
> > > +static inline int __memcmp8(const void *p, const void *q, int off)
> > > +{
> > > + s64 tmp = be64_to_cpu(*(u64*)(p + off)) - be64_to_cpu(*(u64*)(q + off));
> >
> > I always assumed 64bits unaligned access would trigger an exception.
> > Is this correct ?
>
> As far as I know, an unaligned access will only occur when the operand
> of lmw, stmw, lwarx, or stwcx. is not aligned.
>
> Maybe that's different for PPC64 ?
It's very implementation specific.
Recent ppc64 chips generally don't trap (unless it's cache inhibited
space). Earlier variants might trap on page boundaries or segment
boundaries. Some embedded parts are less forgiving... some earlier
POWER chips will trap on unaligned in LE mode...
I wouldn't worry too much about it though. I think if 8xx shows an
improvement then it's probably fine everywhere else :-)
Cheers,
Ben.
next prev parent reply other threads:[~2018-05-17 13:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-17 10:49 [PATCH v2 0/5] powerpc/lib: Optimisation of string functions (mainly for PPC32) Christophe Leroy
2018-05-17 10:49 ` [PATCH v2 1/5] powerpc/lib: move PPC32 specific functions out of string.S Christophe Leroy
2018-05-17 13:33 ` Segher Boessenkool
2018-05-17 10:49 ` [PATCH v2 2/5] powerpc/lib: optimise 32 bits __clear_user() Christophe Leroy
2018-05-17 10:49 ` [PATCH v2 3/5] powerpc/lib: optimise PPC32 memcmp Christophe Leroy
2018-05-17 10:49 ` [PATCH v2 4/5] powerpc/lib: inline string functions NUL size verification Christophe Leroy
2018-05-17 10:49 ` [PATCH v2 5/5] powerpc/lib: inline memcmp() for small constant sizes Christophe Leroy
2018-05-17 13:03 ` Mathieu Malaterre
2018-05-17 13:21 ` Christophe LEROY
2018-05-17 13:44 ` Benjamin Herrenschmidt [this message]
2018-05-17 13:55 ` Segher Boessenkool
2018-05-18 10:35 ` Christophe Leroy
2018-05-18 15:20 ` Segher Boessenkool
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=d981664a47150acbe5eab9c666c9ce6676848037.camel@kernel.crashing.org \
--to=benh@kernel.crashing.org \
--cc=christophe.leroy@c-s.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=malat@debian.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).