Annotation of OpenXM_contrib/gmp/mpn/powerpc64/add_n.asm, Revision 1.1.1.2
1.1.1.2 ! ohara 1: dnl PowerPC-64 mpn_add_n -- Add two limb vectors of the same length > 0 and
! 2: dnl store sum in a third limb vector.
1.1 maekawa 3:
1.1.1.2 ! ohara 4: dnl Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
1.1 maekawa 5:
1.1.1.2 ! ohara 6: dnl This file is part of the GNU MP Library.
1.1 maekawa 7:
1.1.1.2 ! ohara 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.
1.1 maekawa 22:
23: include(`../config.m4')
24:
1.1.1.2 ! ohara 25: C INPUT PARAMETERS
! 26: C res_ptr r3
! 27: C s1_ptr r4
! 28: C s2_ptr r5
! 29: C size r6
! 30:
! 31: C This code runs at 1.5 cycles/limb on the PPC630.
! 32:
1.1 maekawa 33: ASM_START()
34: PROLOGUE(mpn_add_n)
1.1.1.2 ! ohara 35: mtctr r6 C copy size into CTR
! 36: addic r0,r0,0 C clear cy
! 37: ld r8,0(r4) C load least significant s1 limb
! 38: ld r0,0(r5) C load least significant s2 limb
! 39: addi r3,r3,-8 C offset res_ptr, it's updated before it's used
! 40: bdz .Lend C If done, skip loop
! 41: .Loop: ld r9,8(r4) C load s1 limb
! 42: ld r10,8(r5) C load s2 limb
! 43: adde r7,r0,r8 C add limbs with cy, set cy
! 44: std r7,8(r3) C store result limb
! 45: bdz .Lexit C decrement CTR and exit if done
! 46: ldu r8,16(r4) C load s1 limb and update s1_ptr
! 47: ldu r0,16(r5) C load s2 limb and update s2_ptr
! 48: adde r7,r10,r9 C add limbs with cy, set cy
! 49: stdu r7,16(r3) C store result limb and update res_ptr
! 50: bdnz .Loop C decrement CTR and loop back
1.1 maekawa 51:
52: .Lend: adde r7,r0,r8
1.1.1.2 ! ohara 53: std r7,8(r3) C store ultimate result limb
! 54: li r3,0 C load cy into ...
! 55: addze r3,r3 C ... return value register
1.1 maekawa 56: blr
57: .Lexit: adde r7,r10,r9
58: std r7,16(r3)
1.1.1.2 ! ohara 59: li r3,0 C load cy into ...
! 60: addze r3,r3 C ... return value register
1.1 maekawa 61: blr
62: EPILOGUE(mpn_add_n)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>