diff options
author | Roland McGrath <roland@gnu.org> | 1991-12-08 23:55:00 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1991-12-08 23:55:00 +0000 |
commit | eb855956fb65f86c3b23ab2c86f87369489fc049 (patch) | |
tree | c54f6b6f22c5bf22f6ea3d56e92b27eefef6c53e /sysdeps | |
parent | 1dd568a93ee4eaa84bc5a6cf638e91333c6d17bb (diff) | |
download | glibc-eb855956fb65f86c3b23ab2c86f87369489fc049.tar glibc-eb855956fb65f86c3b23ab2c86f87369489fc049.tar.gz glibc-eb855956fb65f86c3b23ab2c86f87369489fc049.tar.bz2 glibc-eb855956fb65f86c3b23ab2c86f87369489fc049.zip |
Initial revision
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/m68k/memcopy.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/sysdeps/m68k/memcopy.h b/sysdeps/m68k/memcopy.h new file mode 100644 index 0000000000..7b0385c273 --- /dev/null +++ b/sysdeps/m68k/memcopy.h @@ -0,0 +1,95 @@ +/* memcopy.h -- definitions for memory copy functions. Motorola 68020 version. + Copyright (C) 1991 Free Software Foundation, Inc. + Contributed by Torbjorn Granlund (tege@sics.se). + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#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]; \ + case 7: \ + ((op_t *) dst_bp)[1] = ((op_t *) src_bp)[1]; \ + case 6: \ + ((op_t *) dst_bp)[2] = ((op_t *) src_bp)[2]; \ + case 5: \ + ((op_t *) dst_bp)[3] = ((op_t *) src_bp)[3]; \ + case 4: \ + ((op_t *) dst_bp)[4] = ((op_t *) src_bp)[4]; \ + case 3: \ + ((op_t *) dst_bp)[5] = ((op_t *) src_bp)[5]; \ + case 2: \ + ((op_t *) dst_bp)[6] = ((op_t *) src_bp)[6]; \ + case 1: \ + ((op_t *) dst_bp)[7] = ((op_t *) src_bp)[7]; \ + 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; \ + switch ((nbytes) % 32 / sizeof (op_t)) \ + do \ + { \ + --((op_t *) dst_ep) = --((op_t *) src_ep); \ + case 7: \ + --((op_t *) dst_ep) = --((op_t *) src_ep); \ + case 6: \ + --((op_t *) dst_ep) = --((op_t *) src_ep); \ + case 5: \ + --((op_t *) dst_ep) = --((op_t *) src_ep); \ + case 4: \ + --((op_t *) dst_ep) = --((op_t *) src_ep); \ + case 3: \ + --((op_t *) dst_ep) = --((op_t *) src_ep); \ + case 2: \ + --((op_t *) dst_ep) = --((op_t *) src_ep); \ + case 1: \ + --((op_t *) dst_ep) = --((op_t *) src_ep); \ + case 0: \ + __nblocks--; \ + } \ + while (__nblocks != 0); \ + (nbytes_left) = (nbytes) % sizeof (op_t); \ + } while (0) + +#endif |