1 dnl PowerPC
-64/mode32 mpn_add_n
-- Add two limb vectors of the same
length > 0
2 dnl
and store sum
in a third limb vector.
4 dnl Copyright
1999-2001, 2003, 2005 Free Software Foundation
, Inc.
6 dnl
This file is part of the GNU MP Library.
8 dnl The GNU MP Library is free software
; you can redistribute it and/or modify
9 dnl it under the terms of
either:
11 dnl
* the GNU Lesser General
Public License as published by the Free
12 dnl Software Foundation
; either version 3 of the License, or (at your
13 dnl option
) any later version.
17 dnl
* the GNU General
Public License as published by the Free Software
18 dnl Foundation
; either version 2 of the License, or (at your option) any
21 dnl
or both
in parallel
, as here.
23 dnl The GNU MP Library is distributed
in the hope that it will be useful
, but
24 dnl WITHOUT ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY
25 dnl
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License
28 dnl You should have received copies of the GNU General
Public License
and the
29 dnl GNU Lesser General
Public License along with the GNU MP Library. If
not,
30 dnl see
https://www.gnu.
org/licenses
/.
32 include(`..
/config.m4
')
46 mtctr r6 C copy size into CTR
47 addic r0, r0, 0 C clear cy
48 ld r8, 0(r4) C load least significant s1 limb
49 ld r0, 0(r5) C load least significant s2 limb
50 addi r3, r3, -8 C offset res_ptr, it's updated before it
's used
51 bdz L(end) C If done, skip loop
53 L(oop): ld r9, 8(r4) C load s1 limb
54 ld r10, 8(r5) C load s2 limb
55 adde r7, r0, r8 C add limbs with cy, set cy
58 adde r6, r6, r11 C add high limb parts, set cy
59 std r7, 8(r3) C store result limb
60 bdz L(exit) C decrement CTR and exit if done
61 ldu r8, 16(r4) C load s1 limb and update s1_ptr
62 ldu r0, 16(r5) C load s2 limb and update s2_ptr
63 adde r7, r10, r9 C add limbs with cy, set cy
66 adde r6, r6, r11 C add high limb parts, set cy
67 stdu r7, 16(r3) C store result limb and update res_ptr
68 bdnz L(oop) C decrement CTR and loop back
70 L(end): adde r7, r0, r8
73 adde r6, r6, r11 C add limbs with cy, set cy
74 std r7, 8(r3) C store ultimate result limb
75 li r3, 0 C load cy into ...
76 addze r4, r3 C ... return value register
78 L(exit): adde r7, r10, r9
81 adde r6, r6, r11 C add limbs with cy, set cy
83 li r3, 0 C load cy into ...
84 addze r4, r3 C ... return value register