This commit is contained in:
Ulrich Drepper 2003-09-14 19:53:42 +00:00
parent 8525f64d52
commit 7e7d334885

View File

@ -22,47 +22,46 @@
/* void *memset (dstpp, c, len) */ /* void *memset (dstpp, c, len) */
ENTRY(memset) ENTRY(memset)
mov a4, a1 mov r3, r0
cmp a3, $8 @ at least 8 bytes to do? cmp r2, #8
blt 2f bcc 2f @ less than 8 bytes to move
orr a2, a2, a2, lsl $8
orr a2, a2, a2, lsl $16
1: 1:
tst a4, $3 @ aligned yet? tst r3, #3 @ aligned yet?
strneb a2, [a4], $1 strneb r1, [r3], #1
subne a3, a3, $1 subne r2, r2, #1
bne 1b bne 1b
mov ip, a2
orr r1, r1, r1, lsl $8
orr r1, r1, r1, lsl $16
1: 1:
cmp a3, $8 @ 8 bytes still to do? subs r2, r2, #8
blt 2f strcs r1, [r3], #4 @ store up to 32 bytes per loop iteration
stmia a4!, {a2, ip} strcs r1, [r3], #4
sub a3, a3, $8 subcss r2, r2, #8
cmp a3, $8 @ 8 bytes still to do? strcs r1, [r3], #4
blt 2f strcs r1, [r3], #4
stmia a4!, {a2, ip} subcss r2, r2, #8
sub a3, a3, $8 strcs r1, [r3], #4
cmp a3, $8 @ 8 bytes still to do? strcs r1, [r3], #4
blt 2f subcss r2, r2, #8
stmia a4!, {a2, ip} strcs r1, [r3], #4
sub a3, a3, $8 strcs r1, [r3], #4
cmp a3, $8 @ 8 bytes still to do? bcs 1b
stmgeia a4!, {a2, ip}
subge a3, a3, $8 and r2, r2, #7
bge 1b
2: 2:
movs a3, a3 @ anything left? subs r2, r2, #1 @ store up to 4 bytes per loop iteration
RETINSTR(moveq,pc,lr) @ nope strcsb r1, [r3], #1
rsb a3, a3, $7 subcss r2, r2, #1
add pc, pc, a3, lsl $2 strcsb r1, [r3], #1
mov r0, r0 subcss r2, r2, #1
strb a2, [a4], $1 strcsb r1, [r3], #1
strb a2, [a4], $1 subcss r2, r2, #1
strb a2, [a4], $1 strcsb r1, [r3], #1
strb a2, [a4], $1 bcs 2b
strb a2, [a4], $1
strb a2, [a4], $1 DO_RET(lr)
strb a2, [a4], $1
RETINSTR(mov,pc,lr)
END(memset) END(memset)
libc_hidden_builtin_def (memset) libc_hidden_builtin_def (memset)