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.
6dnl
7dnl  The GNU MP Library is free software; you can redistribute it and/or modify
8dnl  it under the terms of either:
9dnl
10dnl    * the GNU Lesser General Public License as published by the Free
11dnl      Software Foundation; either version 3 of the License, or (at your
12dnl      option) any later version.
13dnl
14dnl  or
15dnl
16dnl    * the GNU General Public License as published by the Free Software
17dnl      Foundation; either version 2 of the License, or (at your option) any
18dnl      later version.
19dnl
20dnl  or both in parallel, as here.
21dnl
22dnl  The GNU MP Library is distributed in the hope that it will be useful, but
23dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25dnl  for more details.
26dnl
27dnl  You should have received copies of the GNU General Public License and the
28dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
29dnl  see https://www.gnu.org/licenses/.
30
31include(`../config.m4')
32
33C                  cycles/limb
34C POWER3/PPC630          1
35C POWER4/PPC970          1
36C POWER5                 ?
37C POWER6                 ?
38C POWER7                 1.4
39
40C INPUT PARAMETERS
41C rp	r3
42C up	r4
43C n	r5
44
45ASM_START()
46PROLOGUE(mpn_copyi)
47	rldic.	r0, r5, 3, 59	C r0 = (r5 & 3) << 3; cr0 = (n == 4t)?
48	cmpldi	cr6, r0, 16	C cr6 = (n cmp 4t + 2)?
49
50	addi	r5, r5, 4	C compute...
51ifdef(`HAVE_ABI_mode32',
52`	rldicl	r5, r5, 62,34',	C ...branch count
53`	rldicl	r5, r5, 62, 2')	C ...branch count
54	mtctr	r5
55
56	add	r4, r4, r0	C offset up
57	add	r3, r3, r0	C offset rp
58
59	beq	cr0, L(L00)
60	blt	cr6, L(L01)
61	beq	cr6, L(L10)
62	b	L(L11)
63
64	ALIGN(16)
65L(oop):	ld	r6, -32(r4)
66	std	r6, -32(r3)
67L(L11):	ld	r6, -24(r4)
68	std	r6, -24(r3)
69L(L10):	ld	r6, -16(r4)
70	std	r6, -16(r3)
71L(L01):	ld	r6, -8(r4)
72	std	r6, -8(r3)
73L(L00):	addi	r4, r4, 32
74	addi	r3, r3, 32
75	bdnz	L(oop)
76
77	blr
78EPILOGUE()
79