Add ROTATE inline RISC-V zbb/zbkb asm for DES

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18290)
This commit is contained in:
Hongren (Zenithal) Zheng 2022-05-11 18:32:13 +08:00 committed by Pauli
parent d272ef5372
commit 6136408e6a

View File

@ -109,6 +109,19 @@
: "cc"); \
ret; \
})
# elif defined(__riscv_zbb) || defined(__riscv_zbkb)
# if __riscv_xlen == 64
# define ROTATE(x, n) ({ register unsigned int ret; \
asm ("roriw %0, %1, %2" \
: "=r"(ret) \
: "r"(x), "i"(n)); ret; })
# endif
# if __riscv_xlen == 32
# define ROTATE(x, n) ({ register unsigned int ret; \
asm ("rori %0, %1, %2" \
: "=r"(ret) \
: "r"(x), "i"(n)); ret; })
# endif
# endif
# endif
# ifndef ROTATE