1 dnl PowerPC
-32 mpn_add_n
and mpn_sub_n.
3 dnl Copyright
2002, 2005, 2007 Free Software Foundation
, Inc.
5 dnl
This file is part of the GNU MP Library.
7 dnl The GNU MP Library is free software
; you can redistribute it and/or modify
8 dnl it under the terms of
either:
10 dnl
* the GNU Lesser General
Public License as published by the Free
11 dnl Software Foundation
; either version 3 of the License, or (at your
12 dnl option
) any later version.
16 dnl
* the GNU General
Public License as published by the Free Software
17 dnl Foundation
; either version 2 of the License, or (at your option) any
20 dnl
or both
in parallel
, as here.
22 dnl The GNU MP Library is distributed
in the hope that it will be useful
, but
23 dnl WITHOUT ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY
24 dnl
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License
27 dnl You should have received copies of the GNU General
Public License
and the
28 dnl GNU Lesser General
Public License along with the GNU MP Library. If
not,
29 dnl see
https://www.gnu.
org/licenses
/.
31 include(`..
/config.m4
')
36 C 75x (G3): ? old: 3.5
37 C 7400,7410 (G4): 3.25
52 ifdef(`OPERATION_add_n', `
54 define
(func
, mpn_add_n
)
55 define
(func_nc
, mpn_add_nc
)
58 ifdef(`OPERATION_sub_n', `
60 define
(func
, mpn_sub_n
)
61 define
(func_nc
, mpn_sub_nc
)
65 MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
70 IFADD(` addic r0, cy, -1') C set carry from argument
71 IFSUB
(` subfic r0
, cy
, 0') C set carry from argument
76 IFADD(` addic r0, n, 0') C clear carry
77 IFSUB
(` addic r0
, n
, -1') C set carry
78 L(ent): andi. r0, n, 3
88 lwzx r7, r4, r3 C n = 4, 8, 12, ...
97 L(n00): bge cr7, L(n01)
98 cmpwi cr0, r0, 0 C n = 1, 5, 9, 13, ...
104 L(gt1): lwzx r7, r4, r3
110 lwzx r9, r4, r3 C n = 3, 7, 11, 15, ...
119 L(n01): bne cr7, L(n10)
120 cmpwi cr0, r0, 0 C n = 2, 6, 10, 14, ...
131 L(lp): lwzx r7, r4, r3
135 L(01): lwzx r9, r4, r3
139 L(00): lwzx r11, r4, r3
143 L(11): lwzx r0, r4, r3
149 L(end): ADCSBC r0, r6, r0
151 L(ret): stw r0, 8(r3)
153 IFADD
(` addze r3
, r3
')
154 IFSUB(` subfe r3, r0, r0')