github.com/aergoio/aergo@v1.3.1/libtool/src/gmp-6.1.2/mpn/x86/copyd.asm (about)

     1  dnl  x86 mpn_copyd -- copy limb vector, decrementing.
     2  
     3  dnl  Copyright 1999-2002 Free Software Foundation, Inc.
     4  
     5  dnl  This file is part of the GNU MP Library.
     6  dnl
     7  dnl  The GNU MP Library is free software; you can redistribute it and/or modify
     8  dnl  it under the terms of either:
     9  dnl
    10  dnl    * the GNU Lesser General Public License as published by the Free
    11  dnl      Software Foundation; either version 3 of the License, or (at your
    12  dnl      option) any later version.
    13  dnl
    14  dnl  or
    15  dnl
    16  dnl    * the GNU General Public License as published by the Free Software
    17  dnl      Foundation; either version 2 of the License, or (at your option) any
    18  dnl      later version.
    19  dnl
    20  dnl  or both in parallel, as here.
    21  dnl
    22  dnl  The GNU MP Library is distributed in the hope that it will be useful, but
    23  dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    24  dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    25  dnl  for more details.
    26  dnl
    27  dnl  You should have received copies of the GNU General Public License and the
    28  dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
    29  dnl  see https://www.gnu.org/licenses/.
    30  
    31  include(`../config.m4')
    32  
    33  
    34  C     cycles/limb  startup (approx)
    35  C P5	  1.0	      40
    36  C P6	  2.4	      70
    37  C K6	  1.0	      55
    38  C K7	  1.3	      75
    39  C P4	  2.6	     175
    40  C
    41  C (Startup time includes some function call overheads.)
    42  
    43  
    44  C void mpn_copyd (mp_ptr dst, mp_srcptr src, mp_size_t size);
    45  C
    46  C Copy src,size to dst,size, working from high to low addresses.
    47  C
    48  C The code here is very generic and can be expected to be reasonable on all
    49  C the x86 family.
    50  
    51  defframe(PARAM_SIZE,12)
    52  defframe(PARAM_SRC, 8)
    53  defframe(PARAM_DST, 4)
    54  deflit(`FRAME',0)
    55  
    56  	TEXT
    57  	ALIGN(32)
    58  
    59  PROLOGUE(mpn_copyd)
    60  	C eax	saved esi
    61  	C ebx
    62  	C ecx	counter
    63  	C edx	saved edi
    64  	C esi	src
    65  	C edi	dst
    66  	C ebp
    67  
    68  	movl	PARAM_SIZE, %ecx
    69  	movl	%esi, %eax
    70  
    71  	movl	PARAM_SRC, %esi
    72  	movl	%edi, %edx
    73  
    74  	movl	PARAM_DST, %edi
    75  	leal	-4(%esi,%ecx,4), %esi
    76  
    77  	leal	-4(%edi,%ecx,4), %edi
    78  
    79  	std
    80  
    81  	rep
    82  	movsl
    83  
    84  	cld
    85  
    86  	movl	%eax, %esi
    87  	movl	%edx, %edi
    88  
    89  	ret
    90  
    91  EPILOGUE()