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

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

1.1       ohara       1: dnl  IBM POWER mpn_add_n -- Add two limb vectors of equal, non-zero length.
                      2:
                      3: dnl  Copyright 1992, 1994, 1995, 1996, 1999, 2000, 2001 Free Software
                      4: dnl  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
                     10: dnl  by the Free Software Foundation; either version 2.1 of the License, or (at
                     11: dnl  your 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  s2_ptr    r5
                     28: dnl  size      r6
                     29:
                     30: include(`../config.m4')
                     31:
                     32: ASM_START()
                     33: PROLOGUE(mpn_add_n)
                     34:        andil.  10,6,1          C odd or even number of limbs?
                     35:        l       8,0(4)          C load least significant s1 limb
                     36:        l       0,0(5)          C load least significant s2 limb
                     37:        cal     3,-4(3)         C offset res_ptr, it's updated before it's used
                     38:        sri     10,6,1          C count for unrolled loop
                     39:        a       7,0,8           C add least significant limbs, set cy
                     40:        mtctr   10              C copy count into CTR
                     41:        beq     0,Leven         C branch if even C of limbs (C of limbs >= 2)
                     42:
                     43: C We have an odd C of limbs.  Add the first limbs separately.
                     44:        cmpi    1,10,0          C is count for unrolled loop zero?
                     45:        bc      4,6,L1          C bne cr1,L1 (misassembled by gas)
                     46:        st      7,4(3)
                     47:        aze     3,10            C use the fact that r10 is zero...
                     48:        br                      C return
                     49:
                     50: C We added least significant limbs.  Now reload the next limbs to enter loop.
                     51: L1:    lu      8,4(4)          C load s1 limb and update s1_ptr
                     52:        lu      0,4(5)          C load s2 limb and update s2_ptr
                     53:        stu     7,4(3)
                     54:        ae      7,0,8           C add limbs, set cy
                     55: Leven: lu      9,4(4)          C load s1 limb and update s1_ptr
                     56:        lu      10,4(5)         C load s2 limb and update s2_ptr
                     57:        bdz     Lend            C If done, skip loop
                     58:
                     59: Loop:  lu      8,4(4)          C load s1 limb and update s1_ptr
                     60:        lu      0,4(5)          C load s2 limb and update s2_ptr
                     61:        ae      11,10,9         C add previous limbs with cy, set cy
                     62:        stu     7,4(3)          C
                     63:        lu      9,4(4)          C load s1 limb and update s1_ptr
                     64:        lu      10,4(5)         C load s2 limb and update s2_ptr
                     65:        ae      7,0,8           C add previous limbs with cy, set cy
                     66:        stu     11,4(3)         C
                     67:        bdn     Loop            C decrement CTR and loop back
                     68:
                     69: Lend:  ae      11,10,9         C add limbs with cy, set cy
                     70:        st      7,4(3)          C
                     71:        st      11,8(3)         C
                     72:        lil     3,0             C load cy into ...
                     73:        aze     3,3             C ... return value register
                     74:        br
                     75: EPILOGUE(mpn_add_n)

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