crypto/aes/asm/aesni-x86[_64].pl update, up to 14% improvement on
[openssl.git] / crypto / md32_common.h
index bb7381952a2263dc9ee56afbf4af20dc33078001..147a7a00c30e3649ad5695cc49b3776a0720d594 100644 (file)
  */
 #undef ROTATE
 #ifndef PEDANTIC
-# if defined(_MSC_VER) || defined(__ICC)
+# if defined(_MSC_VER)
 #  define ROTATE(a,n)  _lrotl(a,n)
+# elif defined(__ICC)
+#  define ROTATE(a,n)  _rotl(a,n)
 # elif defined(__MWERKS__)
 #  if defined(__POWERPC__)
 #   define ROTATE(a,n) __rlwinm(a,n,0,31)
                                   asm ("bswapl %0":"=r"(r):"0"(r));    \
                                   *((unsigned int *)(c))=r; (c)+=4; r; })
 #   endif
+#  elif defined(__aarch64__)
+#   if defined(__BYTE_ORDER__)
+#    if defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__
+#     define HOST_c2l(c,l)     ({ unsigned int r;              \
+                                  asm ("rev    %w0,%w1"        \
+                                       :"=r"(r)                \
+                                       :"r"(*((const unsigned int *)(c))));\
+                                  (c)+=4; (l)=r;               })
+#     define HOST_l2c(l,c)     ({ unsigned int r;              \
+                                  asm ("rev    %w0,%w1"        \
+                                       :"=r"(r)                \
+                                       :"r"((unsigned int)(l)));\
+                                  *((unsigned int *)(c))=r; (c)+=4; r; })
+#    elif defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
+#     define HOST_c2l(c,l)     ((l)=*((const unsigned int *)(c)), (c)+=4, (l))
+#     define HOST_l2c(l,c)     (*((unsigned int *)(c))=(l), (c)+=4, (l))
+#    endif
+#   endif
 #  endif
 # endif
 #endif