1dnl  HP-PA  mpn_rshift -- Shift a number right.
2
3dnl  Copyright 1992, 1994, 2000, 2001, 2002 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 INPUT PARAMETERS
23C res_ptr	gr26
24C s_ptr		gr25
25C size		gr24
26C cnt		gr23
27
28ASM_START()
29PROLOGUE(mpn_rshift)
30	ldws,ma		4(0,%r25),%r22
31	mtsar		%r23
32	addib,=		-1,%r24,L(0004)
33	vshd		%r22,%r0,%r28		C compute carry out limb
34	ldws,ma		4(0,%r25),%r29
35	addib,=		-1,%r24,L(0002)
36	vshd		%r29,%r22,%r20
37
38LDEF(loop)
39	ldws,ma		4(0,%r25),%r22
40	stws,ma		%r20,4(0,%r26)
41	addib,=		-1,%r24,L(0003)
42	vshd		%r22,%r29,%r20
43	ldws,ma		4(0,%r25),%r29
44	stws,ma		%r20,4(0,%r26)
45	addib,<>	-1,%r24,L(loop)
46	vshd		%r29,%r22,%r20
47
48LDEF(0002)
49	stws,ma		%r20,4(0,%r26)
50	vshd		%r0,%r29,%r20
51	bv		0(%r2)
52	stw		%r20,0(0,%r26)
53
54LDEF(0003)
55	stws,ma		%r20,4(0,%r26)
56
57LDEF(0004)
58	vshd		%r0,%r22,%r20
59	bv		0(%r2)
60	stw		%r20,0(0,%r26)
61EPILOGUE()
62