aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m32r/lib/memcpy.S
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/m32r/lib/memcpy.S
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/m32r/lib/memcpy.S')
-rw-r--r--arch/m32r/lib/memcpy.S95
1 files changed, 95 insertions, 0 deletions
diff --git a/arch/m32r/lib/memcpy.S b/arch/m32r/lib/memcpy.S
new file mode 100644
index 000000000000..800898a2d2e3
--- /dev/null
+++ b/arch/m32r/lib/memcpy.S
@@ -0,0 +1,95 @@
1/*
2 * linux/arch/m32r/lib/memcpy.S
3 *
4 * Copyright (C) 2001 Hiroyuki Kondo, and Hirokazu Takata
5 * Copyright (C) 2004 Hirokazu Takata
6 *
7 * void *memcopy(void *dst, const void *src, int n);
8 *
9 * dst: r0
10 * src: r1
11 * n : r2
12 */
13/* $Id$ */
14
15
16 .text
17#include <linux/config.h>
18#include <linux/linkage.h>
19#include <asm/assembler.h>
20
21#ifdef CONFIG_ISA_DUAL_ISSUE
22
23 .text
24ENTRY(memcpy)
25memcopy:
26 mv r4, r0 || mv r7, r0
27 or r7, r1 || cmpz r2
28 jc r14 || cmpeq r0, r1 ; return if r2=0
29 jc r14 ; return if r0=r1
30
31 and3 r7, r7, #3
32 bnez r7, byte_copy
33 srl3 r3, r2, #2
34 and3 r2, r2, #3
35 beqz r3, byte_copy
36 addi r4, #-4
37word_copy:
38 ld r7, @r1+ || addi r3, #-1
39 st r7, @+r4 || cmpz r2
40 bnez r3, word_copy
41 addi r4, #4 || jc r14 ; return if r2=0
42#if defined(CONFIG_ISA_M32R2)
43byte_copy:
44 ldb r7, @r1 || addi r1, #1
45 addi r2, #-1 || stb r7, @r4+
46 bnez r2, byte_copy
47#elif defined(CONFIG_ISA_M32R)
48byte_copy:
49 ldb r7, @r1 || addi r1, #1
50 addi r2, #-1 || stb r7, @r4
51 addi r4, #1
52 bnez r2, byte_copy
53#else
54#error unknown isa configuration
55#endif
56end_memcopy:
57 jmp r14
58
59#else /* not CONFIG_ISA_DUAL_ISSUE */
60
61 .text
62ENTRY(memcpy)
63memcopy:
64 mv r4, r0
65 mv r7, r0
66 or r7, r1
67 beq r0, r1, end_memcopy
68 beqz r2, end_memcopy
69
70 and3 r7, r7, #3
71 bnez r7, byte_copy
72 srl3 r3, r2, #2
73 and3 r2, r2, #3
74 beqz r3, byte_copy
75 addi r4, #-4
76word_copy:
77 ld r7, @r1+
78 addi r3, #-1
79 st r7, @+r4
80 bnez r3, word_copy
81 beqz r2, end_memcopy
82 addi r4, #4
83byte_copy:
84 ldb r7, @r1
85 addi r1, #1
86 addi r2, #-1
87 stb r7, @r4
88 addi r4, #1
89 bnez r2, byte_copy
90end_memcopy:
91 jmp r14
92
93#endif /* not CONFIG_ISA_DUAL_ISSUE */
94
95 .end