summaryrefslogtreecommitdiffstats
path: root/newlib/libc/machine/rx/memmove.S
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/machine/rx/memmove.S')
-rw-r--r--newlib/libc/machine/rx/memmove.S20
1 files changed, 20 insertions, 0 deletions
diff --git a/newlib/libc/machine/rx/memmove.S b/newlib/libc/machine/rx/memmove.S
new file mode 100644
index 000000000..4b126bafc
--- /dev/null
+++ b/newlib/libc/machine/rx/memmove.S
@@ -0,0 +1,20 @@
+ .file "memmove.S"
+
+ .section .text
+ .global _memmove
+ .type _memmove,@function
+_memmove:
+ mov r1, r4 ; Save a copy of DEST
+ cmp r1, r2
+ blt 2f ; If SRC (r2) is less than DEST (r1) then copy backwards
+ smovf
+1:
+ mov r4, r1 ; Return DEST
+ rts
+2:
+ add r3, r1 ; The SMOVB instructions requires the DEST in r1 and the
+ add r3, r2 ; SRC in r2 but it needs them to point the last bytes of
+ sub #1, r2 ; the regions involved not the first bytes, hence these
+ sub #1, r1 ; additions and subtractions.
+ smovb
+ bra 1b