From 028cde0006a433c926f973bfb8f3fff8ac8c63cc Mon Sep 17 00:00:00 2001 From: "zhaixiaojuan@loongson.cn" <67671683+zhaixiaojuan@users.noreply.github.com> Date: Thu, 23 Mar 2023 11:08:59 +0800 Subject: [PATCH] HADOOP-18644. Add bswap support for LoongArch64. (#5453). Contributed by zhaixiaojuan. Reviewed-by: He Xiaoqiao --- .../src/main/native/src/lib/primitives.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/primitives.h b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/primitives.h index 000c4b91fd..6d454e1dfc 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/primitives.h +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/primitives.h @@ -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