1 dnl x86
-64 mpn_divrem_2
-- Divide an mpn number by a normalized
2-limb number.
3 dnl Copyright
2007, 2008, 2010, 2014 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
either:
10 dnl
* the GNU Lesser General
Public License as published by the Free
11 dnl Software Foundation
; either version 3 of the License, or (at your
12 dnl option
) any later version.
16 dnl
* the GNU General
Public License as published by the Free Software
17 dnl Foundation
; either version 2 of the License, or (at your option) any
20 dnl
or both
in parallel
, as here.
22 dnl The GNU MP Library is distributed
in the hope that it will be useful
, but
23 dnl WITHOUT ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY
24 dnl
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License
27 dnl You should have received copies of the GNU General
Public License
and the
28 dnl GNU Lesser General
Public License along with the GNU MP Library. If
not,
29 dnl see
https://www.gnu.
org/licenses
/.
31 include(`..
/config.m4
')
55 define(`up_param', `
%rdx
')
56 define(`un_param', `
%rcx
')
65 PROLOGUE(mpn_divrem_2)
67 IFDOS(` mov 56(%rsp), %r8 ')
72 lea -24(%rdx
,%rcx
,8), %r12 C r12
= &up
[un
-1]
82 xor R32
(%r15
), R32
(%r15
)
88 orb
%al, %dl C
"orb" form to placate Sun tools
94 lea -3(%rcx
,%r13
), %r14 C un
+ fn
- 3
101 IFSTD
(`
mov %r11
, %rdi
')
102 IFDOS(` mov %r11, %rcx ')
103 ASSERT
(nz
, `
test $15, %rsp
')
104 CALL( mpn_invert_limb)
114 xor R32(%rcx), R32(%rcx)
126 lea (%rbp,%r14,8), %rbp
130 C rax rbx rcx rdx rsi rdi rbp r8 r9 r10 r11 r12 r13 r14 r15
131 C n2 un -d1 dinv qp d0 q0 d1 up fn msl
134 L(top): mov %rdi, %rax C di ncp
142 lea (%rdx, %r10), %rbx C n1 -= ... 10
143 xor R32(%r10), R32(%r10) C
149 L(19): sub %r8, %r10 C ncp
153 xor R32(%rax), R32(%rax) C
154 xor R32(%rdx), R32(%rdx) C
156 cmovnc %r8, %rax C 14
157 cmovnc %r11, %rdx C 14
158 adc $0, %r9 C adjust q 14
164 L(bck): mov %r9, (%rbp) C
169 L(end): mov %r10, 8(%r12)
184 orb %dl, %al C "orb" form to placate Sun tools