Re: [PATCH] crypto/sha256.c crypto/sha512.c

From: Jean-Luc Cooke
Date: Tue Jan 27 2004 - 15:28:21 EST


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/