]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/m68k/memcopy.h
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / m68k / memcopy.h
CommitLineData
eb855956 1/* memcopy.h -- definitions for memory copy functions. Motorola 68020 version.
2b778ceb 2 Copyright (C) 1991-2021 Free Software Foundation, Inc.
36e28152 3 This file is part of the GNU C Library.
eb855956
RM
4 Contributed by Torbjorn Granlund (tege@sics.se).
5
36e28152 6 The GNU C Library is free software; you can redistribute it and/or
3214b89b
AJ
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.
eb855956 10
36e28152
UD
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
3214b89b 14 Lesser General Public License for more details.
eb855956 15
3214b89b 16 You should have received a copy of the GNU Lesser General Public
ab84e3ff 17 License along with the GNU C Library. If not, see
5a82c748 18 <https://www.gnu.org/licenses/>. */
eb855956
RM
19
20#include <sysdeps/generic/memcopy.h>
21
22#if defined(__mc68020__) || defined(mc68020)
23
24#undef OP_T_THRES
25#define OP_T_THRES 16
26
27/* WORD_COPY_FWD and WORD_COPY_BWD are not symmetric on the 68020,
28 because of its weird instruction overlap characteristics. */
29
30#undef WORD_COPY_FWD
31#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
32 do \
33 { \
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) \
39 do \
40 { \
41 ((op_t *) dst_bp)[0] = ((op_t *) src_bp)[0]; \
e0cb7b61 42 /* Fall through. */ \
eb855956
RM
43 case 7: \
44 ((op_t *) dst_bp)[1] = ((op_t *) src_bp)[1]; \
e0cb7b61 45 /* Fall through. */ \
eb855956
RM
46 case 6: \
47 ((op_t *) dst_bp)[2] = ((op_t *) src_bp)[2]; \
e0cb7b61 48 /* Fall through. */ \
eb855956
RM
49 case 5: \
50 ((op_t *) dst_bp)[3] = ((op_t *) src_bp)[3]; \
e0cb7b61 51 /* Fall through. */ \
eb855956
RM
52 case 4: \
53 ((op_t *) dst_bp)[4] = ((op_t *) src_bp)[4]; \
e0cb7b61 54 /* Fall through. */ \
eb855956
RM
55 case 3: \
56 ((op_t *) dst_bp)[5] = ((op_t *) src_bp)[5]; \
e0cb7b61 57 /* Fall through. */ \
eb855956
RM
58 case 2: \
59 ((op_t *) dst_bp)[6] = ((op_t *) src_bp)[6]; \
e0cb7b61 60 /* Fall through. */ \
eb855956
RM
61 case 1: \
62 ((op_t *) dst_bp)[7] = ((op_t *) src_bp)[7]; \
e0cb7b61 63 /* Fall through. */ \
eb855956
RM
64 case 0: \
65 src_bp += 32; \
66 dst_bp += 32; \
67 __nblocks--; \
68 } \
69 while (__nblocks != 0); \
70 (nbytes_left) = (nbytes) % sizeof (op_t); \
71 } while (0)
72
73#undef WORD_COPY_BWD
74#define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes) \
75 do \
76 { \
77 size_t __nblocks = (nbytes) / 32 + 1; \
6ffbfb80
AS
78 op_t *__dst_ep = (op_t *) (dst_ep); \
79 op_t *__src_ep = (op_t *) (src_ep); \
c7486d0b 80 switch ((nbytes) / sizeof (op_t) % 8) \
eb855956
RM
81 do \
82 { \
6ffbfb80 83 *--__dst_ep = *--__src_ep; \
e0cb7b61 84 /* Fall through. */ \
eb855956 85 case 7: \
6ffbfb80 86 *--__dst_ep = *--__src_ep; \
e0cb7b61 87 /* Fall through. */ \
eb855956 88 case 6: \
6ffbfb80 89 *--__dst_ep = *--__src_ep; \
e0cb7b61 90 /* Fall through. */ \
eb855956 91 case 5: \
6ffbfb80 92 *--__dst_ep = *--__src_ep; \
e0cb7b61 93 /* Fall through. */ \
eb855956 94 case 4: \
6ffbfb80 95 *--__dst_ep = *--__src_ep; \
e0cb7b61 96 /* Fall through. */ \
eb855956 97 case 3: \
6ffbfb80 98 *--__dst_ep = *--__src_ep; \
e0cb7b61 99 /* Fall through. */ \
eb855956 100 case 2: \
6ffbfb80 101 *--__dst_ep = *--__src_ep; \
e0cb7b61 102 /* Fall through. */ \
eb855956 103 case 1: \
6ffbfb80 104 *--__dst_ep = *--__src_ep; \
e0cb7b61 105 /* Fall through. */ \
eb855956
RM
106 case 0: \
107 __nblocks--; \
108 } \
109 while (__nblocks != 0); \
110 (nbytes_left) = (nbytes) % sizeof (op_t); \
6ffbfb80
AS
111 (dst_ep) = (unsigned long) __dst_ep; \
112 (src_ep) = (unsigned long) __src_ep; \
eb855956
RM
113 } while (0)
114
115#endif