From: Anton Blanchard <anton@samba.org>
To: David Laight <David.Laight@ACULAB.COM>
Cc: "paulus@samba.org" <paulus@samba.org>,
"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 11:55:05 +1100 [thread overview]
Message-ID: <20150112115505.15d95434@kryten> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CAC418D@AcuExch.aculab.com>
Hi David,
> 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 as fast - especially in the case where the code isn't
> already in the cache and the compare is relatively short.
I'm always keen to keep things as simple as possible, but your loop is
over 50% slower. Once the loop hits a steady state you are going to run
into front end issues with instruction fetch on POWER8.
Anton
> Try something based on:
> a1 = *a++;
> b1 = *b++;
> while {
> a2 = *a++;
> b2 = *b++;
> if (a1 != a2)
> break;
> a1 = *a++;
> b1 = *b++;
> } while (a2 != a1);
>
> David
>
next prev parent reply other threads:[~2015-01-12 0: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 [this message]
2015-01-12 6:55 ` Joakim Tjernlund
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=20150112115505.15d95434@kryten \
--to=anton@samba.org \
--cc=David.Laight@ACULAB.COM \
--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 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).