1 dnl Generic x86 mpn_mod_34lsub1
-- mpn remainder modulo
2^
24-1.
3 dnl Copyright
2000-2002, 2004 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
')
42 C mp_limb_t mpn_mod_34lsub1 (mp_srcptr src, mp_size_t size)
45 defframe(PARAM_SIZE, 8)
46 defframe(PARAM_SRC, 4)
48 dnl re-use parameter space
49 define(SAVE_EBX, `PARAM_SRC')
53 PROLOGUE
(mpn_mod_34lsub1
)
67 shrl $24, %eax C src[0] low
69 andl $0xFFFFFF, %edx C src[0] high
74 shrl $16, %edx C src[1] high
77 shll $8, %ecx C src[1] low
93 movl %ebx, SAVE_EBX C and arrange 16-byte loop alignment
96 pushl %esi FRAME_pushl()
99 pushl %edi FRAME_pushl()
100 xorl %eax, %eax C and clear carry flag
124 C ecx is -2, -1 or 0 representing 0, 1 or 2 more limbs, respectively
126 movl $0xFFFFFFFF, %edi
131 movl $0xFFFFFF00, %edi
136 movl $0xFFFF0000, %edi
148 sbbl %ecx, %ecx C carry
149 movl %eax, %edx C 0mod3
151 shrl $24, %eax C 0mod3 high
152 andl %edi, %ecx C carry masked
154 subl %ecx, %eax C apply carry
155 movl %ebx, %edi C 1mod3
157 shrl $16, %ebx C 1mod3 high
158 andl $0x00FFFFFF, %edx C 0mod3 low
160 addl %edx, %eax C apply 0mod3 low
163 shll $8, %edi C 1mod3 low
164 addl %ebx, %eax C apply 1mod3 high
166 addl %edi, %eax C apply 1mod3 low
167 movl %esi, %edx C 2mod3
169 shrl $8, %esi C 2mod3 high
170 andl $0xFF, %edx C 2mod3 low
172 shll $16, %edx C 2mod3 low
173 addl %esi, %eax C apply 2mod3 high
175 addl %edx, %eax C apply 2mod3 low
176 popl %edi FRAME_popl()
179 popl %esi FRAME_popl()