diff options
Diffstat (limited to 'newlib/libc/machine/rx/strcat.S')
-rw-r--r-- | newlib/libc/machine/rx/strcat.S | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/newlib/libc/machine/rx/strcat.S b/newlib/libc/machine/rx/strcat.S index 7ceffb744..22533fc8d 100644 --- a/newlib/libc/machine/rx/strcat.S +++ b/newlib/libc/machine/rx/strcat.S @@ -6,6 +6,22 @@ _strcat: ;; On entry: r1 => Destination ;; r2 => Source +#ifdef __RX_DISALLOW_STRING_INSNS__ + mov r1, r4 ; Save a copy of the dest pointer. + +1: mov.b [r4+], r5 ; Find the NUL byte at the end of R4. + cmp #0, r5 + bne 1b + + sub #1, r4 ; Move R4 back to point at the NUL byte. + +2: mov.b [r2+], r5 ; Copy bytes from R2 to R4 until we reach a NUL byte. + mov.b r5, [r4+] + cmp #0, r5 + bne 2b + + rts +#else mov r1, r4 ; Save a copy of the dest pointer. mov r2, r5 ; Save a copy of the source pointer. @@ -20,3 +36,6 @@ _strcat: mov r4, r1 ; Return the original dest pointer. rts +#endif + .size _strcat, . - _strcat + |