OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [machine/] [xscale/] [memcpy.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1010 ivang
#if defined __thumb__
2
 
3
#include "../../string/memcpy.c"
4
 
5
#else
6
 
7
#include <string.h>
8
#include "xscale.h"
9
 
10
void *
11
memcpy (void *dst0, const void *src0, size_t len)
12
{
13
  int dummy;
14
  asm volatile (
15
#ifndef __OPTIMIZE_SIZE__
16
       "cmp     %2, #0x3
17
        bls     3f
18
        and     lr, %1, #0x3
19
        and     r3, %0, #0x3
20
        cmp     lr, r3
21
        bne     3f
22
        cmp     lr, #0x0
23
        beq     2f
24
        b       1f
25
0:
26
        ldrb    r3, [%1], #1
27
"
28
        PRELOADSTR ("%1")
29
"
30
        tst     %1, #0x3
31
        strb    r3, [%0], #1
32
        beq     3f
33
1:
34
        sub     %2, %2, #1
35
        cmn     %2, #1
36
        bne     0b
37
2:
38
        cmp     %2, #0xf
39
        bls     1f
40
0:
41
        ldmia   %1!, { r3, r4, r5, lr }
42
"
43
        PRELOADSTR ("%1")
44
"
45
 
46
        sub     %2, %2, #16
47
        cmp     %2, #0xf
48
        stmia   %0!, { r3, r4, r5, lr }
49
        bhi     0b
50
1:
51
        cmp     %2, #0x7
52
        bls     1f
53
0:
54
        ldmia   %1!, { r3, r4 }
55
"
56
        PRELOADSTR ("%1")
57
"
58
 
59
        sub     %2, %2, #8
60
        cmp     %2, #0x7
61
        stmia   %0!, { r3, r4 }
62
        bhi     0b
63
1:
64
        cmp     %2, #0x3
65
        bls     3f
66
0:
67
        sub     %2, %2, #4
68
        ldr     r3, [%1], #4
69
"
70
        PRELOADSTR ("%1")
71
"
72
 
73
        cmp     %2, #0x3
74
        str     r3, [%0], #4
75
        bhi     0b
76
"
77
#endif /* !__OPTIMIZE_SIZE__ */
78
"
79
3:
80
"
81
        PRELOADSTR ("%1")
82
"
83
        sub     %2, %2, #1
84
        cmn     %2, #1
85
        beq     1f
86
0:
87
        sub     %2, %2, #1
88
        ldrb    r3, [%1], #1
89
"
90
        PRELOADSTR ("%1")
91
"
92
        cmn     %2, #1
93
        strb    r3, [%0], #1
94
        bne     0b
95
1:"
96
       : "=&r" (dummy), "=&r" (src0), "=&r" (len)
97
       : "0" (dst0), "1" (src0), "2" (len)
98
       : "memory", "lr", "r3", "r4", "r5", "cc");
99
  return dst0;
100
}
101
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.