1 dnl mpn_mod_1_4 for Pentium 4 and P6 models with SSE2 (i.e., 9,D,E,F).
3 dnl Contributed to the GNU project by Torbjorn Granlund.
5 dnl Copyright 2009 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 the GNU Lesser General Public License as published
11 dnl by the Free Software Foundation; either version 3 of the License, or (at
12 dnl your option) any later version.
14 dnl The GNU MP Library is distributed in the hope that it will be useful, but
15 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 dnl License for more details.
19 dnl You should have received a copy of the GNU Lesser General Public License
20 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
22 include(`../config.m4')
25 C * Optimize. The present code was written quite straightforwardly.
26 C * Optimize post-loop reduction code.
29 C P6 model 0-8,10-12) -
30 C P6 model 9 (Banias) ?
31 C P6 model 13 (Dothan) 3.4
32 C P4 model 0-1 (Willamette): ?
33 C P4 model 2 (Northwood): 4
34 C P4 model 3-4 (Prescott): ?
42 define(`B1modb', `%mm1')
43 define(`B2modb', `%mm2')
44 define(`B3modb', `%mm3')
45 define(`B4modb', `%mm4')
46 define(`B5modb', `%mm5')
52 PROLOGUE(mpn_mod_1s_4p)
72 L(b3): movd -4(ap), %mm7
84 L(b0): movd -8(ap), %mm7
99 L(b1): movd (ap), %mm7
105 L(b2): movd (ap), %mm7
114 L(top): movd 4(ap), %mm0
141 psrlq $32, %mm4 C 0x00000000FFFFFFFF
144 pmuludq B1modb, %mm7 C rh,cl
145 paddq %mm4, %mm7 C rh,rl
147 L(x): movd 4(%ecx), %mm4 C cnt
148 psllq %mm4, %mm7 C rh,rl normalized
149 movq %mm7, %mm2 C rl in low half
151 movd (%ecx), %mm1 C bi
152 pmuludq %mm7, %mm1 C qh,ql
153 paddq %mm2, %mm1 C qh-1,ql
155 psrlq $32, %mm1 C qh-1
156 movd 16(%esp), %mm3 C b
157 pmuludq %mm1, %mm3 C (qh-1) * b
158 psubq %mm3, %mm2 C r in low half (could use psubd)
163 lea (%eax,%ebx), %edx
165 movd %mm4, %ecx C cnt
173 L(fix): sub %ebx, %eax
180 PROLOGUE(mpn_mod_1s_4p_cps)
211 lea (%esi,%ebx), %edx
216 lea (%esi,%edx), %edi
219 lea (%edi,%ebx), %edx
224 lea (%edi,%edx), %ebp
227 lea (%ebp,%ebx), %edx