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

Annotation of OpenXM_contrib/gmp/mpn/power/addmul_1.s, Revision 1.1.1.2

1.1.1.2 ! maekawa     1: # IBM POWER __gmpn_addmul_1 -- Multiply a limb vector with a limb and add
1.1       maekawa     2: # the result to a second limb vector.
                      3:
1.1.1.2 ! maekawa     4: # Copyright (C) 1992, 1994, 1999, 2000 Free Software Foundation, Inc.
1.1       maekawa     5:
                      6: # This file is part of the GNU MP Library.
                      7:
                      8: # The GNU MP Library is free software; you can redistribute it and/or modify
1.1.1.2 ! maekawa     9: # it under the terms of the GNU Lesser General Public License as published by
        !            10: # the Free Software Foundation; either version 2.1 of the License, or (at your
1.1       maekawa    11: # option) any later version.
                     12:
                     13: # The GNU MP Library is distributed in the hope that it will be useful, but
                     14: # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1.1.1.2 ! maekawa    15: # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
1.1       maekawa    16: # License for more details.
                     17:
1.1.1.2 ! maekawa    18: # You should have received a copy of the GNU Lesser General Public License
1.1       maekawa    19: # along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
                     20: # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
                     21: # MA 02111-1307, USA.
                     22:
                     23:
                     24: # INPUT PARAMETERS
                     25: # res_ptr      r3
                     26: # s1_ptr       r4
                     27: # size         r5
                     28: # s2_limb      r6
                     29:
1.1.1.2 ! maekawa    30: # The POWER architecture has no unsigned 32x32->64 bit multiplication
        !            31: # instruction.  To obtain that operation, we have to use the 32x32->64 signed
        !            32: # multiplication instruction, and add the appropriate compensation to the high
        !            33: # limb of the result.  We add the multiplicand if the multiplier has its most
        !            34: # significant bit set, and we add the multiplier if the multiplicand has its
        !            35: # most significant bit set.  We need to preserve the carry flag between each
1.1       maekawa    36: # iteration, so we have to compute the compensation carefully (the natural,
1.1.1.2 ! maekawa    37: # srai+and doesn't work).  Since the POWER architecture has a branch unit we
        !            38: # can branch in zero cycles, so that's how we perform the additions.
1.1       maekawa    39:
                     40:        .toc
1.1.1.2 ! maekawa    41:        .globl  __gmpn_addmul_1
        !            42:        .globl  .__gmpn_addmul_1
        !            43:        .csect  __gmpn_addmul_1[DS]
        !            44: __gmpn_addmul_1:
        !            45:        .long   .__gmpn_addmul_1, TOC[tc0], 0
        !            46:        .csect  .text[PR]
        !            47:        .align  2
        !            48: .__gmpn_addmul_1:
1.1       maekawa    49:
                     50:        cal     3,-4(3)
                     51:        l       0,0(4)
                     52:        cmpi    0,6,0
                     53:        mtctr   5
                     54:        mul     9,0,6
                     55:        srai    7,0,31
                     56:        and     7,7,6
                     57:        mfmq    8
                     58:        cax     9,9,7
                     59:        l       7,4(3)
                     60:        a       8,8,7           # add res_limb
                     61:        blt     Lneg
                     62: Lpos:  bdz     Lend
                     63:
                     64: Lploop:        lu      0,4(4)
                     65:        stu     8,4(3)
                     66:        cmpi    0,0,0
                     67:        mul     10,0,6
                     68:        mfmq    0
                     69:        ae      8,0,9           # low limb + old_cy_limb + old cy
                     70:        l       7,4(3)
                     71:        aze     10,10           # propagate cy to new cy_limb
                     72:        a       8,8,7           # add res_limb
                     73:        bge     Lp0
                     74:        cax     10,10,6         # adjust high limb for negative limb from s1
                     75: Lp0:   bdz     Lend0
                     76:        lu      0,4(4)
                     77:        stu     8,4(3)
                     78:        cmpi    0,0,0
                     79:        mul     9,0,6
                     80:        mfmq    0
                     81:        ae      8,0,10
                     82:        l       7,4(3)
                     83:        aze     9,9
                     84:        a       8,8,7
                     85:        bge     Lp1
                     86:        cax     9,9,6           # adjust high limb for negative limb from s1
                     87: Lp1:   bdn     Lploop
                     88:
                     89:        b       Lend
                     90:
                     91: Lneg:  cax     9,9,0
                     92:        bdz     Lend
                     93: Lnloop:        lu      0,4(4)
                     94:        stu     8,4(3)
                     95:        cmpi    0,0,0
                     96:        mul     10,0,6
                     97:        mfmq    7
                     98:        ae      8,7,9
                     99:        l       7,4(3)
                    100:        ae      10,10,0         # propagate cy to new cy_limb
                    101:        a       8,8,7           # add res_limb
                    102:        bge     Ln0
                    103:        cax     10,10,6         # adjust high limb for negative limb from s1
                    104: Ln0:   bdz     Lend0
                    105:        lu      0,4(4)
                    106:        stu     8,4(3)
                    107:        cmpi    0,0,0
                    108:        mul     9,0,6
                    109:        mfmq    7
                    110:        ae      8,7,10
                    111:        l       7,4(3)
                    112:        ae      9,9,0           # propagate cy to new cy_limb
                    113:        a       8,8,7           # add res_limb
                    114:        bge     Ln1
                    115:        cax     9,9,6           # adjust high limb for negative limb from s1
                    116: Ln1:   bdn     Lnloop
                    117:        b       Lend
                    118:
                    119: Lend0: cal     9,0(10)
                    120: Lend:  st      8,4(3)
                    121:        aze     3,9
                    122:        br

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