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

Annotation of OpenXM_contrib/gmp/mpn/powerpc32/addmul_1.asm, Revision 1.1.1.1

1.1       maekawa     1: dnl PowerPC-32 mpn_addmul_1 -- Multiply a limb vector with a limb and add
                      2: dnl the result to a second limb vector.
                      3:
                      4: dnl Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
                      5:
                      6: dnl This file is part of the GNU MP Library.
                      7:
                      8: dnl The GNU MP Library is free software; you can redistribute it and/or modify
                      9: dnl it under the terms of the GNU Lesser General Public License as published by
                     10: dnl the Free Software Foundation; either version 2.1 of the License, or (at your
                     11: dnl option) any later version.
                     12:
                     13: dnl The GNU MP Library is distributed in the hope that it will be useful, but
                     14: dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
                     15: dnl or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
                     16: dnl License for more details.
                     17:
                     18: dnl You should have received a copy of the GNU Lesser General Public License
                     19: dnl along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
                     20: dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
                     21: dnl MA 02111-1307, USA.
                     22:
                     23:
                     24: dnl INPUT PARAMETERS
                     25: dnl res_ptr    r3
                     26: dnl s1_ptr     r4
                     27: dnl size       r5
                     28: dnl s2_limb    r6
                     29:
                     30: dnl This is optimized for the PPC604.  It has not been tested on PPC601, PPC603
                     31: dnl or PPC750 since I don't have access to any such machines.
                     32:
                     33: include(`../config.m4')
                     34:
                     35: ASM_START()
                     36: PROLOGUE(mpn_addmul_1)
                     37:        cmpi    cr0,r5,9        C more than 9 limbs?
                     38:        bgt     cr0,.Lbig       C branch if more than 9 limbs
                     39:
                     40:        mtctr   r5
                     41:        lwz     r0,0(r4)
                     42:        mullw   r7,r0,r6
                     43:        mulhwu  r10,r0,r6
                     44:        lwz     r9,0(r3)
                     45:        addc    r8,r7,r9
                     46:        addi    r3,r3,-4
                     47:        bdz     .Lend
                     48: .Lloop:
                     49:        lwzu    r0,4(r4)
                     50:        stwu    r8,4(r3)
                     51:        mullw   r8,r0,r6
                     52:        adde    r7,r8,r10
                     53:        mulhwu  r10,r0,r6
                     54:        lwz     r9,4(r3)
                     55:        addze   r10,r10
                     56:        addc    r8,r7,r9
                     57:        bdnz    .Lloop
                     58: .Lend: stw     r8,4(r3)
                     59:        addze   r3,r10
                     60:        blr
                     61:
                     62: .Lbig: stmw    r30,-32(r1)
                     63:        addi    r5,r5,-1
                     64:        srwi    r0,r5,2
                     65:        mtctr   r0
                     66:
                     67:        lwz     r7,0(r4)
                     68:        mullw   r8,r7,r6
                     69:        mulhwu  r0,r7,r6
                     70:        lwz     r7,0(r3)
                     71:        addc    r8,r8,r7
                     72:        stw     r8,0(r3)
                     73:
                     74: .LloopU:
                     75:        lwz     r7,4(r4)
                     76:        lwz     r12,8(r4)
                     77:        lwz     r30,12(r4)
                     78:        lwzu    r31,16(r4)
                     79:        mullw   r8,r7,r6
                     80:        mullw   r9,r12,r6
                     81:        mullw   r10,r30,r6
                     82:        mullw   r11,r31,r6
                     83:        adde    r8,r8,r0        C add cy_limb
                     84:        mulhwu  r0,r7,r6
                     85:        lwz     r7,4(r3)
                     86:        adde    r9,r9,r0
                     87:        mulhwu  r0,r12,r6
                     88:        lwz     r12,8(r3)
                     89:        adde    r10,r10,r0
                     90:        mulhwu  r0,r30,r6
                     91:        lwz     r30,12(r3)
                     92:        adde    r11,r11,r0
                     93:        mulhwu  r0,r31,r6
                     94:        lwz     r31,16(r3)
                     95:        addze   r0,r0           C new cy_limb
                     96:        addc    r8,r8,r7
                     97:        stw     r8,4(r3)
                     98:        adde    r9,r9,r12
                     99:        stw     r9,8(r3)
                    100:        adde    r10,r10,r30
                    101:        stw     r10,12(r3)
                    102:        adde    r11,r11,r31
                    103:        stwu    r11,16(r3)
                    104:        bdnz    .LloopU
                    105:
                    106:        andi.   r31,r5,3
                    107:        mtctr   r31
                    108:        beq     cr0,.Lendx
                    109:
                    110: .LloopE:
                    111:        lwzu    r7,4(r4)
                    112:        mullw   r8,r7,r6
                    113:        adde    r8,r8,r0        C add cy_limb
                    114:        mulhwu  r0,r7,r6
                    115:        lwz     r7,4(r3)
                    116:        addze   r0,r0           C new cy_limb
                    117:        addc    r8,r8,r7
                    118:        stwu    r8,4(r3)
                    119:        bdnz    .LloopE
                    120: .Lendx:
                    121:        addze   r3,r0
                    122:        lmw     r30,-32(r1)
                    123:        blr
                    124: EPILOGUE(mpn_addmul_1)

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