2 * Copyright 2009 Analog Devices Inc.
4 * Licensed under the GPL-2 or later.
7 #ifndef _BLACKFIN_SWAB_H
8 #define _BLACKFIN_SWAB_H
10 #include <linux/types.h>
11 #include <asm-generic/swab.h>
15 static __inline__ __attribute_const__ __u32
__arch_swahb32(__u32 xx
)
18 __asm__("%1 = %0 >> 8 (V);\n\t"
19 "%0 = %0 << 8 (V);\n\t"
21 : "+d"(xx
), "=&d"(tmp
));
24 #define __arch_swahb32 __arch_swahb32
26 static __inline__ __attribute_const__ __u32
__arch_swahw32(__u32 xx
)
29 __asm__("%0 = PACK(%1.L, %1.H);\n\t": "=d"(rv
): "d"(xx
));
32 #define __arch_swahw32 __arch_swahw32
34 static __inline__ __attribute_const__ __u32
__arch_swab32(__u32 xx
)
36 return __arch_swahb32(__arch_swahw32(xx
));
38 #define __arch_swab32 __arch_swab32
40 static __inline__ __attribute_const__ __u16
__arch_swab16(__u16 xx
)
43 __asm__("%0 <<= 8;\n %0.L = %0.L + %0.H (NS);\n": "+d"(xw
));
46 #define __arch_swab16 __arch_swab16
50 #endif /* _BLACKFIN_SWAB_H */