1 dnl IBM POWER mpn_sub_n
-- Subtract two limb vectors of equal
, non
-zero
4 dnl Copyright
1992, 1994-1996, 1999-2001, 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
/.
39 include(`..
/config.m4
')
43 andil. 10,6,1 C odd or even number of limbs?
44 l 8,0(4) C load least significant s1 limb
45 l 0,0(5) C load least significant s2 limb
46 cal 3,-4(3) C offset res_ptr, it's updated before it
's used
47 sri 10,6,1 C count for unrolled loop
48 sf 7,0,8 C subtract least significant limbs, set cy
49 mtctr 10 C copy count into CTR
50 beq 0,Leven C branch if even # of limbs (# of limbs >= 2)
52 C We have an odd # of limbs. Add the first limbs separately.
53 cmpi 1,10,0 C is count for unrolled loop zero?
54 bc 4,6,L1 C bne cr1,L1 (misassembled by gas)
56 sfe 3,0,0 C load !cy into ...
57 sfi 3,3,0 C ... return value register
60 C We added least significant limbs. Now reload the next limbs to enter loop.
61 L1: lu 8,4(4) C load s1 limb and update s1_ptr
62 lu 0,4(5) C load s2 limb and update s2_ptr
64 sfe 7,0,8 C subtract limbs, set cy
65 Leven: lu 9,4(4) C load s1 limb and update s1_ptr
66 lu 10,4(5) C load s2 limb and update s2_ptr
67 bdz Lend C If done, skip loop
69 Loop: lu 8,4(4) C load s1 limb and update s1_ptr
70 lu 0,4(5) C load s2 limb and update s2_ptr
71 sfe 11,10,9 C subtract previous limbs with cy, set cy
73 lu 9,4(4) C load s1 limb and update s1_ptr
74 lu 10,4(5) C load s2 limb and update s2_ptr
75 sfe 7,0,8 C subtract previous limbs with cy, set cy
77 bdn Loop C decrement CTR and loop back
79 Lend: sfe 11,10,9 C subtract limbs with cy, set cy
82 sfe 3,0,0 C load !cy into ...
83 sfi 3,3,0 C ... return value register