sysfs: remove DEBUG defines
[linux/fpc-iii.git] / arch / m32r / lib / memcpy.S
blob249da3e3358dd66882bcf542b8b5d4dceef876b2
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  *  linux/arch/m32r/lib/memcpy.S
4  *
5  *  Copyright (C) 2001  Hiroyuki Kondo, and Hirokazu Takata
6  *  Copyright (C) 2004  Hirokazu Takata
7  *
8  *  void *memcopy(void *dst, const void *src, int n);
9  *
10  *        dst: r0
11  *        src: r1
12  *        n  : r2
13  */
15         .text
16 #include <linux/linkage.h>
17 #include <asm/assembler.h>
19 #ifdef CONFIG_ISA_DUAL_ISSUE
21         .text
22 ENTRY(memcpy)
23 memcopy:
24         mv      r4, r0              ||  mv      r7, r0
25         or      r7, r1              ||  cmpz    r2
26         jc      r14                 ||  cmpeq   r0, r1  ; return if r2=0
27         jc      r14                                     ; return if r0=r1
29         and3    r7, r7, #3
30         bnez    r7, byte_copy
31         srl3    r3, r2, #2
32         and3    r2, r2, #3
33         beqz    r3, byte_copy
34         addi    r4, #-4
35 word_copy:
36         ld      r7, @r1+            ||  addi    r3, #-1
37         st      r7, @+r4            ||  cmpz    r2
38         bnez    r3, word_copy
39         addi    r4, #4              ||  jc      r14     ; return if r2=0
40 #if defined(CONFIG_ISA_M32R2)
41 byte_copy:
42         ldb     r7, @r1             ||  addi    r1, #1
43         addi    r2, #-1             ||  stb     r7, @r4+
44         bnez    r2, byte_copy
45 #elif defined(CONFIG_ISA_M32R)
46 byte_copy:
47         ldb     r7, @r1             ||  addi    r1, #1
48         addi    r2, #-1             ||  stb     r7, @r4
49         addi    r4, #1
50         bnez    r2, byte_copy
51 #else
52 #error unknown isa configuration
53 #endif
54 end_memcopy:
55         jmp     r14
57 #else /* not CONFIG_ISA_DUAL_ISSUE */
59         .text
60 ENTRY(memcpy)
61 memcopy:
62         mv      r4, r0
63         mv      r7, r0
64         or      r7, r1
65         beq     r0, r1, end_memcopy
66         beqz    r2, end_memcopy
68         and3    r7, r7, #3
69         bnez    r7, byte_copy
70         srl3    r3, r2, #2
71         and3    r2, r2, #3
72         beqz    r3, byte_copy
73         addi    r4, #-4
74 word_copy:
75         ld      r7, @r1+
76         addi    r3, #-1
77         st      r7, @+r4
78         bnez    r3, word_copy
79         beqz    r2, end_memcopy
80         addi    r4, #4
81 byte_copy:
82         ldb     r7, @r1
83         addi    r1, #1
84         addi    r2, #-1
85         stb     r7, @r4
86         addi    r4, #1
87         bnez    r2, byte_copy
88 end_memcopy:
89         jmp     r14
91 #endif /* not CONFIG_ISA_DUAL_ISSUE */
93         .end