All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
To: "anton@samba.org" <anton@samba.org>
Cc: "paulus@samba.org" <paulus@samba.org>,
	"David.Laight@ACULAB.COM" <David.Laight@ACULAB.COM>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH 1/2] powerpc: Add 64bit optimised memcmp
Date: Mon, 12 Jan 2015 06:55:27 +0000	[thread overview]
Message-ID: <1421045727.3055.101.camel@transmode.se> (raw)
In-Reply-To: <20150112115505.15d95434@kryten>


On Mon, 2015-01-12 at 11:55 +1100, Anton Blanchard wrote:
> Hi David,
>=20
> > The unrolled loop (deleted) looks excessive.
> > On a modern cpu with multiple execution units you can usually
> > manage to get the loop overhead to execute in parallel to the
> > actual 'work'.
> > So I suspect that a much simpler 'word at a time' loop will be almost a=
s fast - especially in the case where the code isn't
> > already in the cache and the compare is relatively short.
>=20
> I'm always keen to keep things as simple as possible, but your loop is ov=
er 50% slower. Once the loop hits a steady state you are going to run into =
front end issues with instruction fetch on POWER8.
>=20

Out of curiosity, does preincrement make any difference(or can gcc do that =
for you nowadays)?

         a1 =3D *a;
         b1 =3D *b;
         while {
                 a2 =3D *++a;
                 b2 =3D *++b;
                 if (a1 !=3D a2)
                 break;
                 a1 =3D *++a;
                 b1 =3D *++b;
         } while (a2 !=3D a1);

 Jocke

> Anton
>=20
> > Try something based on:
> >         a1 =3D *a++;
> >         b1 =3D *b++;
> >         while {
> >                 a2 =3D *a++;
> >                 b2 =3D *b++;
> >                 if (a1 !=3D a2)
> >                 break;
> >                 a1 =3D *a++;
> >                 b1 =3D *b++;
> >         } while (a2 !=3D a1);
> >=20
> >         David
> >=20
>=20
> _______________________________________________
> Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozl=
abs.org/listinfo/linuxppc-dev=

  reply	other threads:[~2015-01-12  6:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-09  1:56 [PATCH 1/2] powerpc: Add 64bit optimised memcmp Anton Blanchard
2015-01-09  1:56 ` [PATCH 2/2] powerpc: Add memcmp testcase Anton Blanchard
2015-01-09 10:06 ` [PATCH 1/2] powerpc: Add 64bit optimised memcmp David Laight
2015-01-12  0:55   ` Anton Blanchard
2015-01-12  6:55     ` Joakim Tjernlund [this message]
2015-01-12  9:45       ` David Laight
2015-01-09 11:01 ` Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2015-01-21  1:27 Anton Blanchard
2015-01-21  9:26 ` Arnd Bergmann
2015-01-21 12:06   ` Anton Blanchard

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=1421045727.3055.101.camel@transmode.se \
    --to=joakim.tjernlund@transmode.se \
    --cc=David.Laight@ACULAB.COM \
    --cc=anton@samba.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --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 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.