1dnl  AMD64 mpn_com.
2
3dnl  Copyright 2004, 2005, 2006 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
22
23C	    cycles/limb
24C K8,K9:	1.25
25C K10:		1.25
26C P4:		2.78
27C P6-15:	1.1
28
29C INPUT PARAMETERS
30define(`rp',`%rdi')
31define(`up',`%rsi')
32define(`n',`%rdx')
33
34
35ASM_START()
36	TEXT
37	ALIGN(32)
38PROLOGUE(mpn_com)
39	movq	(up), %r8
40	movl	%edx, %eax
41	leaq	(up,n,8), up
42	leaq	(rp,n,8), rp
43	negq	n
44	andl	$3, %eax
45	je	L(b00)
46	cmpl	$2, %eax
47	jc	L(b01)
48	je	L(b10)
49
50L(b11):	notq	%r8
51	movq	%r8, (rp,n,8)
52	decq	n
53	jmp	L(e11)
54L(b10):	addq	$-2, n
55	jmp	L(e10)
56	.byte	0x90,0x90,0x90,0x90,0x90,0x90
57L(b01):	notq	%r8
58	movq	%r8, (rp,n,8)
59	incq	n
60	jz	L(ret)
61
62L(oop):	movq	(up,n,8), %r8
63L(b00):	movq	8(up,n,8), %r9
64	notq	%r8
65	notq	%r9
66	movq	%r8, (rp,n,8)
67	movq	%r9, 8(rp,n,8)
68L(e11):	movq	16(up,n,8), %r8
69L(e10):	movq	24(up,n,8), %r9
70	notq	%r8
71	notq	%r9
72	movq	%r8, 16(rp,n,8)
73	movq	%r9, 24(rp,n,8)
74	addq	$4, n
75	jnc	L(oop)
76L(ret):	ret
77EPILOGUE()
78