1 /* memcopy.h -- definitions for memory copy functions. Motorola 68020 version.
2 Copyright (C) 1991-2016 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Torbjorn Granlund (tege@sics.se).
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library. If not, see
18 <http://www.gnu.org/licenses/>. */
20 #include <sysdeps/generic/memcopy.h>
22 #if defined(__mc68020__) || defined(mc68020)
27 /* WORD_COPY_FWD and WORD_COPY_BWD are not symmetric on the 68020,
28 because of its weird instruction overlap characteristics. */
31 #define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
34 size_t __nwords = (nbytes) / sizeof (op_t); \
35 size_t __nblocks = __nwords / 8 + 1; \
36 dst_bp -= (8 - __nwords % 8) * sizeof (op_t); \
37 src_bp -= (8 - __nwords % 8) * sizeof (op_t); \
38 switch (__nwords % 8) \
41 ((op_t *) dst_bp)[0] = ((op_t *) src_bp)[0]; \
43 ((op_t *) dst_bp)[1] = ((op_t *) src_bp)[1]; \
45 ((op_t *) dst_bp)[2] = ((op_t *) src_bp)[2]; \
47 ((op_t *) dst_bp)[3] = ((op_t *) src_bp)[3]; \
49 ((op_t *) dst_bp)[4] = ((op_t *) src_bp)[4]; \
51 ((op_t *) dst_bp)[5] = ((op_t *) src_bp)[5]; \
53 ((op_t *) dst_bp)[6] = ((op_t *) src_bp)[6]; \
55 ((op_t *) dst_bp)[7] = ((op_t *) src_bp)[7]; \
61 while (__nblocks != 0); \
62 (nbytes_left) = (nbytes) % sizeof (op_t); \
66 #define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes) \
69 size_t __nblocks = (nbytes) / 32 + 1; \
70 op_t *__dst_ep = (op_t *) (dst_ep); \
71 op_t *__src_ep = (op_t *) (src_ep); \
72 switch ((nbytes) / sizeof (op_t) % 8) \
75 *--__dst_ep = *--__src_ep; \
77 *--__dst_ep = *--__src_ep; \
79 *--__dst_ep = *--__src_ep; \
81 *--__dst_ep = *--__src_ep; \
83 *--__dst_ep = *--__src_ep; \
85 *--__dst_ep = *--__src_ep; \
87 *--__dst_ep = *--__src_ep; \
89 *--__dst_ep = *--__src_ep; \
93 while (__nblocks != 0); \
94 (nbytes_left) = (nbytes) % sizeof (op_t); \
95 (dst_ep) = (unsigned long) __dst_ep; \
96 (src_ep) = (unsigned long) __src_ep; \