glibc/sysdeps/m68k/memcopy.h

116 lines
4.3 KiB
C
Raw Normal View History

1991-12-08 23:55:00 +00:00
/* memcopy.h -- definitions for memory copy functions. Motorola 68020 version.
Copyright (C) 1991-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
1991-12-08 23:55:00 +00:00
Contributed by Torbjorn Granlund (tege@sics.se).
The GNU C Library is free software; you can redistribute it and/or
2001-07-06 04:56:23 +00:00
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
1991-12-08 23:55:00 +00:00
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2001-07-06 04:56:23 +00:00
Lesser General Public License for more details.
1991-12-08 23:55:00 +00:00
2001-07-06 04:56:23 +00:00
You should have received a copy of the GNU Lesser General Public
2012-03-09 23:56:38 +00:00
License along with the GNU C Library. If not, see
Prefer https to http for gnu.org and fsf.org URLs Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
<https://www.gnu.org/licenses/>. */
1991-12-08 23:55:00 +00:00
#include <sysdeps/generic/memcopy.h>
#if defined(__mc68020__) || defined(mc68020)
#undef OP_T_THRES
#define OP_T_THRES 16
/* WORD_COPY_FWD and WORD_COPY_BWD are not symmetric on the 68020,
because of its weird instruction overlap characteristics. */
#undef WORD_COPY_FWD
#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
do \
{ \
size_t __nwords = (nbytes) / sizeof (op_t); \
size_t __nblocks = __nwords / 8 + 1; \
dst_bp -= (8 - __nwords % 8) * sizeof (op_t); \
src_bp -= (8 - __nwords % 8) * sizeof (op_t); \
switch (__nwords % 8) \
do \
{ \
((op_t *) dst_bp)[0] = ((op_t *) src_bp)[0]; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 7: \
((op_t *) dst_bp)[1] = ((op_t *) src_bp)[1]; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 6: \
((op_t *) dst_bp)[2] = ((op_t *) src_bp)[2]; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 5: \
((op_t *) dst_bp)[3] = ((op_t *) src_bp)[3]; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 4: \
((op_t *) dst_bp)[4] = ((op_t *) src_bp)[4]; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 3: \
((op_t *) dst_bp)[5] = ((op_t *) src_bp)[5]; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 2: \
((op_t *) dst_bp)[6] = ((op_t *) src_bp)[6]; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 1: \
((op_t *) dst_bp)[7] = ((op_t *) src_bp)[7]; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 0: \
src_bp += 32; \
dst_bp += 32; \
__nblocks--; \
} \
while (__nblocks != 0); \
(nbytes_left) = (nbytes) % sizeof (op_t); \
} while (0)
#undef WORD_COPY_BWD
#define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes) \
do \
{ \
size_t __nblocks = (nbytes) / 32 + 1; \
op_t *__dst_ep = (op_t *) (dst_ep); \
op_t *__src_ep = (op_t *) (src_ep); \
1992-03-17 16:42:55 +00:00
switch ((nbytes) / sizeof (op_t) % 8) \
1991-12-08 23:55:00 +00:00
do \
{ \
*--__dst_ep = *--__src_ep; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 7: \
*--__dst_ep = *--__src_ep; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 6: \
*--__dst_ep = *--__src_ep; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 5: \
*--__dst_ep = *--__src_ep; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 4: \
*--__dst_ep = *--__src_ep; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 3: \
*--__dst_ep = *--__src_ep; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 2: \
*--__dst_ep = *--__src_ep; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 1: \
*--__dst_ep = *--__src_ep; \
/* Fall through. */ \
1991-12-08 23:55:00 +00:00
case 0: \
__nblocks--; \
} \
while (__nblocks != 0); \
(nbytes_left) = (nbytes) % sizeof (op_t); \
(dst_ep) = (unsigned long) __dst_ep; \
(src_ep) = (unsigned long) __src_ep; \
1991-12-08 23:55:00 +00:00
} while (0)
#endif