diff options
author | Andy Polyakov <appro@openssl.org> | 2002-12-14 21:42:05 +0100 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2002-12-14 21:42:05 +0100 |
commit | 2f98abbcb6cfd6ffcf45d5587286f1f849184594 (patch) | |
tree | 890a6915ae4da1afd9ef397b6ead8ac5e8ab37e7 /crypto/rc5 | |
parent | DES PIC-ification. Windows companion. (diff) | |
download | openssl-2f98abbcb6cfd6ffcf45d5587286f1f849184594.tar.xz openssl-2f98abbcb6cfd6ffcf45d5587286f1f849184594.zip |
x86_64 performance patch.
Diffstat (limited to 'crypto/rc5')
-rw-r--r-- | crypto/rc5/rc5_locl.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/crypto/rc5/rc5_locl.h b/crypto/rc5/rc5_locl.h index d3871c6555..c700dfb1a5 100644 --- a/crypto/rc5/rc5_locl.h +++ b/crypto/rc5/rc5_locl.h @@ -149,6 +149,23 @@ #if defined(OPENSSL_SYS_WIN32) && defined(_MSC_VER) #define ROTATE_l32(a,n) _lrotl(a,n) #define ROTATE_r32(a,n) _lrotr(a,n) +#elif defined(__GNUC__) && __GNUC__>=2 && !defined(NO_ASM) && !defined(NO_INLINE_ASM) +# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) +# define ROTATE_l32(a,n) ({ register unsigned int ret; \ + asm ("roll %%cl,%0" \ + : "=r"(ret) \ + : "c"(n),"0"(a) \ + : "cc"); \ + ret; \ + }) +# define ROTATE_r32(a,n) ({ register unsigned int ret; \ + asm ("rorl %%cl,%0" \ + : "=r"(ret) \ + : "c"(n),"0"(a) \ + : "cc"); \ + ret; \ + }) +# endif #else #define ROTATE_l32(a,n) (((a)<<(n&0x1f))|(((a)&0xffffffff)>>(32-(n&0x1f)))) #define ROTATE_r32(a,n) (((a)<<(32-(n&0x1f)))|(((a)&0xffffffff)>>(n&0x1f))) |