1 dnl Intel P5 mpn_mod_34lsub1
-- mpn remainder modulo
2**24-1.
3 dnl Copyright
2000-2002 Free Software Foundation
, Inc.
5 dnl
This file is part of the GNU MP Library.
7 dnl The GNU MP Library is free software
; you can redistribute it and/or modify
8 dnl it under the terms of
either:
10 dnl
* the GNU Lesser General
Public License as published by the Free
11 dnl Software Foundation
; either version 3 of the License, or (at your
12 dnl option
) any later version.
16 dnl
* the GNU General
Public License as published by the Free Software
17 dnl Foundation
; either version 2 of the License, or (at your option) any
20 dnl
or both
in parallel
, as here.
22 dnl The GNU MP Library is distributed
in the hope that it will be useful
, but
23 dnl WITHOUT ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY
24 dnl
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License
27 dnl You should have received copies of the GNU General
Public License
and the
28 dnl GNU Lesser General
Public License along with the GNU MP Library. If
not,
29 dnl see
https://www.gnu.
org/licenses
/.
31 include(`..
/config.m4
')
34 C P5: 1.66 cycles/limb
37 C mp_limb_t mpn_mod_34lsub1 (mp_srcptr src, mp_size_t size)
40 defframe(PARAM_SIZE, 8)
41 defframe(PARAM_SRC, 4)
45 PROLOGUE(mpn_mod_34lsub1)
88 pushl
%ebx FRAME_pushl
()
89 pushl
%esi FRAME_pushl
()
91 pushl
%edi FRAME_pushl
()
92 pushl
%ebp FRAME_pushl
()
94 xorl
%esi, %esi C
0mod3
95 xorl
%edi, %edi C
1mod3
97 xorl
%ebp, %ebp C
2mod3
, and clear carry
124 C
ecx is
-2, -1 or 0, representing
0, 1 or 2 more limbs
, respectively
126 movl
$0xFFFFFFFF
, %ebx C
mask
129 js L
(combine
) C
0 more
132 movl
$0xFFFFFF00
, %ebx
137 js L
(combine
) C
1 more
140 movl
$0xFFFF0000
, %ebx
155 sbbl
%ecx, %ecx C carry
156 movl
%esi, %eax C
0mod3
158 andl
%ebx, %ecx C masked for position
159 andl
$0xFFFFFF
, %eax C
0mod3
low
161 shrl
$24, %esi C
0mod3
high
162 subl
%ecx, %eax C apply carry
164 addl
%esi, %eax C apply
0mod3
165 movl
%edi, %ebx C
1mod3
167 shrl
$16, %edi C
1mod3
high
168 andl
$0x0000FFFF
, %ebx
170 shll
$8, %ebx C
1mod3
low
171 addl
%edi, %eax C apply
1mod3
high
173 addl
%ebx, %eax C apply
1mod3
low
174 movl
%ebp, %ebx C
2mod3
176 shrl
$8, %ebp C
2mod3
high
179 shll
$16, %ebx C
2mod3
low
180 addl
%ebp, %eax C apply
2mod3
high
182 addl
%ebx, %eax C apply
2mod3
low