1 dnl AMD64 mpn_copyi optimised for CPUs with fast SSE.
3 dnl Copyright
2003, 2005, 2007, 2011, 2012, 2015 Free Software Foundation
,
6 dnl Contributed to the GNU project by Torbjörn Granlund.
8 dnl
This file is part of the GNU MP Library.
10 dnl The GNU MP Library is free software
; you can redistribute it and/or modify
11 dnl it under the terms of
either:
13 dnl
* the GNU Lesser General
Public License as published by the Free
14 dnl Software Foundation
; either version 3 of the License, or (at your
15 dnl option
) any later version.
19 dnl
* the GNU General
Public License as published by the Free Software
20 dnl Foundation
; either version 2 of the License, or (at your option) any
23 dnl
or both
in parallel
, as here.
25 dnl The GNU MP Library is distributed
in the hope that it will be useful
, but
26 dnl WITHOUT ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY
27 dnl
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License
30 dnl You should have received copies of the GNU General
Public License
and the
31 dnl GNU Lesser General
Public License along with the GNU MP Library. If
not,
32 dnl see
https://www.gnu.
org/licenses
/.
34 include(`..
/config.m4
')
36 C cycles/limb cycles/limb cycles/limb good
37 C aligned unaligned best seen for cpu?
39 C AMD K10 0.85 1.64 Y/N
41 C AMD pile 0.77 0.93 N
45 C AMD jaguar 0.65 1.02 opt/0.93 Y/N
47 C Intel core 1.0 1.0 0.52/0.64 N
48 C Intel NHM 0.5 0.67 Y
49 C Intel SBR 0.51 0.75 opt/0.54 Y/N
50 C Intel IBR 0.50 0.57 opt/0.54 Y
51 C Intel HWL 0.50 0.57 opt/0.51 Y
52 C Intel BWL 0.55 0.62 opt/0.55 Y
54 C Intel SLM 1.02 1.27 opt/1.07 Y/N
55 C VIA nano 1.16 5.16 Y/N
57 C We try to do as many 16-byte operations as possible. The top-most and
58 C bottom-most writes might need 8-byte operations. We can always write using
59 C aligned 16-byte operations, we read with both aligned and unaligned 16-byte
62 C Instead of having separate loops for reading aligned and unaligned, we read
63 C using MOVDQU. This seems to work great except for core2; there performance
64 C doubles when reading using MOVDQA (for aligned source). It is unclear how to
65 C best handle the unaligned case there.
75 dnl define(`movdqu', lddqu
)
83 cmp $3, n C
NB: bc code below assumes
this limit
86 test $8, R8
(rp
) C is rp
16-byte aligned
?
87 jz L
(ali
) C jump if rp aligned
88 movsq C copy single limb
95 L
(top
): movdqu
(up
), %xmm0
102 movdqu
112(up
), %xmm7
111 movdqa
%xmm7
, 112(rp
)
116 L
(sma
): test $8, R8
(n
)
146 L
(end): test $1, R8
(n
)
154 C Basecase code. Needed for good
small operands speed
, not for correctness as
155 C the above code is currently written. The commented
-out lines need to be
156 C reinstated if
this code is to be used for n
> 3, and then the post
loop
157 C offsets need fixing.