summaryrefslogtreecommitdiff
path: root/newlib/libc/machine/sh/strcpy.S
diff options
context:
space:
mode:
authorChristopher Faylor <me+cygwin@cgf.cx>2000-02-17 19:39:46 +0000
committerChristopher Faylor <me+cygwin@cgf.cx>2000-02-17 19:39:46 +0000
commit43b55bace5fad27af5da7a99784667363b92c45d (patch)
tree17fe82f6ba0d93b76d10dd73d4945ab81b69db40 /newlib/libc/machine/sh/strcpy.S
parent8dabd7496a9eeaca2a7180c0a176059ba9229bb2 (diff)
downloadgdb-43b55bace5fad27af5da7a99784667363b92c45d.tar.gz
import newlib-2000-02-17 snapshotnewlib-2000-02-17SNAPSHOT
Diffstat (limited to 'newlib/libc/machine/sh/strcpy.S')
-rw-r--r--newlib/libc/machine/sh/strcpy.S41
1 files changed, 41 insertions, 0 deletions
diff --git a/newlib/libc/machine/sh/strcpy.S b/newlib/libc/machine/sh/strcpy.S
new file mode 100644
index 00000000000..63aa7e75bff
--- /dev/null
+++ b/newlib/libc/machine/sh/strcpy.S
@@ -0,0 +1,41 @@
+! Entry: r4: destination
+! r5: source
+! Exit: r0: destination
+! r1-r2,r5: clobbered
+
+#include "asm.h"
+
+ENTRY(strcpy)
+ mov r4,r0
+ or r5,r0
+ tst #3,r0
+ SL(bf, L_setup_char_loop, mov r4,r0)
+ mov.l @r5+,r1
+ mov #0,r2
+ cmp/str r2,r1
+ SL(bt, Longword_loop_end, sub r5,r0)
+ .align 2
+Longword_loop:
+ mov.l r1,@(r0,r5)
+ mov.l @r5+,r1
+ cmp/str r2,r1
+ bt Longword_loop_end
+ mov.l r1,@(r0,r5)
+ mov.l @r5+,r1
+ cmp/str r2,r1
+ bf Longword_loop
+Longword_loop_end:
+ add #-4,r5
+ add #3,r0
+ .align 2
+L_char_loop:
+ mov.b @r5+,r1
+L_char_loop_start:
+ tst r1,r1
+ SL(bf, L_char_loop, mov.b r1,@(r0,r5))
+ rts
+ mov r4,r0
+L_setup_char_loop:
+ mov.b @r5+,r1
+ bra L_char_loop_start
+ sub r5,r0