Linux 5.7.6
[linux/fpc-iii.git] / arch / sparc / include / uapi / asm / swab.h
blob6b1b3f1ad7257d4c0639a2e0814394633189d6e0
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _SPARC_SWAB_H
3 #define _SPARC_SWAB_H
5 #include <linux/types.h>
6 #include <asm/asi.h>
8 #if defined(__sparc__) && defined(__arch64__)
9 static inline __u16 __arch_swab16p(const __u16 *addr)
11 __u16 ret;
13 __asm__ __volatile__ ("lduha [%2] %3, %0"
14 : "=r" (ret)
15 : "m" (*addr), "r" (addr), "i" (ASI_PL));
16 return ret;
18 #define __arch_swab16p __arch_swab16p
20 static inline __u32 __arch_swab32p(const __u32 *addr)
22 __u32 ret;
24 __asm__ __volatile__ ("lduwa [%2] %3, %0"
25 : "=r" (ret)
26 : "m" (*addr), "r" (addr), "i" (ASI_PL));
27 return ret;
29 #define __arch_swab32p __arch_swab32p
31 static inline __u64 __arch_swab64p(const __u64 *addr)
33 __u64 ret;
35 __asm__ __volatile__ ("ldxa [%2] %3, %0"
36 : "=r" (ret)
37 : "m" (*addr), "r" (addr), "i" (ASI_PL));
38 return ret;
40 #define __arch_swab64p __arch_swab64p
42 #else
43 #define __SWAB_64_THRU_32__
44 #endif /* defined(__sparc__) && defined(__arch64__) */
46 #endif /* _SPARC_SWAB_H */