1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
5 #ifndef __LOONGARCH_ASM_BITREV_H__
6 #define __LOONGARCH_ASM_BITREV_H__
8 #include <linux/swab.h>
10 static __always_inline __attribute_const__ u32
__arch_bitrev32(u32 x
)
14 asm("bitrev.4b %0, %1" : "=r"(ret
) : "r"(__swab32(x
)));
18 static __always_inline __attribute_const__ u16
__arch_bitrev16(u16 x
)
22 asm("bitrev.4b %0, %1" : "=r"(ret
) : "r"(__swab16(x
)));
26 static __always_inline __attribute_const__ u8
__arch_bitrev8(u8 x
)
30 asm("bitrev.4b %0, %1" : "=r"(ret
) : "r"(x
));
34 #endif /* __LOONGARCH_ASM_BITREV_H__ */