1
dnl AMD K7 mpn_copyd -- copy limb vector, decrementing.
3
dnl alignment dst/src, A=0mod8 N=4mod8
5
dnl K7 0.75 1.0 1.0 0.75
8
dnl Copyright (C) 1999, 2000 Free Software Foundation, Inc.
10
dnl This file is part of the GNU MP Library.
12
dnl The GNU MP Library is free software; you can redistribute it and/or
13
dnl modify it under the terms of the GNU Lesser General Public License as
14
dnl published by the Free Software Foundation; either version 2.1 of the
15
dnl License, or (at your option) any later version.
17
dnl The GNU MP Library is distributed in the hope that it will be useful,
18
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
19
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
dnl Lesser General Public License for more details.
22
dnl You should have received a copy of the GNU Lesser General Public
23
dnl License along with the GNU MP Library; see the file COPYING.LIB. If
24
dnl not, write to the Free Software Foundation, Inc., 59 Temple Place -
25
dnl Suite 330, Boston, MA 02111-1307, USA.
28
include(`../config.m4')
31
C void mpn_copyd (mp_ptr dst, mp_srcptr src, mp_size_t size);
33
C The various comments in mpn/x86/k7/copyi.asm apply here too.
35
defframe(PARAM_SIZE,12)
36
defframe(PARAM_SRC, 8)
37
defframe(PARAM_DST, 4)
40
dnl parameter space reused
41
define(SAVE_EBX,`PARAM_SIZE')
42
define(SAVE_ESI,`PARAM_SRC')
44
dnl minimum 5 since the unrolled code can't handle less than 5
45
deflit(UNROLL_THRESHOLD, 5)
57
cmpl $UNROLL_THRESHOLD, %ecx
69
C this loop is 2 cycles/limb
71
movl -4(%eax,%ecx,4), %ebx
72
movl %ebx, -4(%edx,%ecx,4)
83
leal (%eax,%ecx,4), %ebx
84
leal (%edx,%ecx,4), %esi
88
subl $4, %ecx C size-4
90
testl $4, %ebx C testl to pad code closer to 16 bytes for L(top)
93
C both src and dst unaligned, process one limb to align them
94
movl 12(%eax,%ecx,4), %ebx
95
movl %ebx, 12(%edx,%ecx,4)
107
movq 8(%eax,%ecx,4), %mm0
108
movq (%eax,%ecx,4), %mm1
110
movq %mm0, 16+8(%edx,%ecx,4)
111
movq %mm1, 16(%edx,%ecx,4)
115
C now %ecx is -4 to -1 representing respectively 0 to 3 limbs remaining
120
movq 8(%eax,%ecx,4), %mm0
121
movq %mm0, 8(%edx,%ecx,4)