1 dnl x86
-32 mpn_mod_1_1p 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, 2010 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
')
36 C * Optimize. The present code was written quite straightforwardly.
37 C * Optimize post-loop reduction code; it is from mod_1s_4p, thus overkill.
38 C * Write a cps function that uses sse2 insns.
41 C P6 model 0-8,10-12 -
42 C P6 model 9 (Banias) ?
43 C P6 model 13 (Dothan) ?
44 C P4 model 0-1 (Willamette) ?
45 C P4 model 2 (Northwood) 16
46 C P4 model 3-4 (Prescott) 18
54 define(`B1modb', `
%mm1
')
55 define(`B2modb', `
%mm2
')
61 PROLOGUE(mpn_mod_1_1p)
71 C FIXME: See comment in generic/mod_1_1.c.
80 L(top): movq %mm7, %mm6
91 L(end): pcmpeqd %mm4, %mm4
92 psrlq $32, %mm4 C 0x00000000FFFFFFFF
95 pmuludq B1modb, %mm7 C rh,cl
96 paddq %mm4, %mm7 C rh,rl
97 movd 4(%ecx), %mm4 C cnt
98 psllq %mm4, %mm7 C rh,rl normalized
99 movq %mm7, %mm2 C rl in low half
101 movd (%ecx), %mm1 C bi
102 pmuludq %mm7, %mm1 C qh,ql
103 paddq %mm2, %mm1 C qh-1,ql
105 psrlq $32, %mm1 C qh-1
106 movd 16(%esp), %mm3 C b
107 pmuludq %mm1, %mm3 C (qh-1) * b
108 psubq %mm3, %mm2 C r in low half (could use psubd)
113 lea (%eax,%ebx), %edx
115 movd %mm4, %ecx C cnt
123 L(fix): sub %ebx, %eax
130 PROLOGUE(mpn_mod_1_1p_cps)
131 C CAUTION: This is the same code as in k7/mod_1_1.asm
144 mov %eax, (%esi) C store bi
145 mov %ecx, 4(%esi) C store cnt
159 mov %ebx, 8(%esi) C store B1modb
161 mov %edx, 12(%esi) C store B2modb