diff options
Diffstat (limited to 'ports/sysdeps/arm/armv6/strchr.S')
-rw-r--r-- | ports/sysdeps/arm/armv6/strchr.S | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/ports/sysdeps/arm/armv6/strchr.S b/ports/sysdeps/arm/armv6/strchr.S index c856283d53..936c2be666 100644 --- a/ports/sysdeps/arm/armv6/strchr.S +++ b/ports/sysdeps/arm/armv6/strchr.S @@ -25,7 +25,8 @@ ENTRY (strchr) @ r0 = start of string @ r1 = character to match @ returns NULL for no match, or a pointer to the match - ldrb r2, [r0] @ load the first byte asap + sfi_breg r0, \ + ldrb r2, [\B] @ load the first byte asap uxtb r1, r1 @ To cater to long strings, we want to search through a few @@ -42,7 +43,8 @@ ENTRY (strchr) beq 99f @ Loop until we find ... -1: ldrb r2, [r0, #1]! +1: sfi_breg r0, \ + ldrb r2, [\B, #1]! subs r3, r3, #1 @ ... the aligment point it ne cmpne r2, r1 @ ... or the character @@ -65,15 +67,16 @@ ENTRY (strchr) cfi_rel_offset (r6, 8) cfi_rel_offset (r7, 12) - ldrd r2, r3, [r0], #8 + sfi_breg r0, \ + ldrd r2, r3, [\B], #8 orr r1, r1, r1, lsl #8 @ Replicate C to all bytes #ifdef ARCH_HAS_T2 movw ip, #0x0101 - pld [r0, #64] + sfi_pld r0, #64 movt ip, #0x0101 #else ldr ip, =0x01010101 - pld [r0, #64] + sfi_pld r0, #64 #endif orr r1, r1, r1, lsl #16 @@ -87,13 +90,14 @@ ENTRY (strchr) uqsub8 r5, ip, r3 eor r7, r3, r1 uqsub8 r6, ip, r6 @ Find C - pld [r0, #128] @ Prefetch 2 lines ahead + sfi_pld r0, #128 @ Prefetch 2 lines ahead uqsub8 r7, ip, r7 orr r4, r4, r6 @ Combine found for EOS and C orr r5, r5, r7 orrs r6, r4, r5 @ Combine the two words it eq - ldrdeq r2, r3, [r0], #8 + sfi_breg r0, \ + ldrdeq r2, r3, [\B], #8 beq 2b @ Found something. Disambiguate between first and second words. |