Use agbabi's fix for small copies / sets

This commit is contained in:
Gwilym Kuiper 2022-06-19 17:38:34 +01:00
parent e5d35e50c8
commit 5ca8cb8bf7
2 changed files with 15 additions and 4 deletions

View file

@ -29,11 +29,11 @@ __aeabi_memcpy:
bmi .Lcopy1
bcs .Lcopy2
// If the number of bytes to copy is less than 4, we should just copy one byte at a time
cmp r2, #4
bmi .Lcopy1
.Lcopy4:
// Handle <= 2 byte copies byte-by-byte
cmp r2, #2
ble .Lcopy1
// Copy half and byte head
rsb r3, r0, #4
movs r3, r3, lsl #31

View file

@ -34,6 +34,17 @@ __aeabi_memset:
// Fallthrough
.LskipShifts:
// Handle <= 2 byte set byte-by-byte
cmp r1, #2
bgt .LskipShortHead
movs r1, r1, lsl #31
// Set byte and half
strmib r2, [r0], #1
strcsb r2, [r0], #1
strcsb r2, [r0]
bx lr
.LskipShortHead:
// JoaoBapt carry & sign bit test
rsb r3, r0, #4
movs r3, r3, lsl #31