1 dnl PowerPC
-64 mpn_addmul_1
and mpn_submul_1 optimised for power6.
3 dnl Copyright
1999-2001, 2003-2006, 2008, 2010, 2011 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
')
34 C mpn_addmul_1 mpn_submul_1
35 C cycles/limb cycles/limb
43 C * Reduce register usage.
44 C * Schedule function entry code.
45 C * Unroll more. 8-way unrolling would bring us to 10 c/l, 16-way unrolling
46 C would bring us to 9 c/l.
47 C * Handle n = 1 and perhaps n = 2 separately, without saving any registers.
55 ifdef(`OPERATION_addmul_1',`
58 define
(func
, mpn_addmul_1
)
59 define
(func_nc
, mpn_addmul_1c
) C
FIXME: not really supported
62 define
(CLRRSC
, `addic
$1, r0
, 0')
64 ifdef
(`OPERATION_submul_1
',`
65 define(ADDSUBC, subfe)
67 define(func, mpn_submul_1)
68 define(func_nc, mpn_submul_1c) C FIXME: not really supported
71 define(CLRRSC, `subfc $1, r0, r0')
74 MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
84 rldicl. r0, n, 0,62 C r0 = n & 3, set cr0
86 addi n, n, 3 C compute count...
87 srdi n, n, 2 C ...for ctr
88 mtctr n C copy loop count into ctr
135 L(b0): addi up, up, -8
137 CLRRSC( r12) C clear r12 and clr/set cy
141 SM(` subfe r11, r0, r0') C complement...
142 SM
(` addic r11
, r11
, 1') C ...carry flag
169 L(l3): std r5, -16(rp)
171 L(l2): std r9, -8(rp)
172 ADDSUBC r11, r11, r31
173 L(l1): std r11, 0(rp)
177 SM
(` subfe r11
, r0
, r0
') C complement...
179 SM(` subf r3, r11, r12')