Debian Codegraph @

mpn/x86/atom/sse2/mul_1.asm

raw
1 dnl Intel Atom mpn_mul_1.
2
3 dnl Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
4
5 dnl Copyright 2011 Free Software Foundation, Inc.
6
7 dnl This file is part of the GNU MP Library.
8 dnl
9 dnl The GNU MP Library is free software; you can redistribute it and/or modify
10 dnl it under the terms of either:
11 dnl
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.
15 dnl
16 dnl or
17 dnl
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
20 dnl later version.
21 dnl
22 dnl or both in parallel, as here.
23 dnl
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
27 dnl for more details.
28 dnl
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/.
32
33 include(`../config.m4')
34
35 C cycles/limb
36 C cycles/limb
37 C P5 -
38 C P6 model 0-8,10-12 -
39 C P6 model 9 (Banias)
40 C P6 model 13 (Dothan)
41 C P4 model 0 (Willamette)
42 C P4 model 1 (?)
43 C P4 model 2 (Northwood)
44 C P4 model 3 (Prescott)
45 C P4 model 4 (Nocona)
46 C Intel Atom 7.5
47 C AMD K6 -
48 C AMD K7 -
49 C AMD K8
50 C AMD K10
51
52 defframe(PARAM_CARRY,20)
53 defframe(PARAM_MUL, 16)
54 defframe(PARAM_SIZE, 12)
55 defframe(PARAM_SRC, 8)
56 defframe(PARAM_DST, 4)
57
58 define(`rp', `%edx')
59 define(`up', `%esi')
60 define(`n', `%ecx')
61
62 ASM_START()
63 TEXT
64 ALIGN(16)
65 deflit(`FRAME',0)
66
67 PROLOGUE(mpn_mul_1c)
68 movd PARAM_CARRY, %mm6 C carry
69 jmp L(ent)
70 EPILOGUE()
71
72 ALIGN(8) C for compact code
73 PROLOGUE(mpn_mul_1)
74 pxor %mm6, %mm6
75 L(ent): push %esi FRAME_pushl()
76 mov PARAM_SRC, up
77 mov PARAM_SIZE, %eax C size
78 movd PARAM_MUL, %mm7
79 movd (up), %mm0
80 mov %eax, n
81 and $3, %eax
82 pmuludq %mm7, %mm0
83 mov PARAM_DST, rp
84 jz L(lo0)
85 cmp $2, %eax
86 lea -16(up,%eax,4),up
87 lea -16(rp,%eax,4),rp
88 jc L(lo1)
89 jz L(lo2)
90 jmp L(lo3)
91
92 ALIGN(16)
93 L(top): movd (up), %mm0
94 pmuludq %mm7, %mm0
95 psrlq $32, %mm6
96 lea 16(rp), rp
97 L(lo0): paddq %mm0, %mm6
98 movd 4(up), %mm0
99 pmuludq %mm7, %mm0
100 movd %mm6, (rp)
101 psrlq $32, %mm6
102 L(lo3): paddq %mm0, %mm6
103 movd 8(up), %mm0
104 pmuludq %mm7, %mm0
105 movd %mm6, 4(rp)
106 psrlq $32, %mm6
107 L(lo2): paddq %mm0, %mm6
108 movd 12(up), %mm0
109 pmuludq %mm7, %mm0
110 movd %mm6, 8(rp)
111 psrlq $32, %mm6
112 L(lo1): paddq %mm0, %mm6
113 sub $4, n
114 movd %mm6, 12(rp)
115 lea 16(up), up
116 ja L(top)
117
118 psrlq $32, %mm6
119 movd %mm6, %eax
120 emms
121 pop %esi FRAME_popl()
122 ret
123 EPILOGUE()
124 ASM_END()