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

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

1.1.1.2 ! maekawa     1: # IBM POWER __gmpn_sub_n -- Subtract two limb vectors of equal, non-zero length.
1.1       maekawa     2:
1.1.1.2 ! maekawa     3: # Copyright (C) 1992, 1994, 1995, 1996, 1999, 2000 Free Software Foundation,
        !             4: # 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: # s2_ptr       r5
                     28: # size         r6
                     29:
                     30:        .toc
1.1.1.2 ! maekawa    31:        .globl  __gmpn_sub_n
        !            32:        .globl  .__gmpn_sub_n
        !            33:        .csect  __gmpn_sub_n[DS]
        !            34: __gmpn_sub_n:
        !            35:        .long   .__gmpn_sub_n, TOC[tc0], 0
        !            36:        .csect  .text[PR]
        !            37:        .align  2
        !            38: .__gmpn_sub_n:
1.1       maekawa    39:        andil.  10,6,1          # odd or even number of limbs?
                     40:        l       8,0(4)          # load least significant s1 limb
                     41:        l       0,0(5)          # load least significant s2 limb
                     42:        cal     3,-4(3)         # offset res_ptr, it's updated before it's used
                     43:        sri     10,6,1          # count for unrolled loop
                     44:        sf      7,0,8           # subtract least significant limbs, set cy
                     45:        mtctr   10              # copy count into CTR
                     46:        beq     0,Leven         # branch if even # of limbs (# of limbs >= 2)
                     47:
                     48: # We have an odd # of limbs.  Add the first limbs separately.
                     49:        cmpi    1,10,0          # is count for unrolled loop zero?
1.1.1.2 ! maekawa    50:        bc      4,6,L1          # bne cr1,L1 (misassembled by gas)
1.1       maekawa    51:        st      7,4(3)
                     52:        sfe     3,0,0           # load !cy into ...
                     53:        sfi     3,3,0           # ... return value register
                     54:        br                      # return
                     55:
                     56: # We added least significant limbs.  Now reload the next limbs to enter loop.
                     57: L1:    lu      8,4(4)          # load s1 limb and update s1_ptr
                     58:        lu      0,4(5)          # load s2 limb and update s2_ptr
                     59:        stu     7,4(3)
                     60:        sfe     7,0,8           # subtract limbs, set cy
                     61: Leven: lu      9,4(4)          # load s1 limb and update s1_ptr
                     62:        lu      10,4(5)         # load s2 limb and update s2_ptr
                     63:        bdz     Lend            # If done, skip loop
                     64:
                     65: Loop:  lu      8,4(4)          # load s1 limb and update s1_ptr
                     66:        lu      0,4(5)          # load s2 limb and update s2_ptr
                     67:        sfe     11,10,9         # subtract previous limbs with cy, set cy
                     68:        stu     7,4(3)          #
                     69:        lu      9,4(4)          # load s1 limb and update s1_ptr
                     70:        lu      10,4(5)         # load s2 limb and update s2_ptr
                     71:        sfe     7,0,8           # subtract previous limbs with cy, set cy
                     72:        stu     11,4(3)         #
                     73:        bdn     Loop            # decrement CTR and loop back
                     74:
                     75: Lend:  sfe     11,10,9         # subtract limbs with cy, set cy
                     76:        st      7,4(3)          #
                     77:        st      11,8(3)         #
                     78:        sfe     3,0,0           # load !cy into ...
                     79:        sfi     3,3,0           # ... return value register
                     80:        br

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