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

Annotation of OpenXM_contrib/gmp/mpn/x86/rshift.asm, Revision 1.1.1.2

1.1       maekawa     1: dnl  x86 mpn_rshift -- mpn right shift.
                      2:
1.1.1.2 ! ohara       3: dnl  Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software
        !             4: dnl  Foundation, Inc.
1.1       maekawa     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: include(`../config.m4')
                     24:
                     25:
1.1.1.2 ! ohara      26: C     cycles/limb
        !            27: C P54:   7.5
        !            28: C P55:   7.0
        !            29: C P6:    2.5
        !            30: C K6:    4.5
        !            31: C K7:    5.0
        !            32: C P4:   16.5
        !            33:
        !            34:
1.1       maekawa    35: C mp_limb_t mpn_rshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
                     36: C                       unsigned shift);
                     37:
                     38: defframe(PARAM_SHIFT,16)
                     39: defframe(PARAM_SIZE, 12)
                     40: defframe(PARAM_SRC,  8)
                     41: defframe(PARAM_DST,  4)
                     42:
1.1.1.2 ! ohara      43:        TEXT
1.1       maekawa    44:        ALIGN(8)
                     45: PROLOGUE(mpn_rshift)
                     46:
                     47:        pushl   %edi
                     48:        pushl   %esi
                     49:        pushl   %ebx
                     50: deflit(`FRAME',12)
                     51:
                     52:        movl    PARAM_DST,%edi
                     53:        movl    PARAM_SRC,%esi
                     54:        movl    PARAM_SIZE,%edx
                     55:        movl    PARAM_SHIFT,%ecx
                     56:
                     57:        leal    -4(%edi,%edx,4),%edi
                     58:        leal    (%esi,%edx,4),%esi
                     59:        negl    %edx
                     60:
                     61:        movl    (%esi,%edx,4),%ebx      C read least significant limb
                     62:        xorl    %eax,%eax
                     63:        shrdl(  %cl, %ebx, %eax)        C compute carry limb
                     64:        incl    %edx
                     65:        jz      L(end)
                     66:        pushl   %eax                    C push carry limb onto stack
                     67:        testb   $1,%dl
                     68:        jnz     L(1)                    C enter loop in the middle
                     69:        movl    %ebx,%eax
                     70:
                     71:        ALIGN(8)
                     72: L(oop):        movl    (%esi,%edx,4),%ebx      C load next higher limb
                     73:        shrdl(  %cl, %ebx, %eax)        C compute result limb
                     74:        movl    %eax,(%edi,%edx,4)      C store it
                     75:        incl    %edx
                     76: L(1):  movl    (%esi,%edx,4),%eax
                     77:        shrdl(  %cl, %eax, %ebx)
                     78:        movl    %ebx,(%edi,%edx,4)
                     79:        incl    %edx
                     80:        jnz     L(oop)
                     81:
                     82:        shrl    %cl,%eax                C compute most significant limb
                     83:        movl    %eax,(%edi)             C store it
                     84:
                     85:        popl    %eax                    C pop carry limb
                     86:
                     87:        popl    %ebx
                     88:        popl    %esi
                     89:        popl    %edi
                     90:        ret
                     91:
                     92: L(end):        shrl    %cl,%ebx                C compute most significant limb
                     93:        movl    %ebx,(%edi)             C store it
                     94:
                     95:        popl    %ebx
                     96:        popl    %esi
                     97:        popl    %edi
                     98:        ret
                     99:
                    100: EPILOGUE()

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