aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/rc5
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2002-12-14 20:42:05 +0000
committerAndy Polyakov <appro@openssl.org>2002-12-14 20:42:05 +0000
commit2f98abbcb6cfd6ffcf45d5587286f1f849184594 (patch)
tree890a6915ae4da1afd9ef397b6ead8ac5e8ab37e7 /crypto/rc5
parent270fa8aedae8595f9c95a03f019b69cffc31baee (diff)
downloadopenssl-2f98abbcb6cfd6ffcf45d5587286f1f849184594.tar.gz
x86_64 performance patch.
Diffstat (limited to 'crypto/rc5')
-rw-r--r--crypto/rc5/rc5_locl.h17
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)))