From: Linus Torvalds <torvalds@linux-foundation.org>
To: Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil>
Cc: Nicolas Pitre <nico@cam.org>,
Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: block-sha1: improve code on large-register-set machines
Date: Tue, 11 Aug 2009 15:57:10 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.2.01.0908111553460.28882@localhost.localdomain> (raw)
In-Reply-To: <fLYKSyures_wcvAvAV9-MgKQlhk959HJpx-pKz7T1n-Mel7f2RBkMw@cipher.nrlssc.navy.mil>
On Tue, 11 Aug 2009, Brandon Casey wrote:
>
> In that case, why not change the interface of blk_SHA1Block() so that its
> second argument is const unsigned char* and get rid of __d and the { } ?
Because on big-endian, or on architectures like x86 that have an efficient
byte swap, that would be horrible.
You absoluetoy MUST NOT do things a byte at a time in those cases. The
memory operations and the shifting just kills you.
The reason you want to do things a byte at a time on ARM is that ARM
cannot do unaligned accesses well (very modern cores are better, but
rare), and that ARM has no bswap instruction and has fairly cheap shifts.
On no sane architecture is that true. Unaligned loads are fast (and quite
frankly, hardware where unaliged loads aren't fast is just crazy sh*t),
and doing 'bswap' is way faster than doing many shifts and masks.
So everything should be fundamentally word-oriented. Then, broken
architectures that can't handle it should split up the words, not the
other way around.
Linus
next prev parent reply other threads:[~2009-08-11 22:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-10 23:52 block-sha1: improve code on large-register-set machines Linus Torvalds
2009-08-11 6:15 ` Nicolas Pitre
2009-08-11 15:04 ` Linus Torvalds
2009-08-11 18:00 ` Nicolas Pitre
2009-08-11 19:31 ` Nicolas Pitre
2009-08-11 21:20 ` Brandon Casey
2009-08-11 21:36 ` Nicolas Pitre
2009-08-11 21:49 ` Brandon Casey
2009-08-11 22:57 ` Linus Torvalds [this message]
2009-08-11 23:13 ` Brandon Casey
2009-08-11 15:43 ` Linus Torvalds
2009-08-11 20:03 ` Nicolas Pitre
2009-08-11 22:53 ` Linus Torvalds
2009-08-11 23:14 ` Linus Torvalds
2009-08-12 2:26 ` Nicolas Pitre
2009-08-11 23:45 ` Artur Skawina
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=alpine.LFD.2.01.0908111553460.28882@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=brandon.casey.ctr@nrlssc.navy.mil \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nico@cam.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