Browse Source

[i386] Use memory address constraints in __bswap_16s() and __bswap_64s()

Minimise code size by forcing the use of memory addresses for
__bswap_16s() and __bswap_64s().  (__bswap_32s() cannot avoid loading the
value into a register.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
732bea2f88
1 changed files with 3 additions and 4 deletions
  1. 3
    4
      src/arch/i386/include/bits/byteswap.h

+ 3
- 4
src/arch/i386/include/bits/byteswap.h View File

19
 
19
 
20
 static inline __attribute__ (( always_inline )) void
20
 static inline __attribute__ (( always_inline )) void
21
 __bswap_16s ( uint16_t *x ) {
21
 __bswap_16s ( uint16_t *x ) {
22
-	__asm__ ( "rorw $8, %0" : "=g" ( *x ) : "0" ( *x ) );
22
+	__asm__ ( "rorw $8, %0" : "+m" ( *x ) );
23
 }
23
 }
24
 
24
 
25
 static inline __attribute__ (( always_inline, const )) uint32_t
25
 static inline __attribute__ (( always_inline, const )) uint32_t
63
 		  "xchgl %2,%1\n\t"
63
 		  "xchgl %2,%1\n\t"
64
 		  "bswapl %2\n\t"
64
 		  "bswapl %2\n\t"
65
 		  "movl %2,%0\n\t"
65
 		  "movl %2,%0\n\t"
66
-		  : "=g" ( dwords->low ), "=g" ( dwords->high ),
67
-		    "=r" ( discard )
68
-		  : "0" ( dwords->low ), "1" ( dwords->high ) );
66
+		  : "+m" ( dwords->low ), "+m" ( dwords->high ),
67
+		    "=r" ( discard ) );
69
 }
68
 }
70
 
69
 
71
 #endif /* _BITS_BYTESWAP_H */
70
 #endif /* _BITS_BYTESWAP_H */

Loading…
Cancel
Save