1 dnl x86 mpn_divrem_2 -- Divide an mpn number by a normalized 2-limb number.
3 dnl Copyright 2007, 2008 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 the GNU Lesser General Public License as published
9 dnl by the Free Software Foundation; either version 3 of the License, or (at
10 dnl your option) any later version.
12 dnl The GNU MP Library is distributed in the hope that it will be useful, but
13 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 dnl License for more details.
17 dnl You should have received a copy of the GNU Lesser General Public License
18 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
20 include(`../config.m4')
36 C A star means numbers not updated for the latest version of the code.
40 C * Perhaps keep ecx or esi in stack slot, freeing up a reg for q0.
41 C * The loop has not been carefully tuned. We should at the very least do
42 C some local insn swapping.
43 C * The code outside the main loop is what gcc generated. Clean up!
44 C * Clean up stack slot usage.
54 C eax ebx ecx edx esi edi ebp
60 PROLOGUE(mpn_divrem_2)
66 mov 68(%esp), %ecx C un
67 mov 72(%esp), %esi C dp
70 add 64(%esp), %edi C up
87 mov 60(%esp), %esi C fn
88 lea -3(%esi,%ecx), %edi
114 mov %esi, 16(%esp) C di
116 mov 12(%esp), %esi C up
119 mov %eax, 4(%esp) C -d1
123 C eax ebx ecx edx esi edi ebp 0 4 8 12 16 20 24 28 32 56 60
124 C n2 un up n1 q0 -d1 di d0 d1 msl qp fn
127 mov 16(%esp), %eax C di
130 mov %eax, (%esp) C q0
135 lea (%edx, %ebp), %ebx C n1 -= ...
142 L(19): sub 20(%esp), %ebp
146 mov 20(%esp), %eax C d1
152 and %edx, %eax C d0 or 0
153 and 24(%esp), %edx C d1 or 0
158 L(bck): mov 56(%esp), %edx
159 mov %edi, (%edx, %ecx, 4)
163 L(9): mov 64(%esp), %esi C up
184 L(35): sub 20(%esp), %ebp