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

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

1.1       maekawa     1: dnl  x86 __gmpn_addmul_1 (for 386 and 486) -- Multiply a limb vector with a
                      2: dnl  limb and add the result to a second limb vector.
                      3:
1.1.1.2 ! ohara       4: dnl  Copyright 1992, 1994, 1997, 1999, 2000, 2001, 2002 Free Software
        !             5: dnl  Foundation, Inc.
1.1       maekawa     6: dnl
                      7: dnl  This file is part of the GNU MP Library.
                      8: dnl
                      9: dnl  The GNU MP Library is free software; you can redistribute it and/or
                     10: dnl  modify it under the terms of the GNU Lesser General Public License as
                     11: dnl  published by the Free Software Foundation; either version 2.1 of the
                     12: dnl  License, or (at your option) any later version.
                     13: dnl
                     14: dnl  The GNU MP Library is distributed in the hope that it will be useful,
                     15: dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
                     16: dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
                     17: dnl  Lesser General Public License for more details.
                     18: dnl
                     19: dnl  You should have received a copy of the GNU Lesser General Public
                     20: dnl  License along with the GNU MP Library; see the file COPYING.LIB.  If
                     21: dnl  not, write to the Free Software Foundation, Inc., 59 Temple Place -
                     22: dnl  Suite 330, Boston, MA 02111-1307, USA.
                     23:
                     24: include(`../config.m4')
1.1.1.2 ! ohara      25:
        !            26:
        !            27: C     cycles/limb
        !            28: C P5:   14.75
        !            29: C P6:    7.5
        !            30: C K6:   12.5
        !            31: C K7:    5.25
        !            32: C P4:   24
1.1       maekawa    33:
                     34:
                     35: ifdef(`OPERATION_addmul_1',`
                     36:       define(M4_inst,        addl)
                     37:       define(M4_function_1,  mpn_addmul_1)
                     38:
                     39: ',`ifdef(`OPERATION_submul_1',`
                     40:       define(M4_inst,        subl)
                     41:       define(M4_function_1,  mpn_submul_1)
                     42:
                     43: ',`m4_error(`Need OPERATION_addmul_1 or OPERATION_submul_1
                     44: ')')')
                     45:
                     46: MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
                     47:
                     48:
                     49: C mp_limb_t M4_function_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
                     50: C                          mp_limb_t mult);
                     51:
                     52: define(PARAM_MULTIPLIER, `FRAME+16(%esp)')
                     53: define(PARAM_SIZE,       `FRAME+12(%esp)')
                     54: define(PARAM_SRC,        `FRAME+8(%esp)')
                     55: define(PARAM_DST,        `FRAME+4(%esp)')
                     56:
                     57:        TEXT
                     58:        ALIGN(8)
                     59:
                     60: PROLOGUE(M4_function_1)
                     61: deflit(`FRAME',0)
                     62:
                     63:        pushl   %edi
                     64:        pushl   %esi
                     65:        pushl   %ebx
                     66:        pushl   %ebp
                     67: deflit(`FRAME',16)
                     68:
                     69:        movl    PARAM_DST,%edi
                     70:        movl    PARAM_SRC,%esi
                     71:        movl    PARAM_SIZE,%ecx
                     72:
                     73:        xorl    %ebx,%ebx
                     74:        andl    $3,%ecx
                     75:        jz      L(end0)
                     76:
                     77: L(oop0):
                     78:        movl    (%esi),%eax
                     79:        mull    PARAM_MULTIPLIER
                     80:        leal    4(%esi),%esi
                     81:        addl    %ebx,%eax
                     82:        movl    $0,%ebx
                     83:        adcl    %ebx,%edx
                     84:        M4_inst %eax,(%edi)
                     85:        adcl    %edx,%ebx       C propagate carry into cylimb
                     86:
                     87:        leal    4(%edi),%edi
                     88:        decl    %ecx
                     89:        jnz     L(oop0)
                     90:
                     91: L(end0):
                     92:        movl    PARAM_SIZE,%ecx
                     93:        shrl    $2,%ecx
                     94:        jz      L(end)
                     95:
                     96:        ALIGN(8)
                     97: L(oop):        movl    (%esi),%eax
                     98:        mull    PARAM_MULTIPLIER
                     99:        addl    %eax,%ebx
                    100:        movl    $0,%ebp
                    101:        adcl    %edx,%ebp
                    102:
                    103:        movl    4(%esi),%eax
                    104:        mull    PARAM_MULTIPLIER
                    105:        M4_inst %ebx,(%edi)
                    106:        adcl    %eax,%ebp       C new lo + cylimb
                    107:        movl    $0,%ebx
                    108:        adcl    %edx,%ebx
                    109:
                    110:        movl    8(%esi),%eax
                    111:        mull    PARAM_MULTIPLIER
                    112:        M4_inst %ebp,4(%edi)
                    113:        adcl    %eax,%ebx       C new lo + cylimb
                    114:        movl    $0,%ebp
                    115:        adcl    %edx,%ebp
                    116:
                    117:        movl    12(%esi),%eax
                    118:        mull    PARAM_MULTIPLIER
                    119:        M4_inst %ebx,8(%edi)
                    120:        adcl    %eax,%ebp       C new lo + cylimb
                    121:        movl    $0,%ebx
                    122:        adcl    %edx,%ebx
                    123:
                    124:        M4_inst %ebp,12(%edi)
                    125:        adcl    $0,%ebx         C propagate carry into cylimb
                    126:
                    127:        leal    16(%esi),%esi
                    128:        leal    16(%edi),%edi
                    129:        decl    %ecx
                    130:        jnz     L(oop)
                    131:
                    132: L(end):        movl    %ebx,%eax
                    133:
                    134:        popl    %ebp
                    135:        popl    %ebx
                    136:        popl    %esi
                    137:        popl    %edi
                    138:        ret
                    139:
                    140: EPILOGUE()

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