bdiv_dbm1c.asm revision 1.1.1.2
1dnl  x86_64 mpn_bdiv_dbm1.
2
3dnl  Copyright 2008, 2011, 2012 Free Software Foundation, Inc.
4
5dnl  This file is part of the GNU MP Library.
6
7dnl  The GNU MP Library is free software; you can redistribute it and/or modify
8dnl  it under the terms of the GNU Lesser General Public License as published
9dnl  by the Free Software Foundation; either version 3 of the License, or (at
10dnl  your option) any later version.
11
12dnl  The GNU MP Library is distributed in the hope that it will be useful, but
13dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15dnl  License for more details.
16
17dnl  You should have received a copy of the GNU Lesser General Public License
18dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
19
20include(`../config.m4')
21
22C	     cycles/limb
23C AMD K8,K9	 2.25
24C AMD K10	 2.25
25C Intel P4	12.5
26C Intel core2	 4
27C Intel NHM	 3.75
28C Intel SBR	 3.6
29C Intel atom	20
30C VIA nano	 4
31
32C TODO
33C  * Optimise feed-in code.
34
35C INPUT PARAMETERS
36define(`qp',	  `%rdi')
37define(`up',	  `%rsi')
38define(`n_param', `%rdx')
39define(`bd',	  `%rcx')
40define(`cy',	  `%r8')
41
42define(`n',       `%r9')
43
44ABI_SUPPORT(DOS64)
45ABI_SUPPORT(STD64)
46
47ASM_START()
48	TEXT
49	ALIGN(16)
50PROLOGUE(mpn_bdiv_dbm1c)
51	FUNC_ENTRY(4)
52IFDOS(`	mov	56(%rsp), %r8	')
53	mov	(up), %rax
54	mov	n_param, n
55	mov	R32(n_param), R32(%r11)
56	mul	bd
57	lea	(up,n,8), up
58	lea	(qp,n,8), qp
59	neg	n
60	and	$3, R32(%r11)
61	jz	L(lo0)
62	lea	-4(n,%r11), n
63	cmp	$2, R32(%r11)
64	jc	L(lo1)
65	jz	L(lo2)
66	jmp	L(lo3)
67
68	ALIGN(16)
69L(top):	mov	(up,n,8), %rax
70	mul	bd
71L(lo0):	sub	%rax, %r8
72	mov	%r8, (qp,n,8)
73	sbb	%rdx, %r8
74	mov	8(up,n,8), %rax
75	mul	bd
76L(lo3):	sub	%rax, %r8
77	mov	%r8, 8(qp,n,8)
78	sbb	%rdx, %r8
79	mov	16(up,n,8), %rax
80	mul	bd
81L(lo2):	sub	%rax, %r8
82	mov	%r8, 16(qp,n,8)
83	sbb	%rdx, %r8
84	mov	24(up,n,8), %rax
85	mul	bd
86L(lo1):	sub	%rax, %r8
87	mov	%r8, 24(qp,n,8)
88	sbb	%rdx, %r8
89	add	$4, n
90	jnz	L(top)
91
92	mov	%r8, %rax
93	FUNC_EXIT()
94	ret
95EPILOGUE()
96