1 dnl AMD64 mpn_mullo_basecase optimised for Intel Sandy bridge
and Ivy bridge.
3 dnl Contributed to the GNU project by Torbjörn Granlund.
5 dnl Copyright
2008, 2009, 2011-2013 Free Software Foundation
, Inc.
7 dnl
This file is part of the GNU MP Library.
9 dnl The GNU MP Library is free software
; you can redistribute it and/or modify
10 dnl it under the terms of
either:
12 dnl
* the GNU Lesser General
Public License as published by the Free
13 dnl Software Foundation
; either version 3 of the License, or (at your
14 dnl option
) any later version.
18 dnl
* the GNU General
Public License as published by the Free Software
19 dnl Foundation
; either version 2 of the License, or (at your option) any
22 dnl
or both
in parallel
, as here.
24 dnl The GNU MP Library is distributed
in the hope that it will be useful
, but
25 dnl WITHOUT ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY
26 dnl
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License
29 dnl You should have received copies of the GNU General
Public License
and the
30 dnl GNU Lesser General
Public License along with the GNU MP Library. If
not,
31 dnl see
https://www.gnu.
org/licenses
/.
33 include(`..
/config.m4
')
35 C cycles/limb mul_2 addmul_2
53 C The inner loops of this code are the result of running a code generation and
54 C optimisation tool suite written by David Harvey and Torbjörn Granlund.
57 C * Implement proper cor2, replacing current cor0.
58 C * Offset n by 2 in order to avoid the outer loop cmp. (And sqr_basecase?)
61 C When playing with pointers, set this to $2 to fall back to conservative
62 C indexing in wind-down code.
67 define(`vp_param', `
%rdx
')
82 C rax rbx rcx rdx rdi rsi rbp r8 r9 r10 r11 r12 r13 r14 r15
90 PROLOGUE(mpn_mullo_basecase)
101 lea (rp,n,8), rp C point rp at R[un]
103 lea (up,n,8), up C point up right after U's
end
131 L
(m2l1
):mov -8(up
,i
,8), %rax
145 L
(m2l0
):mov (up
,i
,8), %rax
150 mov %rdx
, w2 C
FIXME: dead
in last iteration
152 adc $0, w2 C
FIXME: dead
in last iteration
156 L
(m2ed
):imul v0
, %rax
159 mov %rax
, I
(-8(rp
),-8(rp
,i
,8))
178 L
(a1x0
):mov (rp
,n
,8), X1
195 L
(a1x1
):mov (rp
,n
,8), X0
223 mov -16(up
,i
,8), %rax
228 mov -16(up
,i
,8), %rax
282 L
(end): imul v1
, %rax
287 mov I
(-8(up
),-16(up
,i
,8)), %rax
290 mov X1
, I
(-16(rp
),-24(rp
,i
,8))
292 mov %rax
, I
(-8(rp
),-16(rp
,i
,8))
309 add -16(rp
), %rax C
FIXME: rp
[0] still available
in reg
?
310 adc -8(rp
), %rdx C
FIXME: rp
[1] still available
in reg
?
326 L
(cor0
):mov (vp
), %r11
341 L
(n1
): imul
(vp_param
), %rax
346 L
(n2
): mov (vp_param
), %r9
360 L
(n3
): mov (vp_param
), %r9
366 imul
16(up
), %r9 C u2 x v0
374 imul
8(up
), %r11 C u1 x v1
379 imul
%rax
, %r10 C u0 x v2