1 dnl AMD64 mpn_addmul_1
and mpn_submul_1 optimised for AMD Bulldozer.
3 dnl Copyright
2003-2005, 2007, 2008, 2011, 2012 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
')
45 C The loop of this code is the result of running a code generation and
46 C optimisation tool suite written by David Harvey and Torbjorn Granlund.
49 C * Try to make loop run closer to 4 c/l.
51 define(`rp', `
%rdi
') C rcx
52 define(`up', `
%rsi
') C rdx
53 define(`n_param', `
%rdx
') C r8
54 define(`v0', `
%rcx
') C r9
58 ifdef(`OPERATION_addmul_1',`
59 define
(`ADDSUB
', `add')
60 define
(`func
', `mpn_addmul_1')
62 ifdef(`OPERATION_submul_1',`
63 define
(`ADDSUB
', `sub')
64 define
(`func
', `mpn_submul_1')
70 MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
72 IFDOS(` define(`up', ``
%rsi
'') ') dnl
73 IFDOS(` define(`rp', ``
%rcx
'') ') dnl
74 IFDOS(` define(`v0', ``
%r9
'') ') dnl
75 IFDOS(` define(`r9', ``rdi
'') ') dnl
76 IFDOS(` define(`n', ``
%r8
'') ') dnl
77 IFDOS(` define(`r8', ``r11
'') ') dnl
85 IFDOS(``mov %rdx, %rsi '')
87 mov (up), %rax C read first u limb early
89 IFSTD(` mov n_param, %rbx ') C move away n from rdx
, mul uses it
90 IFDOS
(`
mov n
, %rbx
')
93 IFSTD(` mov %rbx, n ')
102 L
(b3
): mov $0, R32
(%r8
)
111 L
(b0
): mov $0, R32
(%r10
)
130 L
(b2
): mov $0, R32
(%rbx
)
142 ADDSUB
%r10
, (rp
,n
,8)
148 ADDSUB
%r9
, 8(rp
,n
,8)
153 ADDSUB
%r8
, 16(rp
,n
,8)
160 ADDSUB
%rbx
, 24(rp
,n
,8)
172 L
(n1
): ADDSUB
%rax
, 8(rp
)