1dnl  HP-PA 2.0 mpn_lshift -- Left shift.
2
3dnl  Copyright 1997, 2000, 2002, 2003 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
31
32dnl  This runs at 1.5 cycles/limb on PA8000 and 1.0 cycles/limb on PA8500.
33
34include(`../config.m4')
35
36dnl  INPUT PARAMETERS
37define(`rp',`%r26')
38define(`up',`%r25')
39define(`n',`%r24')
40define(`cnt',`%r23')
41
42ifdef(`HAVE_ABI_2_0w',
43`       .level  2.0w
44',`     .level  2.0
45')
46PROLOGUE(mpn_lshift)
47	shladd		n, 3, up, up
48	shladd		n, 3, rp, rp
49	subi		64, cnt, cnt
50	mtsar		cnt
51	ldd		-8(up), %r21
52	addib,=		-1, n, L(end)
53	shrpd		%r0, %r21, %sar, %r29	C compute carry out limb
54	depw,z		n, 31, 3, %r28		C r28 = (size & 7)
55	sub		%r0, n, %r22
56	depw,z		%r22, 28, 3, %r22	C r22 = 8 * (-size & 7)
57	add		up, %r22, up		C offset up
58	blr		%r28, %r0		C branch into jump table
59	add		rp, %r22, rp		C offset rp
60	b		L(0)
61	nop
62	b		L(1)
63	copy		%r21, %r20
64	b		L(2)
65	nop
66	b		L(3)
67	copy		%r21, %r20
68	b		L(4)
69	nop
70	b		L(5)
71	copy		%r21, %r20
72	b		L(6)
73	nop
74	b		L(7)
75	copy		%r21, %r20
76
77LDEF(loop)
78LDEF(0)	ldd		-16(up), %r20
79	shrpd		%r21, %r20, %sar, %r21
80	std		%r21, -8(rp)
81LDEF(7)	ldd		-24(up), %r21
82	shrpd		%r20, %r21, %sar, %r20
83	std		%r20, -16(rp)
84LDEF(6)	ldd		-32(up), %r20
85	shrpd		%r21, %r20, %sar, %r21
86	std		%r21, -24(rp)
87LDEF(5)	ldd		-40(up), %r21
88	shrpd		%r20, %r21, %sar, %r20
89	std		%r20, -32(rp)
90LDEF(4)	ldd		-48(up), %r20
91	shrpd		%r21, %r20, %sar, %r21
92	std		%r21, -40(rp)
93LDEF(3)	ldd		-56(up), %r21
94	shrpd		%r20, %r21, %sar, %r20
95	std		%r20, -48(rp)
96LDEF(2)	ldd		-64(up), %r20
97	shrpd		%r21, %r20, %sar, %r21
98	std		%r21, -56(rp)
99LDEF(1)	ldd		-72(up), %r21
100	ldo		-64(up), up
101	shrpd		%r20, %r21, %sar, %r20
102	std		%r20, -64(rp)
103	addib,>		-8, n, L(loop)
104	ldo		-64(rp), rp
105
106LDEF(end)
107	shrpd		%r21, %r0, %sar, %r21
108	std		%r21, -8(rp)
109	bve		(%r2)
110ifdef(`HAVE_ABI_2_0w',
111`	copy		%r29,%r28
112',`	extrd,u		%r29, 31, 32, %r28
113')
114EPILOGUE(mpn_lshift)
115