1 dnl AMD64 mpn_mod_1s_4p
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
')
50 PROLOGUE(mpn_mod_1s_4p)
61 mov 16(%rcx), %r11 C B1modb
62 mov 24(%rcx), %rbx C B2modb
63 mov 32(%rcx), %rbp C B3modb
64 mov 40(%rcx), %r13 C B4modb
65 mov 48(%rcx), %r12 C B5modb
66 xor R32(%r8), R32(%r8)
67 mov R32(%rsi), R32(%rdx)
74 L(b3): lea -24(%rdi,%rsi,8), %rdi
85 L(b0): lea -32(%rdi,%rsi,8), %rdi
100 L(b1): lea -8(%rdi,%rsi,8), %rdi
105 L(b2): lea -16(%rdi,%rsi,8), %rdi
111 L(top): mov -24(%rdi), %rax
113 mul %r11 C up[1] * B1modb
118 mul %rbx C up[2] * B2modb
123 mul %rbp C up[3] * B3modb
127 mul %r9 C rl * B4modb
131 mul %r8 C rh * B5modb
139 L(end): mov 8(%r14), R32(%rsi)
145 xor R32(%rcx), R32(%rcx)
146 sub R32(%rsi), R32(%rcx)
149 mov R32(%rsi), R32(%rcx)
180 PROLOGUE(mpn_mod_1s_4p_cps)
189 mov R32(%rcx), R32(%rbp) C preserve cnt over call
190 sal R8(%rcx), %r12 C b << cnt
191 IFSTD(` mov %r12, %rdi ') C pass parameter
192 IFDOS
(`
mov %r12
, %rcx
') C pass parameter
193 ASSERT(nz, `test $15, %rsp')
194 CALL( mpn_invert_limb
)
197 mov %rax
, (%rbx
) C store bi
198 mov %rbp
, 8(%rbx
) C store cnt
200 mov R32
(%rbp
), R32
(%rcx
)
211 shld R8
(%rcx
), %rax
, %rsi C
FIXME: Slow on Atom
and Nano
218 mov %rsi, 16(%rbx) C store B1modb
222 lea (%rdx,%r12), %rsi
230 mov %rsi, 24(%rbx) C store B2modb
234 lea (%rdx,%r12), %rsi
242 mov %rsi, 32(%rbx) C store B3modb
246 lea (%rdx,%r12), %rsi
254 mov %rsi, 40(%rbx) C store B4modb
263 mov %r12, 48(%rbx) C store B5modb