public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean-Luc Cooke <jlcooke@certainkey.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto/sha256.c crypto/sha512.c
Date: Tue, 27 Jan 2004 15:22:25 -0500	[thread overview]
Message-ID: <20040127202225.GA15808@certainkey.com> (raw)
In-Reply-To: <Xine.LNX.4.44.0401271514150.4185-100000@thoron.boston.redhat.com>

If you take a peek in your/Plumb's crypto/md5.c you've reduced the F1() macro
to the identical operation as the new Ch() inline function.

It reduces gcc's tenancy to re-load values in functions such like:
  (x & y) ^ (~x & z)
  (x & y) ^ (x & z) ^ (y & z)

This works out much nicer:
   z ^ (x & (y ^ z))
   (x & y) | (z & (x | y))

I've seen this in a few .c files (gcc -S blah.c; vim blah.s)

The Ch() and Maj() operations are used a lot in sha256/512.

JLC

On Tue, Jan 27, 2004 at 03:14:53PM -0500, James Morris wrote:
> On Tue, 27 Jan 2004, Jean-Luc Cooke wrote:
> 
> > Optimized the choice and majority fuctions a bit.
> > 
> > Patch:
> >   http://jlcooke.ca/lkml/faster_sha2.patch
> > 
> > Test suite:
> >   http://jlcooke.ca/lkml/faster_sha2.c
> >   build with:
> >     gcc -O3 -s faster_sha2.c -o faster_sha2
> > 
> 
> What kind of performance improvement does this provide?

-- 
http://www.certainkey.com
Suite 4560 CTTC
1125 Colonel By Dr.
Ottawa ON, K1S 5B6

  reply	other threads:[~2004-01-27 20:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-27 19:39 [PATCH] crypto/sha256.c crypto/sha512.c Jean-Luc Cooke
2004-01-27 20:14 ` James Morris
2004-01-27 20:22   ` Jean-Luc Cooke [this message]
2004-01-27 21:05     ` David S. Miller
2004-01-27 22:12       ` Jean-Luc Cooke
2004-01-28 21:30         ` Jean-Luc Cooke
2004-01-28 22:08           ` James Morris
2004-01-28 23:03             ` David S. Miller

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=20040127202225.GA15808@certainkey.com \
    --to=jlcooke@certainkey.com \
    --cc=linux-kernel@vger.kernel.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