1
dnl Generic x86 mpn_mod_32lsub1 -- mpn remainder modulo 2^24-1.
10
dnl Copyright 2000, 2001 Free Software Foundation, Inc.
12
dnl This file is part of the GNU MP Library.
14
dnl The GNU MP Library is free software; you can redistribute it and/or
15
dnl modify it under the terms of the GNU Lesser General Public License as
16
dnl published by the Free Software Foundation; either version 2.1 of the
17
dnl License, or (at your option) any later version.
19
dnl The GNU MP Library is distributed in the hope that it will be useful,
20
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
21
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
dnl Lesser General Public License for more details.
24
dnl You should have received a copy of the GNU Lesser General Public
25
dnl License along with the GNU MP Library; see the file COPYING.LIB. If
26
dnl not, write to the Free Software Foundation, Inc., 59 Temple Place -
27
dnl Suite 330, Boston, MA 02111-1307, USA.
29
include(`../config.m4')
32
C mp_limb_t mpn_mod_34lsub1 (mp_srcptr src, mp_size_t size)
35
defframe(PARAM_SIZE, 8)
36
defframe(PARAM_SRC, 4)
38
dnl re-use parameter space
39
define(SAVE_EBX, `PARAM_SRC')
43
PROLOGUE(mpn_mod_34lsub1)
57
shrl $24, %eax C src[0] low
59
andl $0xFFFFFF, %edx C src[0] high
64
shrl $16, %edx C src[1] high
67
shll $8, %ecx C src[1] low
83
movl %ebx, SAVE_EBX C and arrange 16-byte loop alignment
86
pushl %esi FRAME_pushl()
89
pushl %edi FRAME_pushl()
90
xorl %eax, %eax C and clear carry flag
114
C ecx is -2, -1 or 0 representing 0, 1 or 2 more limbs, respectively
116
movl $0xFFFFFFFF, %edi
121
movl $0xFFFFFF00, %edi
126
movl $0xFFFF0000, %edi
138
sbbl %ecx, %ecx C carry
139
movl %eax, %edx C 0mod3
141
shrl $24, %eax C 0mod3 high
142
andl %edi, %ecx C carry masked
144
subl %ecx, %eax C apply carry
145
movl %ebx, %edi C 1mod3
147
shrl $16, %ebx C 1mod3 high
148
andl $0x00FFFFFF, %edx C 0mod3 low
150
addl %edx, %eax C apply 0mod3 low
153
shll $8, %edi C 1mod3 low
154
addl %ebx, %eax C apply 1mod3 high
156
addl %edi, %eax C apply 1mod3 low
157
movl %esi, %edx C 2mod3
159
shrl $8, %esi C 2mod3 high
160
andl $0xFF, %edx C 2mod3 low
162
shll $16, %edx C 2mod3 low
163
addl %esi, %eax C apply 2mod3 high
165
addl %edx, %eax C apply 2mod3 low
166
popl %edi FRAME_popl()
169
popl %esi FRAME_popl()