5 * include/asm-s390/swab.h
8 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
9 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
12 #include <linux/types.h>
15 # define __SWAB_64_THRU_32__
19 static inline __u64
__arch_swab64p(const __u64
*x
)
23 asm volatile("lrvg %0,%1" : "=d" (result
) : "m" (*x
));
26 #define __arch_swab64p __arch_swab64p
28 static inline __u64
__arch_swab64(__u64 x
)
32 asm volatile("lrvgr %0,%1" : "=d" (result
) : "d" (x
));
35 #define __arch_swab64 __arch_swab64
37 static inline void __arch_swab64s(__u64
*x
)
39 *x
= __arch_swab64p(x
);
41 #define __arch_swab64s __arch_swab64s
42 #endif /* __s390x__ */
44 static inline __u32
__arch_swab32p(const __u32
*x
)
50 " icm %0,8,%O1+3(%R1)\n"
51 " icm %0,4,%O1+2(%R1)\n"
52 " icm %0,2,%O1+1(%R1)\n"
54 : "=&d" (result
) : "Q" (*x
) : "cc");
57 : "=d" (result
) : "m" (*x
));
58 #endif /* __s390x__ */
61 #define __arch_swab32p __arch_swab32p
64 static inline __u32
__arch_swab32(__u32 x
)
68 asm volatile("lrvr %0,%1" : "=d" (result
) : "d" (x
));
71 #define __arch_swab32 __arch_swab32
72 #endif /* __s390x__ */
74 static inline __u16
__arch_swab16p(const __u16
*x
)
80 " icm %0,2,%O+1(%R1)\n"
82 : "=&d" (result
) : "Q" (*x
) : "cc");
85 : "=d" (result
) : "m" (*x
));
86 #endif /* __s390x__ */
89 #define __arch_swab16p __arch_swab16p
91 #endif /* _S390_SWAB_H */