Memset and memcpy suck
Posted: Sat May 16, 2009 2:14 am
I don't see any ldmia's or stmia's in the implementations of memset or memcpy. Care to provide a better one?
For reference, here is memcpy's inner loop when doing a word-aligned copy:
For reference, here is memcpy's inner loop when doing a word-aligned copy:
Code: Select all
8000b58: 6826 ldr r6, [r4, #0]
8000b5a: 601e str r6, [r3, #0]
8000b5c: 6866 ldr r6, [r4, #4]
8000b5e: 605e str r6, [r3, #4]
8000b60: 68a6 ldr r6, [r4, #8]
8000b62: 609e str r6, [r3, #8]
8000b64: 68e6 ldr r6, [r4, #12]
8000b66: 3d10 subs r5, #16
8000b68: 60de str r6, [r3, #12]
8000b6a: 3410 adds r4, #16
8000b6c: 3310 adds r3, #16
8000b6e: 2d0f cmp r5, #15
8000b70: d8f2 bhi.n 8000b58 <memcpy+0x30>