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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [machine/] [xscale/] [memcpy.c] - Blame information for rev 207

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
#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\n\
17
        bls     3f\n\
18
        and     lr, %1, #0x3\n\
19
        and     r3, %0, #0x3\n\
20
        cmp     lr, r3\n\
21
        bne     3f\n\
22
        cmp     lr, #0x0\n\
23
        beq     2f\n\
24
        b       1f\n\
25
0:\n\
26
        ldrb    r3, [%1], #1\n\
27
"
28
        PRELOADSTR ("%1")
29
"\n\
30
        tst     %1, #0x3\n\
31
        strb    r3, [%0], #1\n\
32
        beq     3f\n\
33
1:\n\
34
        sub     %2, %2, #1\n\
35
        cmn     %2, #1\n\
36
        bne     0b\n\
37
2:\n\
38
        cmp     %2, #0xf\n\
39
        bls     1f\n\
40
0:\n\
41
        ldmia   %1!, { r3, r4, r5, lr }\n\
42
"
43
        PRELOADSTR ("%1")
44
"\n\
45
\n\
46
        sub     %2, %2, #16\n\
47
        cmp     %2, #0xf\n\
48
        stmia   %0!, { r3, r4, r5, lr }\n\
49
        bhi     0b\n\
50
1:\n\
51
        cmp     %2, #0x7\n\
52
        bls     1f\n\
53
0:\n\
54
        ldmia   %1!, { r3, r4 }\n\
55
"
56
        PRELOADSTR ("%1")
57
"\n\
58
\n\
59
        sub     %2, %2, #8\n\
60
        cmp     %2, #0x7\n\
61
        stmia   %0!, { r3, r4 }\n\
62
        bhi     0b\n\
63
1:\n\
64
        cmp     %2, #0x3\n\
65
        bls     3f\n\
66
0:\n\
67
        sub     %2, %2, #4\n\
68
        ldr     r3, [%1], #4\n\
69
"
70
        PRELOADSTR ("%1")
71
"\n\
72
\n\
73
        cmp     %2, #0x3\n\
74
        str     r3, [%0], #4\n\
75
        bhi     0b\n\
76
"
77
#endif /* !__OPTIMIZE_SIZE__ */
78
"\n\
79
3:\n\
80
"
81
        PRELOADSTR ("%1")
82
"\n\
83
        sub     %2, %2, #1\n\
84
        cmn     %2, #1\n\
85
        beq     1f\n\
86
0:\n\
87
        sub     %2, %2, #1\n\
88
        ldrb    r3, [%1], #1\n\
89
"
90
        PRELOADSTR ("%1")
91
"\n\
92
        cmn     %2, #1\n\
93
        strb    r3, [%0], #1\n\
94
        bne     0b\n\
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.