[SOUND] Sparc CS4231: Use 64 for period_bytes_min
[linux/fpc-iii.git] / arch / m32r / lib / memcpy.S
blob800898a2d2e326e3e4ea503adb3d5cd60d78eb93
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$ */
16         .text
17 #include <linux/config.h>
18 #include <linux/linkage.h>
19 #include <asm/assembler.h>
21 #ifdef CONFIG_ISA_DUAL_ISSUE
23         .text
24 ENTRY(memcpy)
25 memcopy:
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
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
37 word_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)
43 byte_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)
48 byte_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
56 end_memcopy:
57         jmp     r14
59 #else /* not CONFIG_ISA_DUAL_ISSUE */
61         .text
62 ENTRY(memcpy)
63 memcopy:
64         mv      r4, r0
65         mv      r7, r0
66         or      r7, r1
67         beq     r0, r1, end_memcopy
68         beqz    r2, end_memcopy
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
76 word_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
83 byte_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
90 end_memcopy:
91         jmp     r14
93 #endif /* not CONFIG_ISA_DUAL_ISSUE */
95         .end