Add ROTATE inline asm support for SM3
And move ROTATE inline asm to header.
Now this benefits SM3, SHA (when with Zbb only and no Zknh)
and other hash functions
# define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n))))
+#ifndef PEDANTIC
+# if defined(__GNUC__) && __GNUC__>=2 && \
+ !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
+# if defined(__riscv_zbb) || defined(__riscv_zbkb)
+# if __riscv_xlen == 64
+# undef ROTATE
+# define ROTATE(x, n) ({ MD32_REG_T ret; \
+ asm ("roriw %0, %1, %2" \
+ : "=r"(ret) \
+ : "r"(x), "i"(32 - (n))); ret;})
+# endif
+# if __riscv_xlen == 32
+# undef ROTATE
+# define ROTATE(x, n) ({ MD32_REG_T ret; \
+ asm ("rori %0, %1, %2" \
+ : "=r"(ret) \
+ : "r"(x), "i"(32 - (n))); ret;})
+# endif
+# endif
+# endif
+#endif
+
# if defined(DATA_ORDER_IS_BIG_ENDIAN)
# define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++)))<<24), \
