6 * Copyright IBM Corp. 1999
7 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
10 #include <linux/types.h>
13 # define __SWAB_64_THRU_32__
17 static inline __u64
__arch_swab64p(const __u64
*x
)
21 asm volatile("lrvg %0,%1" : "=d" (result
) : "m" (*x
));
24 #define __arch_swab64p __arch_swab64p
26 static inline __u64
__arch_swab64(__u64 x
)
30 asm volatile("lrvgr %0,%1" : "=d" (result
) : "d" (x
));
33 #define __arch_swab64 __arch_swab64
35 static inline void __arch_swab64s(__u64
*x
)
37 *x
= __arch_swab64p(x
);
39 #define __arch_swab64s __arch_swab64s
40 #endif /* __s390x__ */
42 static inline __u32
__arch_swab32p(const __u32
*x
)
48 " icm %0,8,%O1+3(%R1)\n"
49 " icm %0,4,%O1+2(%R1)\n"
50 " icm %0,2,%O1+1(%R1)\n"
52 : "=&d" (result
) : "Q" (*x
) : "cc");
55 : "=d" (result
) : "m" (*x
));
56 #endif /* __s390x__ */
59 #define __arch_swab32p __arch_swab32p
62 static inline __u32
__arch_swab32(__u32 x
)
66 asm volatile("lrvr %0,%1" : "=d" (result
) : "d" (x
));
69 #define __arch_swab32 __arch_swab32
70 #endif /* __s390x__ */
72 static inline __u16
__arch_swab16p(const __u16
*x
)
78 " icm %0,2,%O1+1(%R1)\n"
80 : "=&d" (result
) : "Q" (*x
) : "cc");
83 : "=d" (result
) : "m" (*x
));
84 #endif /* __s390x__ */
87 #define __arch_swab16p __arch_swab16p
89 #endif /* _S390_SWAB_H */