bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

small md5sum speedup on i386


From: dean gaudet
Subject: small md5sum speedup on i386
Date: Fri, 28 Nov 2003 15:12:10 -0800 (PST)

this conditional for i386 is not required with any recent GCC (probably
anything 3.x)...  in fact it's undesirable because the asm forces the use
of a variable rotation, which steals the %ecx register from many more
useful purposes in this code.

the patch below results in an 8% speedup on pentium-m, and a 15% speedup
on xeon (on 256MB of /dev/zero).

if you really want to use asm i suggest using the immediate form of
rotate:

        asm volatile("rol %2,%0" : "=r" (x) : "0" (x), "i" (n));

-dean


--- coreutils-5.0/lib/md5.h.orig        2003-11-28 15:04:30.000000000 -0800
+++ coreutils-5.0/lib/md5.h     2003-11-28 15:06:03.000000000 -0800
@@ -149,7 +149,7 @@

 /* The following is from gnupg-1.0.2's cipher/bithelp.h.  */
 /* Rotate a 32 bit integer by n bytes */
-#if defined __GNUC__ && defined __i386__
+#if 0 && defined __GNUC__ && defined __i386__
 static inline md5_uint32
 rol(md5_uint32 x, int n)
 {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]