remove unused byteswap functions.
We need these only for gcc2, which doesn't have builtins. Only swapping floats and doubles remains to implement for all architectures. Change-Id: I60e39ad42d4ef762f3324f934f2996dde1412f1a Reviewed-on: https://review.haiku-os.org/c/1182 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -7,73 +7,42 @@
|
||||
|
||||
.text
|
||||
|
||||
/* uint16 __swap_int16(uint16 value)
|
||||
*/
|
||||
FUNCTION(__swap_int16):
|
||||
moveq.l #0,%d0
|
||||
/* 32-bit aligned stack! */
|
||||
move.l (4,%a7),%d1
|
||||
move.b %d1,%d0
|
||||
lsr.w #8,%d1
|
||||
lsl.w #8,%d0
|
||||
move.b %d1,%d0
|
||||
rts
|
||||
FUNCTION_END(__swap_int16)
|
||||
|
||||
/* uint32 __swap_int32(uint32 value)
|
||||
*/
|
||||
FUNCTION(__swap_int32):
|
||||
/* moveq.l #0,%d0*/
|
||||
move.b (7,%a7),%d0
|
||||
lsl.l #8,%d0
|
||||
move.b (6,%a7),%d0
|
||||
lsl.l #8,%d0
|
||||
move.b (5,%a7),%d0
|
||||
lsl.l #8,%d0
|
||||
move.b (4,%a7),%d0
|
||||
rts
|
||||
FUNCTION_END(__swap_int32)
|
||||
|
||||
/* uint64 __swap_int64(uint64 value)
|
||||
*/
|
||||
FUNCTION(__swap_int64):
|
||||
/* moveq.l #0,%d0*/
|
||||
move.b (7,%a7),%d1
|
||||
lsl.l #8,%d1
|
||||
move.b (6,%a7),%d1
|
||||
lsl.l #8,%d1
|
||||
move.b (5,%a7),%d1
|
||||
lsl.l #8,%d1
|
||||
move.b (4,%a7),%d1
|
||||
/**/
|
||||
move.b (11,%a7),%d0
|
||||
lsl.l #8,%d0
|
||||
move.b (10,%a7),%d0
|
||||
lsl.l #8,%d0
|
||||
move.b (9,%a7),%d0
|
||||
lsl.l #8,%d0
|
||||
move.b (8,%a7),%d0
|
||||
rts
|
||||
FUNCTION_END(__swap_int64)
|
||||
|
||||
/* TODO: The following functions can surely be optimized. A simple optimization
|
||||
* would be to define macros with the contents of the __swap_int{32,64}
|
||||
* functions and use those instead of calling the functions.
|
||||
*/
|
||||
|
||||
/* float __swap_float(float value)
|
||||
*/
|
||||
FUNCTION(__swap_float):
|
||||
jmp __swap_int32
|
||||
//rts
|
||||
/* moveq.l #0,%d0*/
|
||||
move.b (7,%a7),%d0
|
||||
lsl.l #8,%d0
|
||||
move.b (6,%a7),%d0
|
||||
lsl.l #8,%d0
|
||||
move.b (5,%a7),%d0
|
||||
lsl.l #8,%d0
|
||||
move.b (4,%a7),%d0
|
||||
rts
|
||||
FUNCTION_END(__swap_float)
|
||||
|
||||
|
||||
/* double __swap_double(double value)
|
||||
*/
|
||||
FUNCTION(__swap_double):
|
||||
jmp __swap_int32
|
||||
//rts
|
||||
/* moveq.l #0,%d0*/
|
||||
move.b (7,%a7),%d1
|
||||
lsl.l #8,%d1
|
||||
move.b (6,%a7),%d1
|
||||
lsl.l #8,%d1
|
||||
move.b (5,%a7),%d1
|
||||
lsl.l #8,%d1
|
||||
move.b (4,%a7),%d1
|
||||
/**/
|
||||
move.b (11,%a7),%d0
|
||||
lsl.l #8,%d0
|
||||
move.b (10,%a7),%d0
|
||||
lsl.l #8,%d0
|
||||
move.b (9,%a7),%d0
|
||||
lsl.l #8,%d0
|
||||
move.b (8,%a7),%d0
|
||||
rts
|
||||
#warning M68K: XXX:check sizeof(double)
|
||||
FUNCTION_END(__swap_double)
|
||||
|
||||
|
||||
@@ -7,46 +7,6 @@
|
||||
|
||||
.text
|
||||
|
||||
/* uint16 __swap_int16(uint16 value)
|
||||
* r3
|
||||
*/
|
||||
FUNCTION(__swap_int16):
|
||||
rlwinm %r4, %r3, 8, 16, 23 // byte 4 -> byte 3 (clear other bits)
|
||||
rlwimi %r4, %r3, 24, 24, 31 // byte 3 -> byte 4 (copy into)
|
||||
mr %r3, %r4 // copy to result register
|
||||
blr
|
||||
|
||||
|
||||
/* uint32 __swap_int32(uint32 value)
|
||||
* r3
|
||||
*/
|
||||
FUNCTION(__swap_int32):
|
||||
rlwinm %r4, %r3, 24, 0, 31 // byte 4 to 1, byte 2 to 3
|
||||
rlwimi %r4, %r3, 8, 8, 15 // byte 3 to 2
|
||||
rlwimi %r4, %r3, 8, 24, 31 // byte 1 to 4
|
||||
mr %r3, %r4
|
||||
blr
|
||||
|
||||
|
||||
/* uint64 __swap_int64(uint64 value)
|
||||
* r3/r4
|
||||
*/
|
||||
FUNCTION(__swap_int64):
|
||||
rlwinm %r5, %r3, 24, 0, 31 // byte 4 to 5, byte 2 to 7
|
||||
rlwimi %r5, %r3, 8, 8, 15 // byte 3 to 6
|
||||
rlwimi %r5, %r3, 8, 24, 31 // byte 1 to 8
|
||||
rlwinm %r3, %r4, 24, 0, 31 // byte 8 to 1, byte 6 to 3
|
||||
rlwimi %r3, %r4, 8, 8, 15 // byte 7 to 2
|
||||
rlwimi %r3, %r4, 8, 24, 31 // byte 5 to 4
|
||||
mr %r4, %r5 // copy lower 32 bits
|
||||
blr
|
||||
|
||||
|
||||
/* TODO: The following functions can surely be optimized. A simple optimization
|
||||
* would be to define macros with the contents of the __swap_int{32,64}
|
||||
* functions and use those instead of calling the functions.
|
||||
*/
|
||||
|
||||
/* float __swap_float(float value)
|
||||
* f1
|
||||
*/
|
||||
|
||||
@@ -7,28 +7,6 @@
|
||||
#include <asm_defs.h>
|
||||
|
||||
|
||||
/* uint16 __swap_int16(uint16 value) */
|
||||
FUNCTION(__swap_int16):
|
||||
movl %edi, %eax
|
||||
bswap %eax
|
||||
shr $16, %eax
|
||||
ret
|
||||
FUNCTION_END(__swap_int16)
|
||||
|
||||
/* uint32 __swap_int32(uint32 value) */
|
||||
FUNCTION(__swap_int32):
|
||||
movl %edi, %eax
|
||||
bswap %eax
|
||||
ret
|
||||
FUNCTION_END(__swap_int32)
|
||||
|
||||
/* uint64 __swap_int64(uint64 value) */
|
||||
FUNCTION(__swap_int64):
|
||||
movq %rdi, %rax
|
||||
bswap %rax
|
||||
ret
|
||||
FUNCTION_END(__swap_int64)
|
||||
|
||||
/* float __swap_float(float value) */
|
||||
FUNCTION(__swap_float):
|
||||
sub $8, %rsp
|
||||
|
||||
Reference in New Issue
Block a user