1 dnl AMD64 mpn_mod_1s_2p
3 dnl Contributed to the GNU project by Torbjorn Granlund.
5 dnl Copyright
2009-2012, 2014 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
')
51 PROLOGUE(mpn_mod_1s_2p)
67 mov -8(%rdi,%rsi,8), %rax
71 mov (%rdi,%rsi,8), %rax
72 add -16(%rdi,%rsi,8), %r9
79 L(b0): mov -8(%rdi,%rsi,8), %r8
80 mov -16(%rdi,%rsi,8), %r9
84 lea 40(%rdi,%rsi,8), %rdi
90 L(top): mov -24(%rdi), %r9
117 lea -32(%rdi), %rdi C ap -= 4
124 L(ed0): mov %r11, %r9
126 L(ed1): add %rax, %r9
128 L(ed2): mov 8(%r13), R32(%rdi) C cnt
134 L(1): xor R32(%rcx), R32(%rcx)
136 sub R32(%rdi), R32(%rcx)
138 mov R32(%rdi), R32(%rcx)
156 mov R32(%rdi), R32(%rcx)
167 mov 8(%rcx), R32(%rdi)
173 PROLOGUE(mpn_mod_1s_2p_cps)
182 mov R32(%rcx), R32(%rbp) C preserve cnt over call
183 sal R8(%rcx), %r12 C b << cnt
184 IFSTD(` mov %r12, %rdi ') C pass parameter
185 IFDOS
(`
mov %r12
, %rcx
') C pass parameter
186 ASSERT(nz, `test $15, %rsp')
187 CALL( mpn_invert_limb
)
190 mov %rax
, (%rbx
) C store bi
191 mov %rbp
, 8(%rbx
) C store cnt
193 mov R32
(%rbp
), R32
(%rcx
)
204 shld R8
(%rcx
), %rax
, %rsi C
FIXME: Slow on Atom
and Nano
211 mov %rsi, 16(%rbx) C store B1modb
215 lea (%rdx,%r12), %rsi
223 mov %rsi, 24(%rbx) C store B2modb
232 mov %r12, 32(%rbx) C store B3modb