]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
LoongArch: Simplify __arch_bitrev32() implementation
authorXi Ruoyao <xry111@xry111.site>
Sat, 6 Dec 2025 02:39:39 +0000 (10:39 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Sat, 6 Dec 2025 02:39:39 +0000 (10:39 +0800)
LoongArch has the bitrev.w instruction to reverse bits in a 32-bit
integer, thus there's no need to reverse the bytes and use bitrev.4b.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/include/asm/bitrev.h

index 46f275b9cdf7566726383e0adeab14a9b87afc5c..757738ea38d764be99cacee92a56496d0cccdcbf 100644 (file)
@@ -11,7 +11,7 @@ static __always_inline __attribute_const__ u32 __arch_bitrev32(u32 x)
 {
        u32 ret;
 
-       asm("bitrev.4b  %0, %1" : "=r"(ret) : "r"(__swab32(x)));
+       asm("bitrev.w   %0, %1" : "=r"(ret) : "r"(x));
        return ret;
 }