1 dnl PowerPC
-64 mpn_cnd_add_n
/mpn_cnd_sub_n.
3 dnl Copyright
1999-2001, 2003-2005, 2007, 2011, 2012 Free Software Foundation
,
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
')
48 ifdef(`OPERATION_cnd_add_n',`
51 define
(func
, mpn_cnd_add_n
)
52 define
(GENRVAL
, `addi r3
, r3
, 1')
53 define(SETCBR, `addic r0, $1, -1')
54 define
(CLRCB
, `addic r0
, r0
, 0')
56 ifdef
(`OPERATION_cnd_sub_n
',`
57 define(ADDSUBC, subfe)
59 define(func, mpn_cnd_sub_n)
60 define(GENRVAL, `neg r3, r3')
61 define
(SETCBR
, `subfic r0
, $1, 0')
62 define(CLRCB, `addic r0, r1, -1')
65 MULFUNC_PROLOGUE(mpn_cnd_add_n mpn_cnd_sub_n)
78 rldicl. r0, n, 0,62 C r0 = n & 3, set cr0
80 addi n, n, 3 C compute count...
81 srdi n, n, 2 C ...for ctr
82 mtctr n C copy count into ctr
87 L(b11): ld r8, 0(up) C load s1 limb
88 ld r9, 0(vp) C load s2 limb
89 ld r10, 8(up) C load s1 limb
90 ld r11, 8(vp) C load s2 limb
91 ld r12, 16(up) C load s1 limb
93 ld r0, 16(vp) C load s2 limb
108 L(b01): ld r12, 0(up) C load s1 limb
110 ld r0, 0(vp) C load s2 limb
113 ADDSUB r31, r0, r12 C add
119 L(b10): ld r10, 0(up) C load s1 limb
120 ld r11, 0(vp) C load s2 limb
121 ld r12, 8(up) C load s1 limb
123 ld r0, 8(vp) C load s2 limb
127 ADDSUB r30, r11, r10 C add
128 ADDSUBC r31, r0, r12 C add
135 L(b00): CLRCB C clear/set cy
136 L(go): ld r7, 0(up) C load s1 limb
137 ld r27, 0(vp) C load s2 limb
138 ld r8, 8(up) C load s1 limb
139 ld r9, 8(vp) C load s2 limb
140 ld r10, 16(up) C load s1 limb
141 ld r11, 16(vp) C load s2 limb
142 ld r12, 24(up) C load s1 limb
143 ld r0, 24(vp) C load s2 limb
153 L(top): ADDSUBC r28, r27, r7
154 ld r7, 0(up) C load s1 limb
155 ld r27, 0(vp) C load s2 limb
157 ld r8, 8(up) C load s1 limb
158 ld r9, 8(vp) C load s2 limb
159 ADDSUBC r30, r11, r10
160 ld r10, 16(up) C load s1 limb
161 ld r11, 16(vp) C load s2 limb
163 ld r12, 24(up) C load s1 limb
164 ld r0, 24(vp) C load s2 limb
176 bdnz L(top) C decrement ctr and loop back
178 L(end): ADDSUBC r28, r27, r7
180 ADDSUBC r30, r11, r10
187 L(ret): ld r31, -8(r1)
193 subfe r3, r0, r0 C -cy