1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
3 * Copyright 2009 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
8 #ifndef _UAPI_BLACKFIN_SWAB_H
9 #define _UAPI_BLACKFIN_SWAB_H
11 #include <linux/types.h>
12 #include <asm-generic/swab.h>
16 static __inline__ __attribute_const__ __u32 __arch_swahb32(__u32 xx)
19 __asm__("%1 = %0 >> 8 (V);\n\t"
20 "%0 = %0 << 8 (V);\n\t"
22 : "+d"(xx), "=&d"(tmp));
25 #define __arch_swahb32 __arch_swahb32
27 static __inline__ __attribute_const__ __u32 __arch_swahw32(__u32 xx)
30 __asm__("%0 = PACK(%1.L, %1.H);\n\t": "=d"(rv): "d"(xx));
33 #define __arch_swahw32 __arch_swahw32
35 static __inline__ __attribute_const__ __u32 __arch_swab32(__u32 xx)
37 return __arch_swahb32(__arch_swahw32(xx));
39 #define __arch_swab32 __arch_swab32
41 static __inline__ __attribute_const__ __u16 __arch_swab16(__u16 xx)
44 __asm__("%0 <<= 8;\n %0.L = %0.L + %0.H (NS);\n": "+d"(xw));
47 #define __arch_swab16 __arch_swab16
51 #endif /* _UAPI_BLACKFIN_SWAB_H */