xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/s390_32/copyi.asm (revision 8450a7c42673d65e3b1f6560d3b6ecd317a6cbe8)
1dnl  S/390-32 mpn_copyi
2
3dnl  Copyright 2011 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
20
21include(`../config.m4')
22
23C            cycles/limb
24C z900		 0.75
25C z990           0.375
26C z9		 ?
27C z10		 ?
28C z196		 ?
29
30C NOTE
31C  * This is based on GNU libc memcpy which was written by Martin Schwidefsky.
32
33C INPUT PARAMETERS
34define(`rp',	`%r2')
35define(`up',	`%r3')
36define(`n',	`%r4')
37
38ASM_START()
39PROLOGUE(mpn_copyi)
40	ltr	%r4, %r4
41	sll	%r4, 2
42	je	L(rtn)
43	ahi	%r4, -1
44	lr	%r5, %r4
45	srl	%r5, 8
46	ltr	%r5, %r5		C < 256 bytes to copy?
47	je	L(1)
48
49L(top):	mvc	0(256, rp), 0(up)
50	la	rp, 256(rp)
51	la	up, 256(up)
52	brct	%r5, L(top)
53
54L(1):	bras	%r5, L(2)		C make r5 point to mvc insn
55	mvc	0(1, rp), 0(up)
56L(2):	ex	%r4, 0(%r5)		C execute mvc with length ((n-1) mod 256)+1
57L(rtn):	br	%r14
58EPILOGUE()
59