Update.
[glibc.git] / sysdeps / m68k / memcopy.h
blobb4d46143819b7e93f8c5239899beccb2c2d88cdb
1 /* memcopy.h -- definitions for memory copy functions. Motorola 68020 version.
2 Copyright (C) 1991, 1997 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 Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 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 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 #include <sysdeps/generic/memcopy.h>
23 #if defined(__mc68020__) || defined(mc68020)
25 #undef OP_T_THRES
26 #define OP_T_THRES 16
28 /* WORD_COPY_FWD and WORD_COPY_BWD are not symmetric on the 68020,
29 because of its weird instruction overlap characteristics. */
31 #undef WORD_COPY_FWD
32 #define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
33 do \
34 { \
35 size_t __nwords = (nbytes) / sizeof (op_t); \
36 size_t __nblocks = __nwords / 8 + 1; \
37 dst_bp -= (8 - __nwords % 8) * sizeof (op_t); \
38 src_bp -= (8 - __nwords % 8) * sizeof (op_t); \
39 switch (__nwords % 8) \
40 do \
41 { \
42 ((op_t *) dst_bp)[0] = ((op_t *) src_bp)[0]; \
43 case 7: \
44 ((op_t *) dst_bp)[1] = ((op_t *) src_bp)[1]; \
45 case 6: \
46 ((op_t *) dst_bp)[2] = ((op_t *) src_bp)[2]; \
47 case 5: \
48 ((op_t *) dst_bp)[3] = ((op_t *) src_bp)[3]; \
49 case 4: \
50 ((op_t *) dst_bp)[4] = ((op_t *) src_bp)[4]; \
51 case 3: \
52 ((op_t *) dst_bp)[5] = ((op_t *) src_bp)[5]; \
53 case 2: \
54 ((op_t *) dst_bp)[6] = ((op_t *) src_bp)[6]; \
55 case 1: \
56 ((op_t *) dst_bp)[7] = ((op_t *) src_bp)[7]; \
57 case 0: \
58 src_bp += 32; \
59 dst_bp += 32; \
60 __nblocks--; \
61 } \
62 while (__nblocks != 0); \
63 (nbytes_left) = (nbytes) % sizeof (op_t); \
64 } while (0)
66 #undef WORD_COPY_BWD
67 #define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes) \
68 do \
69 { \
70 size_t __nblocks = (nbytes) / 32 + 1; \
71 switch ((nbytes) / sizeof (op_t) % 8) \
72 do \
73 { \
74 *--((op_t *) dst_ep) = *--((op_t *) src_ep); \
75 case 7: \
76 *--((op_t *) dst_ep) = *--((op_t *) src_ep); \
77 case 6: \
78 *--((op_t *) dst_ep) = *--((op_t *) src_ep); \
79 case 5: \
80 *--((op_t *) dst_ep) = *--((op_t *) src_ep); \
81 case 4: \
82 *--((op_t *) dst_ep) = *--((op_t *) src_ep); \
83 case 3: \
84 *--((op_t *) dst_ep) = *--((op_t *) src_ep); \
85 case 2: \
86 *--((op_t *) dst_ep) = *--((op_t *) src_ep); \
87 case 1: \
88 *--((op_t *) dst_ep) = *--((op_t *) src_ep); \
89 case 0: \
90 __nblocks--; \
91 } \
92 while (__nblocks != 0); \
93 (nbytes_left) = (nbytes) % sizeof (op_t); \
94 } while (0)
96 #endif