1 ; mc88110 __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
2 ; sum in a third limb vector.
4 ; Copyright 1995, 1996, 2000 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 Lesser General Public License as published by
10 ; the Free Software Foundation; either version 3 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 Lesser General Public
16 ; License for more details.
18 ; You should have received a copy of the GNU Lesser General Public License
19 ; along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
32 global C_SYMBOL_NAME(__gmpn_add_n)
33 C_SYMBOL_NAME(__gmpn_add_n):
34 addu.co r0,r0,r0 ; clear cy flag
35 xor r12,s2_ptr,res_ptr
38 L0: bb0 2,res_ptr,L_v1 ; branch if res_ptr is aligned?
39 /* Add least significant limb separately to align res_ptr and s2_ptr */
47 addu res_ptr,res_ptr,4
56 /* Add blocks of 8 limbs until less than 8 limbs remain */
58 Loop1: subu size,size,8
85 addu res_ptr,res_ptr,32
88 Lfin1: addu size,size,8-2
90 /* Add blocks of 2 limbs until less than 2 limbs remain */
91 Loope1: addu.cio r6,r10,r8
100 addu res_ptr,res_ptr,8
102 Lend1: addu.cio r6,r10,r8
114 addu.ci r2,r0,r0 ; return carry-out from most sign. limb
116 L1: xor r12,s1_ptr,res_ptr
125 /* If we come here, the alignment of s1_ptr and res_ptr as well as the
126 alignment of s2_ptr and res_ptr differ. Since there are only two ways
127 things can be aligned (that we care about) we now know that the alignment
128 of s1_ptr and s2_ptr are the same. */
132 bb0 2,s1_ptr,L_v2 ; branch if s1_ptr is aligned
133 /* Add least significant limb separately to align res_ptr and s2_ptr */
141 addu res_ptr,res_ptr,4
143 L_v2: subu size,size,8
145 /* Add blocks of 8 limbs until less than 8 limbs remain */
147 Loop2: subu size,size,8
172 addu s1_ptr,s1_ptr,32
173 addu s2_ptr,s2_ptr,32
174 addu res_ptr,res_ptr,32
177 Lfin2: addu size,size,8-2
179 Loope2: ld.d r8,s1_ptr,0
188 addu res_ptr,res_ptr,8
190 Lend2: bb0 0,size,Lret2
192 Ljone: ld r10,s1_ptr,0
198 addu.ci r2,r0,r0 ; return carry-out from most sign. limb