4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-17 03:49:46 +08:00
Nick Clifton cd0d459135 For the RX port, avoid using string instructions when __RX_DISALLOW_STRING_INSNS__ is defined.
* rx/crt0.S (_start): If string instructions are not allowed,
	avoid using SMOVF.

	* libc/machine/rx/memchr.S: Add non-string insn using version.
	* libc/machine/rx/memcpy.S: Likewise.
	* libc/machine/rx/memmove.S: Likewise.
	* libc/machine/rx/mempcpy.S: Likewise.
	* libc/machine/rx/strcat.S: Likewise.
	* libc/machine/rx/strcmp.S: Likewise.
	* libc/machine/rx/strcpy.S: Likewise.
	* libc/machine/rx/strlen.S: Likewise.
	* libc/machine/rx/strncat.S: Likewise.
	* libc/machine/rx/strncmp.S: Likewise.
	* libc/machine/rx/strncpy.S: Likewise.
2015-04-23 21:57:13 +02:00

30 lines
668 B
ArmAsm

.file "strlen.S"
.section .text
.global _strlen
.type _strlen,@function
_strlen:
#ifdef __RX_DISALLOW_STRING_INSNS__
mov r1, r4
1: mov.b [r1+], r5
cmp #0, r5
bne 1b
sub #1, r1
sub r4, r1
rts
#else
add #0, r1, r4 ; Save a copy of the string start address and set the condition flags.
beq null_string ; Test for a NULL pointer.
mov #-1, r3 ; Set a limit on the number of bytes examined.
mov #0, r2 ; Stop searching when we find a NUL byte.
suntil.b ; Search until *r1 == r2
sub #1, r1 ; suntil.b leaves r1 pointing to the byte beyond the match.
null_string:
sub r4, r1 ; Compute the length.
rts
#endif
.size _strlen, . - _strlen