1 dnl x86
-32 mpn_mod_1_1p
, requiring cmov.
3 dnl Contributed to the GNU project by Niels Möller
and Torbjorn Granlund.
5 dnl Copyright
2010, 2011 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
')
37 C P6 model 0-8,10-12 ?
38 C P6 model 9 (Banias) ?
39 C P6 model 13 (Dothan) ?
40 C P4 model 0 (Willamette) ?
42 C P4 model 2 (Northwood) ?
43 C P4 model 3 (Prescott) ?
44 C P4 model 4 (Nocona) ?
49 define(`B2mb', `
%ebx')
53 define(`ap', `
%ecx') C Also shift count
67 define(`B2modb', `
(%esp)')
68 define(`n', `
28(%esp)')
69 define(`b', `
32(%esp)')
70 define(`pre', `
36(%esp)')
73 C mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t pre[4])
75 C The pre array contains bi, cnt, B1modb, B2modb
76 C Note: This implementation needs B1modb only when cnt > 0
81 PROLOGUE(mpn_mod_1_1p)
86 mov 32(%esp), %ebp C pre[]
88 mov 12(%ebp), %eax C B2modb
89 push %eax C Put it on stack
102 C First iteration, no r2
119 L(top): C Loopmixed to 7 c/l on k7
150 C Unnormalized, use B1modb to reduce to size < B b
157 C Left-shift to normalize
158 shld %cl, r0, %eax C Always use shld?
171 mov b, %ebx C Needed in register for lea
190 L(fix): sub %ebx, %eax
194 PROLOGUE(mpn_mod_1_1p_cps)
206 div %ebp C On K7, invert_limb would be a few cycles faster.
207 mov %eax, (%esi) C store bi
208 mov %ecx, 4(%esi) C store cnt
215 mov %edx, 8(%esi) C store B1modb
216 mov %eax, 12(%esi) C store B2modb