[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.1

1.1       maekawa     1: # IBM POWER __mpn_sub_n -- Subtract two limb vectors of equal, non-zero length.
                      2:
                      3: # Copyright (C) 1992, 1994, 1995, 1996 Free Software Foundation, Inc.
                      4:
                      5: # This file is part of the GNU MP Library.
                      6:
                      7: # The GNU MP Library is free software; you can redistribute it and/or modify
                      8: # it under the terms of the GNU Library General Public License as published by
                      9: # the Free Software Foundation; either version 2 of the License, or (at your
                     10: # option) any later version.
                     11:
                     12: # The GNU MP Library is distributed in the hope that it will be useful, but
                     13: # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
                     14: # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
                     15: # License for more details.
                     16:
                     17: # You should have received a copy of the GNU Library General Public License
                     18: # along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
                     19: # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
                     20: # MA 02111-1307, USA.
                     21:
                     22:
                     23: # INPUT PARAMETERS
                     24: # res_ptr      r3
                     25: # s1_ptr       r4
                     26: # s2_ptr       r5
                     27: # size         r6
                     28:
                     29:        .toc
                     30:        .extern __mpn_sub_n[DS]
                     31:        .extern .__mpn_sub_n
                     32: .csect [PR]
                     33:        .align 2
                     34:        .globl __mpn_sub_n
                     35:        .globl .__mpn_sub_n
                     36:        .csect __mpn_sub_n[DS]
                     37: __mpn_sub_n:
                     38:        .long .__mpn_sub_n, TOC[tc0], 0
                     39:        .csect [PR]
                     40: .__mpn_sub_n:
                     41:        andil.  10,6,1          # odd or even number of limbs?
                     42:        l       8,0(4)          # load least significant s1 limb
                     43:        l       0,0(5)          # load least significant s2 limb
                     44:        cal     3,-4(3)         # offset res_ptr, it's updated before it's used
                     45:        sri     10,6,1          # count for unrolled loop
                     46:        sf      7,0,8           # subtract least significant limbs, set cy
                     47:        mtctr   10              # copy count into CTR
                     48:        beq     0,Leven         # branch if even # of limbs (# of limbs >= 2)
                     49:
                     50: # We have an odd # of limbs.  Add the first limbs separately.
                     51:        cmpi    1,10,0          # is count for unrolled loop zero?
                     52:        bne     1,L1            # branch if not
                     53:        st      7,4(3)
                     54:        sfe     3,0,0           # load !cy into ...
                     55:        sfi     3,3,0           # ... return value register
                     56:        br                      # return
                     57:
                     58: # We added least significant limbs.  Now reload the next limbs to enter loop.
                     59: L1:    lu      8,4(4)          # load s1 limb and update s1_ptr
                     60:        lu      0,4(5)          # load s2 limb and update s2_ptr
                     61:        stu     7,4(3)
                     62:        sfe     7,0,8           # subtract limbs, set cy
                     63: Leven: lu      9,4(4)          # load s1 limb and update s1_ptr
                     64:        lu      10,4(5)         # load s2 limb and update s2_ptr
                     65:        bdz     Lend            # If done, skip loop
                     66:
                     67: Loop:  lu      8,4(4)          # load s1 limb and update s1_ptr
                     68:        lu      0,4(5)          # load s2 limb and update s2_ptr
                     69:        sfe     11,10,9         # subtract previous limbs with cy, set cy
                     70:        stu     7,4(3)          #
                     71:        lu      9,4(4)          # load s1 limb and update s1_ptr
                     72:        lu      10,4(5)         # load s2 limb and update s2_ptr
                     73:        sfe     7,0,8           # subtract previous limbs with cy, set cy
                     74:        stu     11,4(3)         #
                     75:        bdn     Loop            # decrement CTR and loop back
                     76:
                     77: Lend:  sfe     11,10,9         # subtract limbs with cy, set cy
                     78:        st      7,4(3)          #
                     79:        st      11,8(3)         #
                     80:        sfe     3,0,0           # load !cy into ...
                     81:        sfi     3,3,0           # ... return value register
                     82:        br

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