1 /* memcopy.h -- definitions for memory copy functions. Pentium version.
2 Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
3 Contributed by Torbjorn Granlund (tege@sics.se).
4 This file is part of the GNU C Library.
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 /* Get the i386 definitions. We will override some of them below. */
22 #include_next <memcopy.h>
25 /* Written like this, the Pentium pipeline can execute the loop at a
26 sustained rate of 2 instructions/clock, or asymptotically 480
27 Mbytes/second at 60Mhz. */
30 #define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
33 asm volatile ("subl $32,%2\n" \
35 "movl 0(%0),%%edx\n" /* alloc dest line */ \
37 "movl 28(%0),%%eax\n" /* alloc dest line */ \
38 "subl $32,%2\n" /* decr loop count */ \
39 "movl 0(%1),%%eax\n" /* U pipe */ \
40 "movl 4(%1),%%edx\n" /* V pipe */ \
41 "movl %%eax,0(%0)\n" /* U pipe */ \
42 "movl %%edx,4(%0)\n" /* V pipe */ \
43 "movl 8(%1),%%eax\n" \
44 "movl 12(%1),%%edx\n" \
45 "movl %%eax,8(%0)\n" \
46 "movl %%edx,12(%0)\n" \
47 "movl 16(%1),%%eax\n" \
48 "movl 20(%1),%%edx\n" \
49 "movl %%eax,16(%0)\n" \
50 "movl %%edx,20(%0)\n" \
51 "movl 24(%1),%%eax\n" \
52 "movl 28(%1),%%edx\n" \
53 "movl %%eax,24(%0)\n" \
54 "movl %%edx,28(%0)\n" \
55 "leal 32(%1),%1\n" /* update src ptr */ \
56 "leal 32(%0),%0\n" /* update dst ptr */ \
59 "=r" (dst_bp), "=r" (src_bp), "=r" (nbytes_left) : \
60 "0" (dst_bp), "1" (src_bp), "2" (nbytes) : \
65 #define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes) \
68 asm volatile ("subl $32,%2\n" \
70 "movl -4(%0),%%edx\n" \
72 "movl -32(%0),%%eax\n" \
74 "movl -4(%1),%%eax\n" \
75 "movl -8(%1),%%edx\n" \
76 "movl %%eax,-4(%0)\n" \
77 "movl %%edx,-8(%0)\n" \
78 "movl -12(%1),%%eax\n" \
79 "movl -16(%1),%%edx\n" \
80 "movl %%eax,-12(%0)\n" \
81 "movl %%edx,-16(%0)\n" \
82 "movl -20(%1),%%eax\n" \
83 "movl -24(%1),%%edx\n" \
84 "movl %%eax,-20(%0)\n" \
85 "movl %%edx,-24(%0)\n" \
86 "movl -28(%1),%%eax\n" \
87 "movl -32(%1),%%edx\n" \
88 "movl %%eax,-28(%0)\n" \
89 "movl %%edx,-32(%0)\n" \
94 "=r" (dst_ep), "=r" (src_ep), "=r" (nbytes_left) : \
95 "0" (dst_ep), "1" (src_ep), "2" (nbytes) : \