1dnl  PowerPC-64 mpn_copyi.
2
3dnl  Copyright 2004, 2005 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 POWER3/PPC630:     1
24C POWER4/PPC970:     1
25
26C INPUT PARAMETERS
27C rp	r3
28C up	r4
29C n	r5
30
31ASM_START()
32PROLOGUE(mpn_copyi)
33	rldic.	r0, r5, 3, 59	C r0 = (r5 & 3) << 3; cr0 = (n == 4t)?
34	cmpldi	cr6, r0, 16	C cr6 = (n cmp 4t + 2)?
35
36	addi	r5, r5, 4	C compute...
37ifdef(`HAVE_ABI_mode32',
38`	rldicl	r5, r5, 62,34',	C ...branch count
39`	rldicl	r5, r5, 62, 2')	C ...branch count
40	mtctr	r5
41
42	add	r4, r4, r0	C offset up
43	add	r3, r3, r0	C offset rp
44
45	beq	cr0, L(L00)
46	blt	cr6, L(L01)
47	beq	cr6, L(L10)
48	b	L(L11)
49
50	ALIGN(16)
51L(oop):	ld	r6, -32(r4)
52	std	r6, -32(r3)
53L(L11):	ld	r6, -24(r4)
54	std	r6, -24(r3)
55L(L10):	ld	r6, -16(r4)
56	std	r6, -16(r3)
57L(L01):	ld	r6, -8(r4)
58	std	r6, -8(r3)
59L(L00):	addi	r4, r4, 32
60	addi	r3, r3, 32
61	bdnz	L(oop)
62
63	blr
64EPILOGUE()
65