1 dnl AMD64 mpn_mul_1 optimised for Intel Broadwell.
3 dnl Copyright
2015 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
')
52 C The loop of this code is the result of running a code generation and
53 C optimisation tool suite written by David Harvey and Torbjorn Granlund.
56 C * Put an initial mulx before switching, targeting some free registers.
57 C * Tune feed-in code.
58 C * Trim nop execution after L(f2).
59 C * Port to DOS64, not forgetting nop execution.
61 define(`rp', `
%rdi
') C rcx
62 define(`up', `
%rsi
') C rdx
63 define(`n_param', `
%rdx
') C r8
64 define(`v0_param',`
%rcx
') C r9
68 dnl ABI_SUPPORT(DOS64)
71 dnl IFDOS(` define(`up', ``
%rsi
'') ') dnl
72 dnl IFDOS(` define(`rp', ``
%rcx
'') ') dnl
73 dnl IFDOS(` define(`vl', ``
%r9
'') ') dnl
74 dnl IFDOS(` define(`r9', ``rdi
'') ') dnl
75 dnl IFDOS(` define(`n', ``
%r8
'') ') dnl
76 dnl IFDOS(` define(`r8', ``r11
'') ') dnl
85 mov R32(n_param), R32(%r8)
87 and $7, R32(%r8) C clear OF, CF as side-effect
89 lea L(tab)(%rip), %r10
91 ` movslq
(%r10
,%r8
,4), %r8
99 L
(tab
): JMPENT
( L
(f0
), L
(tab
))
100 JMPENT
( L
(f1
), L
(tab
))
101 JMPENT
( L
(f2
), L
(tab
))
102 JMPENT
( L
(f3
), L
(tab
))
103 JMPENT
( L
(f4
), L
(tab
))
104 JMPENT
( L
(f5
), L
(tab
))
105 JMPENT
( L
(f6
), L
(tab
))
106 JMPENT
( L
(f7
), L
(tab
))
109 L
(f0
): mulx
( (up
), %r10
, %r8
)
114 L
(f3
): mulx
( (up
), %r9
, %rax
)
120 L
(f4
): mulx
( (up
), %r10
, %r8
)
126 L
(f5
): mulx
( (up
), %r9
, %rax
)
132 L
(f6
): mulx
( (up
), %r10
, %r8
)
138 L
(f7
): mulx
( (up
), %r9
, %rax
)
144 L
(f1
): mulx
( (up
), %r9
, %rax
)
150 L
(f2
): mulx
( (up
), %r10
, %r8
)
153 mulx
( (up
), %r9
, %rax
)
158 L
(top
): mov %r10
, -8(rp
)
160 L
(b1
): mulx
( 8,(up
), %r10
, %r8
)
164 L
(b0
): mov %r10
, 8(rp
)
165 mulx
( -48,(up
), %r9
, %rax
)
168 L
(b7
): mulx
( -40,(up
), %r10
, %r8
)
171 L
(b6
): mov %r10
, -40(rp
)
172 mulx
( -32,(up
), %r9
, %rax
)
174 L
(b5
): mulx
( -24,(up
), %r10
, %r8
)
177 L
(b4
): mulx
( -16,(up
), %r9
, %rax
)
180 L
(b3
): mulx
( -8,(up
), %r10
, %r8
)
184 mulx
( (up
), %r9
, %rax
)
187 L
(end): mov %r10
, -8(rp
)