From: linux@horizon.com
To: davem@davemloft.net, paulus@samba.org
Cc: git@vger.kernel.org, linux@horizon.com
Subject: Re: Revised PPC assembly implementation
Date: 26 Apr 2005 02:35:07 -0000 [thread overview]
Message-ID: <20050426023507.24611.qmail@science.horizon.com> (raw)
In-Reply-To: <20050425161746.7d943e62.davem@davemloft.net>
(Sorry about that last e-mail. gnome-terminal crashed and sent the file
before I edited it. Here's what I meant to send.)
> Do a block with the integer ALUs in parallel with a block done using
> Altivec :-) There should be enough spare insn slots so that the loads
> are absorbed properly.
Unfortunately, the blocks are connected by a data dependency.
It's basically a large-key block cipher, chained by:
iv[] = fixed_initial_value.
iv[] += encrypt(iv, text[0..63])
iv[] += encrypt(iv, text[64..127])
iv[] += encrypt(iv, text[128..191])
iv[] += encrypt(iv, text[192..255])
etc.
There is no coarse-grain parallelism to exploit, unless you want
to be hashing two separate files at once. Which would do too much
damage to the structure of the source to be worth considering.
> Unlike UltraSPARC's VIS, with altivec you can reasonably do shifts and
> rotates, which is the only reason I'm suggesting this.
I don't quite think it's worth it, though. It's not data-parallel
enough.
We could theoretically use it to form the w[] vector, but that's only
4 instructions in registers which are very flexibly schedulable and
nicely fill in the cracks between other instructions.
Oh, here's STEPD1+UPDATEW scheduled optimally for the G4. %r5 holds the
constant K. Note that t < s <= t+16. W(s) and W((s)-16) are actually
the same register.
add RE(t),RE(t),W(t); xor %r0,RD(t),RB(t); xor W(s),W((s)-16),W((s)-3);
add RE(t),RE(t),%r5; xor %r0,%r0,RC(t); xor W(s),W(s),W((s)-8);
add RE(t),RE(t),%r0; rotlwi %r0,RA(t),5; xor W(s),W(s),W((s)-14);
add RE(t),RE(t),%r0; rotlwi RB(t),RB(t),30; rotlwi W(s),W(s),1;
However, whether that can be done in 6 cycles on a G5 is a bit unclear.
It can't be 6 consecutive cycles, but with some motion of code
across the edges, perhaps...
0: add RE(t),RE(t),W(t); xor %r0,RD(t),RB(t);
1: xor W(s),W((s)-16),W((s)-3); (add)
2: add RE(t),RE(t),%r5; xor %r0,%r0,RC(t);
3: xor W(s),W(s),W((s)-8); (rotlwi)
4: add RE(t),RE(t),%r0; rotlwi %r0,RA(t),5;
5: xor W(s),W(s),W((s)-14); rotlwi RB(t),RB(t),30;
6:
7: add RE(t),RE(t),%r0;
8:
9: rotlwi W(s),W(s),1;
The problem there is forcing that ordering, rather than issuing the final
add in cycle 6 and pushing everything else ahead of it.
STEPD0+UPDATEW and STEPD1+UPDATEW are 13 and 14 instructions,
respectively, and don't fit into a 3-issue machine as neatly.
prev parent reply other threads:[~2005-04-26 2:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-23 12:42 [PATCH] PPC assembly implementation of SHA1 linux
2005-04-23 13:03 ` linux
2005-04-24 2:49 ` Benjamin Herrenschmidt
2005-04-24 4:40 ` Paul Mackerras
2005-04-24 12:04 ` Wayne Scott
2005-04-25 0:16 ` linux
2005-04-25 3:13 ` Revised PPC assembly implementation linux
2005-04-25 9:40 ` Paul Mackerras
2005-04-25 17:34 ` linux
2005-04-25 23:00 ` Paul Mackerras
2005-04-25 23:17 ` David S. Miller
2005-04-26 1:22 ` Paul Mackerras
2005-04-27 1:47 ` linux
2005-04-27 3:39 ` Paul Mackerras
2005-04-27 16:01 ` linux
2005-04-26 2:14 ` linux
2005-04-26 2:35 ` linux [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050426023507.24611.qmail@science.horizon.com \
--to=linux@horizon.com \
--cc=davem@davemloft.net \
--cc=git@vger.kernel.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).