beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / x86_64 / bdiv_dbm1c.asm
bloba53bd52beb3df20ce7636208e89764374d5077d4
1 dnl x86_64 mpn_bdiv_dbm1.
3 dnl Copyright 2008, 2011, 2012 Free Software Foundation, Inc.
5 dnl This file is part of the GNU MP Library.
6 dnl
7 dnl The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl it under the terms of either:
9 dnl
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.
13 dnl
14 dnl or
15 dnl
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
18 dnl later version.
19 dnl
20 dnl or both in parallel, as here.
21 dnl
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
25 dnl for more details.
26 dnl
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')
33 C cycles/limb
34 C AMD K8,K9 2.25
35 C AMD K10 2.25
36 C Intel P4 12.5
37 C Intel core2 4
38 C Intel NHM 3.75
39 C Intel SBR 3.6
40 C Intel atom 20
41 C VIA nano 4
43 C TODO
44 C * Optimise feed-in code.
46 C INPUT PARAMETERS
47 define(`qp', `%rdi')
48 define(`up', `%rsi')
49 define(`n_param', `%rdx')
50 define(`bd', `%rcx')
51 define(`cy', `%r8')
53 define(`n', `%r9')
55 ABI_SUPPORT(DOS64)
56 ABI_SUPPORT(STD64)
58 ASM_START()
59 TEXT
60 ALIGN(16)
61 PROLOGUE(mpn_bdiv_dbm1c)
62 FUNC_ENTRY(4)
63 IFDOS(` mov 56(%rsp), %r8 ')
64 mov (up), %rax
65 mov n_param, n
66 mov R32(n_param), R32(%r11)
67 mul bd
68 lea (up,n,8), up
69 lea (qp,n,8), qp
70 neg n
71 and $3, R32(%r11)
72 jz L(lo0)
73 lea -4(n,%r11), n
74 cmp $2, R32(%r11)
75 jc L(lo1)
76 jz L(lo2)
77 jmp L(lo3)
79 ALIGN(16)
80 L(top): mov (up,n,8), %rax
81 mul bd
82 L(lo0): sub %rax, %r8
83 mov %r8, (qp,n,8)
84 sbb %rdx, %r8
85 mov 8(up,n,8), %rax
86 mul bd
87 L(lo3): sub %rax, %r8
88 mov %r8, 8(qp,n,8)
89 sbb %rdx, %r8
90 mov 16(up,n,8), %rax
91 mul bd
92 L(lo2): sub %rax, %r8
93 mov %r8, 16(qp,n,8)
94 sbb %rdx, %r8
95 mov 24(up,n,8), %rax
96 mul bd
97 L(lo1): sub %rax, %r8
98 mov %r8, 24(qp,n,8)
99 sbb %rdx, %r8
100 add $4, n
101 jnz L(top)
103 mov %r8, %rax
104 FUNC_EXIT()
106 EPILOGUE()