[BACK]Return to copyi.asm CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp / mpn / x86

Annotation of OpenXM_contrib/gmp/mpn/x86/copyi.asm, Revision 1.1.1.1

1.1       maekawa     1: dnl  x86 mpn_copyi -- copy limb vector, incrementing.
                      2:
                      3:
                      4: dnl  Copyright (C) 1999, 2000 Free Software Foundation, Inc.
                      5: dnl
                      6: dnl  This file is part of the GNU MP Library.
                      7: dnl
                      8: dnl  The GNU MP Library is free software; you can redistribute it and/or
                      9: dnl  modify it under the terms of the GNU Lesser General Public License as
                     10: dnl  published by the Free Software Foundation; either version 2.1 of the
                     11: dnl  License, or (at your option) any later version.
                     12: dnl
                     13: dnl  The GNU MP Library is distributed in the hope that it will be useful,
                     14: dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
                     15: dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
                     16: dnl  Lesser General Public License for more details.
                     17: dnl
                     18: dnl  You should have received a copy of the GNU Lesser General Public
                     19: dnl  License along with the GNU MP Library; see the file COPYING.LIB.  If
                     20: dnl  not, write to the Free Software Foundation, Inc., 59 Temple Place -
                     21: dnl  Suite 330, Boston, MA 02111-1307, USA.
                     22:
                     23:
                     24: include(`../config.m4')
                     25:
                     26:
                     27: C void mpn_copyi (mp_ptr dst, mp_srcptr src, mp_size_t size);
                     28: C
                     29: C Copy src,size to dst,size, working from low to high addresses.
                     30: C
                     31: C The code here is very generic and can be expected to be reasonable on all
                     32: C the x86 family.
                     33: C
                     34: C P5 - 1.0 cycles/limb.
                     35: C
                     36: C P6 - 0.75 cycles/limb.  An MMX based copy was tried, but was found to be
                     37: C      slower than a rep movs in all cases.  The fastest MMX found was 0.8
                     38: C      cycles/limb (when fully aligned).  A rep movs seems to have a startup
                     39: C      time of about 15 cycles, but doing something special for small sizes
                     40: C      could lead to a branch misprediction that would destroy any saving.
                     41: C      For now a plain rep movs seems ok for P6.
                     42:
                     43: defframe(PARAM_SIZE,12)
                     44: defframe(PARAM_SRC, 8)
                     45: defframe(PARAM_DST, 4)
                     46: deflit(`FRAME',0)
                     47:
                     48:        .text
                     49:        ALIGN(32)
                     50:
                     51:        C eax   saved esi
                     52:        C ebx
                     53:        C ecx   counter
                     54:        C edx   saved edi
                     55:        C esi   src
                     56:        C edi   dst
                     57:        C ebp
                     58:
                     59: PROLOGUE(mpn_copyi)
                     60:
                     61:        movl    PARAM_SIZE, %ecx
                     62:        movl    %esi, %eax
                     63:
                     64:        movl    PARAM_SRC, %esi
                     65:        movl    %edi, %edx
                     66:
                     67:        movl    PARAM_DST, %edi
                     68:
                     69:        cld     C better safe than sorry, see mpn/x86/README.family
                     70:
                     71:        rep
                     72:        movsl
                     73:
                     74:        movl    %eax, %esi
                     75:        movl    %edx, %edi
                     76:
                     77:        ret
                     78:
                     79: EPILOGUE()

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>