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

Annotation of OpenXM_contrib/gmp/mpn/power/sub_n.asm, Revision 1.1.1.1

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

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