aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-s390/byteorder.h
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2006-09-28 10:56:43 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2006-09-28 10:56:43 -0400
commit94c12cc7d196bab34aaa98d38521549fa1e5ef76 (patch)
tree8e0cec0ed44445d74a2cb5160303d6b4dfb1bc31 /include/asm-s390/byteorder.h
parent25d83cbfaa44e1b9170c0941c3ef52ca39f54ccc (diff)
[S390] Inline assembly cleanup.
Major cleanup of all s390 inline assemblies. They now have a common coding style. Quite a few have been shortened, mainly by using register asm variables. Use of the EX_TABLE macro helps as well. The atomic ops, bit ops and locking inlines new use the Q-constraint if a newer gcc is used. That results in slightly better code. Thanks to Christian Borntraeger for proof reading the changes. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'include/asm-s390/byteorder.h')
-rw-r--r--include/asm-s390/byteorder.h50
1 files changed, 22 insertions, 28 deletions
diff --git a/include/asm-s390/byteorder.h b/include/asm-s390/byteorder.h
index 2cc35a0e188e..1fe2492baa8d 100644
--- a/include/asm-s390/byteorder.h
+++ b/include/asm-s390/byteorder.h
@@ -14,60 +14,54 @@
14#ifdef __GNUC__ 14#ifdef __GNUC__
15 15
16#ifdef __s390x__ 16#ifdef __s390x__
17static __inline__ __u64 ___arch__swab64p(const __u64 *x) 17static inline __u64 ___arch__swab64p(const __u64 *x)
18{ 18{
19 __u64 result; 19 __u64 result;
20 20
21 __asm__ __volatile__ ( 21 asm volatile("lrvg %0,%1" : "=d" (result) : "m" (*x));
22 " lrvg %0,%1"
23 : "=d" (result) : "m" (*x) );
24 return result; 22 return result;
25} 23}
26 24
27static __inline__ __u64 ___arch__swab64(__u64 x) 25static inline __u64 ___arch__swab64(__u64 x)
28{ 26{
29 __u64 result; 27 __u64 result;
30 28
31 __asm__ __volatile__ ( 29 asm volatile("lrvgr %0,%1" : "=d" (result) : "d" (x));
32 " lrvgr %0,%1"
33 : "=d" (result) : "d" (x) );
34 return result; 30 return result;
35} 31}
36 32
37static __inline__ void ___arch__swab64s(__u64 *x) 33static inline void ___arch__swab64s(__u64 *x)
38{ 34{
39 *x = ___arch__swab64p(x); 35 *x = ___arch__swab64p(x);
40} 36}
41#endif /* __s390x__ */ 37#endif /* __s390x__ */
42 38
43static __inline__ __u32 ___arch__swab32p(const __u32 *x) 39static inline __u32 ___arch__swab32p(const __u32 *x)
44{ 40{
45 __u32 result; 41 __u32 result;
46 42
47 __asm__ __volatile__ ( 43 asm volatile(
48#ifndef __s390x__ 44#ifndef __s390x__
49 " icm %0,8,3(%1)\n" 45 " icm %0,8,3(%1)\n"
50 " icm %0,4,2(%1)\n" 46 " icm %0,4,2(%1)\n"
51 " icm %0,2,1(%1)\n" 47 " icm %0,2,1(%1)\n"
52 " ic %0,0(%1)" 48 " ic %0,0(%1)"
53 : "=&d" (result) : "a" (x), "m" (*x) : "cc" ); 49 : "=&d" (result) : "a" (x), "m" (*x) : "cc");
54#else /* __s390x__ */ 50#else /* __s390x__ */
55 " lrv %0,%1" 51 " lrv %0,%1"
56 : "=d" (result) : "m" (*x) ); 52 : "=d" (result) : "m" (*x));
57#endif /* __s390x__ */ 53#endif /* __s390x__ */
58 return result; 54 return result;
59} 55}
60 56
61static __inline__ __u32 ___arch__swab32(__u32 x) 57static inline __u32 ___arch__swab32(__u32 x)
62{ 58{
63#ifndef __s390x__ 59#ifndef __s390x__
64 return ___arch__swab32p(&x); 60 return ___arch__swab32p(&x);
65#else /* __s390x__ */ 61#else /* __s390x__ */
66 __u32 result; 62 __u32 result;
67 63
68 __asm__ __volatile__ ( 64 asm volatile("lrvr %0,%1" : "=d" (result) : "d" (x));
69 " lrvr %0,%1"
70 : "=d" (result) : "d" (x) );
71 return result; 65 return result;
72#endif /* __s390x__ */ 66#endif /* __s390x__ */
73} 67}
@@ -81,14 +75,14 @@ static __inline__ __u16 ___arch__swab16p(const __u16 *x)
81{ 75{
82 __u16 result; 76 __u16 result;
83 77
84 __asm__ __volatile__ ( 78 asm volatile(
85#ifndef __s390x__ 79#ifndef __s390x__
86 " icm %0,2,1(%1)\n" 80 " icm %0,2,1(%1)\n"
87 " ic %0,0(%1)\n" 81 " ic %0,0(%1)\n"
88 : "=&d" (result) : "a" (x), "m" (*x) : "cc" ); 82 : "=&d" (result) : "a" (x), "m" (*x) : "cc");
89#else /* __s390x__ */ 83#else /* __s390x__ */
90 " lrvh %0,%1" 84 " lrvh %0,%1"
91 : "=d" (result) : "m" (*x) ); 85 : "=d" (result) : "m" (*x));
92#endif /* __s390x__ */ 86#endif /* __s390x__ */
93 return result; 87 return result;
94} 88}