1 ! sparc __mpn_add_n -- Add two limb vectors of the same length > 0 and store
2 ! sum in a third limb vector.
4 ! Copyright (C) 1992, 1994 Free Software Foundation, Inc.
6 ! This file is part of the GNU MP Library.
8 ! The GNU MP Library is free software; you can redistribute it and/or modify
9 ! it under the terms of the GNU Library General Public License as published by
10 ! the Free Software Foundation; either version 2 of the License, or (at your
11 ! option) any later version.
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
15 ! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
16 ! License for more details.
18 ! You should have received a copy of the GNU Library General Public License
19 ! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
20 ! the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 .global C_SYMBOL_NAME(__mpn_add_n)
34 C_SYMBOL_NAME(__mpn_add_n):
35 ld [%o1+0],%o4 ! read first limb from s1_ptr
37 ld [%o2+0],%o5 ! read first limb from s2_ptr
44 sll %o3,2,%o3 ! multiply by 4
45 sub %o0,%o3,%o0 ! adjust res_ptr
46 sub %o1,%o3,%o1 ! adjust s1_ptr
47 sub %o2,%o3,%o2 ! adjust s2_ptr
53 sll %o3,2,%o3 ! multiply by 4
57 Loop: addxcc %g2,%g3,%o3
64 Lzero: sub %g1,1,%g1 ! add 0 + 16r limbs (adjust loop counter)
69 ld [%o1+8],%o4 ! add 15 + 16r limbs
73 ld [%o1+12],%g2 ! add 14 + 16r limbs
77 ld [%o1+16],%o4 ! add 13 + 16r limbs
81 ld [%o1+20],%g2 ! add 12 + 16r limbs
85 ld [%o1+24],%o4 ! add 11 + 16r limbs
89 ld [%o1+28],%g2 ! add 10 + 16r limbs
93 ld [%o1+32],%o4 ! add 9 + 16r limbs
97 ld [%o1+36],%g2 ! add 8 + 16r limbs
101 ld [%o1+40],%o4 ! add 7 + 16r limbs
105 ld [%o1+44],%g2 ! add 6 + 16r limbs
109 ld [%o1+48],%o4 ! add 5 + 16r limbs
113 ld [%o1+52],%g2 ! add 4 + 16r limbs
117 ld [%o1+56],%o4 ! add 3 + 16r limbs
121 ld [%o1+60],%g2 ! add 2 + 16r limbs
128 subcc %g0,%o4,%g0 ! restore cy (delay slot)
131 st %o3,[%o0+60] ! store most significant limb
134 addx %g0,%g0,%o0 ! return carry-out from most sign. limb