1 dnl PowerPC-64/mode32 mpn_sub_n -- Subtract two limb vectors of the same
2 dnl length and store difference in a third limb vector.
4 dnl Copyright 1999, 2000, 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 the GNU Lesser General Public License as published
10 dnl by the Free Software Foundation; either version 3 of the License, or (at
11 dnl your option) any later version.
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.
18 dnl You should have received a copy of the GNU Lesser General Public License
19 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
21 include(`../config.m4')
35 mtctr r6 C copy size into CTR
36 addic r0, r6, -1 C set 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 L(end) C If done, skip loop
42 L(oop): ld r9, 8(r4) C load s1 limb
43 ld r10, 8(r5) C load s2 limb
44 subfe r7, r0, r8 C subtract limbs with cy, set cy
48 std r7, 8(r3) C store result limb
49 bdz L(exit) C decrement CTR and exit if done
50 ldu r8, 16(r4) C load s1 limb and update s1_ptr
51 ldu r0, 16(r5) C load s2 limb and update s2_ptr
52 subfe r7, r10, r9 C subtract limbs with cy, set cy
56 stdu r7, 16(r3) C store result limb and update res_ptr
57 bdnz L(oop) C decrement CTR and loop back
59 L(end): subfe r7, r0, r8
63 std r7, 8(r3) C store ultimate result limb
64 subfe r3, r0, r0 C load !cy into ...
65 subfic r4, r3, 0 C ... return value register
66 li r3, 0 C zero extend return value
68 L(exit): subfe r7, r10, r9
73 subfe r3, r0, r0 C load !cy into ...
74 subfic r4, r3, 0 C ... return value register
75 li r3, 0 C zero extend return value