Warning: This file is not a C or C++ file. It does not have highlighting.
1 | /* memcopy.h -- definitions for memory copy functions. Motorola 68020 version. |
---|---|
2 | Copyright (C) 1991-2022 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2.1 of the License, or (at your option) any later version. |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library. If not, see |
17 | <https://www.gnu.org/licenses/>. */ |
18 | |
19 | #include <sysdeps/generic/memcopy.h> |
20 | |
21 | #if defined(__mc68020__) || defined(mc68020) |
22 | |
23 | #undef OP_T_THRES |
24 | #define OP_T_THRES 16 |
25 | |
26 | /* WORD_COPY_FWD and WORD_COPY_BWD are not symmetric on the 68020, |
27 | because of its weird instruction overlap characteristics. */ |
28 | |
29 | #undef WORD_COPY_FWD |
30 | #define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \ |
31 | do \ |
32 | { \ |
33 | size_t __nwords = (nbytes) / sizeof (op_t); \ |
34 | size_t __nblocks = __nwords / 8 + 1; \ |
35 | dst_bp -= (8 - __nwords % 8) * sizeof (op_t); \ |
36 | src_bp -= (8 - __nwords % 8) * sizeof (op_t); \ |
37 | switch (__nwords % 8) \ |
38 | do \ |
39 | { \ |
40 | ((op_t *) dst_bp)[0] = ((op_t *) src_bp)[0]; \ |
41 | /* Fall through. */ \ |
42 | case 7: \ |
43 | ((op_t *) dst_bp)[1] = ((op_t *) src_bp)[1]; \ |
44 | /* Fall through. */ \ |
45 | case 6: \ |
46 | ((op_t *) dst_bp)[2] = ((op_t *) src_bp)[2]; \ |
47 | /* Fall through. */ \ |
48 | case 5: \ |
49 | ((op_t *) dst_bp)[3] = ((op_t *) src_bp)[3]; \ |
50 | /* Fall through. */ \ |
51 | case 4: \ |
52 | ((op_t *) dst_bp)[4] = ((op_t *) src_bp)[4]; \ |
53 | /* Fall through. */ \ |
54 | case 3: \ |
55 | ((op_t *) dst_bp)[5] = ((op_t *) src_bp)[5]; \ |
56 | /* Fall through. */ \ |
57 | case 2: \ |
58 | ((op_t *) dst_bp)[6] = ((op_t *) src_bp)[6]; \ |
59 | /* Fall through. */ \ |
60 | case 1: \ |
61 | ((op_t *) dst_bp)[7] = ((op_t *) src_bp)[7]; \ |
62 | /* Fall through. */ \ |
63 | case 0: \ |
64 | src_bp += 32; \ |
65 | dst_bp += 32; \ |
66 | __nblocks--; \ |
67 | } \ |
68 | while (__nblocks != 0); \ |
69 | (nbytes_left) = (nbytes) % sizeof (op_t); \ |
70 | } while (0) |
71 | |
72 | #undef WORD_COPY_BWD |
73 | #define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes) \ |
74 | do \ |
75 | { \ |
76 | size_t __nblocks = (nbytes) / 32 + 1; \ |
77 | op_t *__dst_ep = (op_t *) (dst_ep); \ |
78 | op_t *__src_ep = (op_t *) (src_ep); \ |
79 | switch ((nbytes) / sizeof (op_t) % 8) \ |
80 | do \ |
81 | { \ |
82 | *--__dst_ep = *--__src_ep; \ |
83 | /* Fall through. */ \ |
84 | case 7: \ |
85 | *--__dst_ep = *--__src_ep; \ |
86 | /* Fall through. */ \ |
87 | case 6: \ |
88 | *--__dst_ep = *--__src_ep; \ |
89 | /* Fall through. */ \ |
90 | case 5: \ |
91 | *--__dst_ep = *--__src_ep; \ |
92 | /* Fall through. */ \ |
93 | case 4: \ |
94 | *--__dst_ep = *--__src_ep; \ |
95 | /* Fall through. */ \ |
96 | case 3: \ |
97 | *--__dst_ep = *--__src_ep; \ |
98 | /* Fall through. */ \ |
99 | case 2: \ |
100 | *--__dst_ep = *--__src_ep; \ |
101 | /* Fall through. */ \ |
102 | case 1: \ |
103 | *--__dst_ep = *--__src_ep; \ |
104 | /* Fall through. */ \ |
105 | case 0: \ |
106 | __nblocks--; \ |
107 | } \ |
108 | while (__nblocks != 0); \ |
109 | (nbytes_left) = (nbytes) % sizeof (op_t); \ |
110 | (dst_ep) = (unsigned long) __dst_ep; \ |
111 | (src_ep) = (unsigned long) __src_ep; \ |
112 | } while (0) |
113 | |
114 | #endif |
115 |
Warning: This file is not a C or C++ file. It does not have highlighting.