summaryrefslogtreecommitdiffstats
path: root/newlib/libc/machine/rx/strcat.S
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-04-09 09:20:00 +0100
committerCorinna Vinschen <corinna@vinschen.de>2015-04-23 21:57:13 +0200
commitcd0d45913525ef09f0494a2f0c8e3d6fe8fface2 (patch)
treedcbb6a0c97dc45cc7df625cbeb4d1a99f503d247 /newlib/libc/machine/rx/strcat.S
parent45d0b17928067ee848aae2cd5bd332129ca35c42 (diff)
downloadcygnal-cd0d45913525ef09f0494a2f0c8e3d6fe8fface2.tar.gz
cygnal-cd0d45913525ef09f0494a2f0c8e3d6fe8fface2.tar.bz2
cygnal-cd0d45913525ef09f0494a2f0c8e3d6fe8fface2.zip
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.
Diffstat (limited to 'newlib/libc/machine/rx/strcat.S')
-rw-r--r--newlib/libc/machine/rx/strcat.S19
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
+