HADOOP-18644. Add bswap support for LoongArch64. (#5453). Contributed by zhaixiaojuan.

Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org>
This commit is contained in:
zhaixiaojuan@loongson.cn 2023-03-23 11:08:59 +08:00 committed by GitHub
parent e3cb9573e1
commit 028cde0006
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,7 +99,7 @@ inline void simple_memcpy(void * dest, const void * src, size_t len) {
inline uint32_t bswap(uint32_t val) {
#ifdef __aarch64__
__asm__("rev %w[dst], %w[src]" : [dst]"=r"(val) : [src]"r"(val));
#elif defined(__ppc64__)||(__PPC64__)||(__powerpc64__)
#elif defined(__ppc64__)||(__PPC64__)||(__powerpc64__)||(__loongarch64)
return __builtin_bswap32(val);
#else
__asm__("bswap %0" : "=r" (val) : "0" (val));
@ -110,7 +110,7 @@ inline uint32_t bswap(uint32_t val) {
inline uint64_t bswap64(uint64_t val) {
#ifdef __aarch64__
__asm__("rev %[dst], %[src]" : [dst]"=r"(val) : [src]"r"(val));
#elif defined(__ppc64__)||(__PPC64__)||(__powerpc64__)
#elif defined(__ppc64__)||(__PPC64__)||(__powerpc64__)||(__loongarch64)
return __builtin_bswap64(val);
#else
#ifdef __X64