xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/pa32/hppa1_1/pa7100/lshift.asm (revision 62f324d0121177eaf2e0384f92fd9ca2a751c795)
1dnl  HP-PA  mpn_lshift -- Shift a number left.
2dnl  Optimized for the PA7100, where is runs at 3.25 cycles/limb.
3
4dnl  Copyright 1992, 1994, 2000, 2001, 2002, 2003 Free Software Foundation,
5dnl  Inc.
6
7dnl  This file is part of the GNU MP Library.
8
9dnl  The GNU MP Library is free software; you can redistribute it and/or modify
10dnl  it under the terms of the GNU Lesser General Public License as published
11dnl  by the Free Software Foundation; either version 3 of the License, or (at
12dnl  your option) any later version.
13
14dnl  The GNU MP Library is distributed in the hope that it will be useful, but
15dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
17dnl  License for more details.
18
19dnl  You should have received a copy of the GNU Lesser General Public License
20dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
21
22include(`../config.m4')
23
24C INPUT PARAMETERS
25C res_ptr	r26
26C s_ptr		r25
27C size		r24
28C cnt		r23
29
30ASM_START()
31PROLOGUE(mpn_lshift)
32	sh2add		%r24,%r25,%r25
33	sh2add		%r24,%r26,%r26
34	ldws,mb		-4(0,%r25),%r22
35	subi		32,%r23,%r1
36	mtsar		%r1
37	addib,=		-1,%r24,L(0004)
38	vshd		%r0,%r22,%r28		C compute carry out limb
39	ldws,mb		-4(0,%r25),%r29
40	addib,<=	-5,%r24,L(rest)
41	vshd		%r22,%r29,%r20
42
43LDEF(loop)
44	ldws,mb		-4(0,%r25),%r22
45	stws,mb		%r20,-4(0,%r26)
46	vshd		%r29,%r22,%r20
47	ldws,mb		-4(0,%r25),%r29
48	stws,mb		%r20,-4(0,%r26)
49	vshd		%r22,%r29,%r20
50	ldws,mb		-4(0,%r25),%r22
51	stws,mb		%r20,-4(0,%r26)
52	vshd		%r29,%r22,%r20
53	ldws,mb		-4(0,%r25),%r29
54	stws,mb		%r20,-4(0,%r26)
55	addib,>		-4,%r24,L(loop)
56	vshd		%r22,%r29,%r20
57
58LDEF(rest)
59	addib,=		4,%r24,L(end1)
60	nop
61
62LDEF(eloop)
63	ldws,mb		-4(0,%r25),%r22
64	stws,mb		%r20,-4(0,%r26)
65	addib,<=	-1,%r24,L(end2)
66	vshd		%r29,%r22,%r20
67	ldws,mb		-4(0,%r25),%r29
68	stws,mb		%r20,-4(0,%r26)
69	addib,>		-1,%r24,L(eloop)
70	vshd		%r22,%r29,%r20
71
72LDEF(end1)
73	stws,mb		%r20,-4(0,%r26)
74	vshd		%r29,%r0,%r20
75	bv		0(%r2)
76	stw		%r20,-4(0,%r26)
77
78LDEF(end2)
79	stws,mb		%r20,-4(0,%r26)
80
81LDEF(0004)
82	vshd		%r22,%r0,%r20
83	bv		0(%r2)
84	stw		%r20,-4(0,%r26)
85EPILOGUE()
86