1dnl  MIPS64 mpn_lshift -- Left shift.
2
3dnl  Copyright 1995, 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	$4
24C src_ptr	$5
25C size		$6
26C cnt		$7
27
28ASM_START()
29PROLOGUE(mpn_lshift)
30	dsll	$2,$6,3
31	daddu	$5,$5,$2	C make r5 point at end of src
32	ld	$10,-8($5)	C load first limb
33	dsubu	$13,$0,$7
34	daddu	$4,$4,$2	C make r4 point at end of res
35	daddiu	$6,$6,-1
36	and	$9,$6,4-1	C number of limbs in first loop
37	beq	$9,$0,.L0	C if multiple of 4 limbs, skip first loop
38	 dsrl	$2,$10,$13	C compute function result
39
40	dsubu	$6,$6,$9
41
42.Loop0:	ld	$3,-16($5)
43	daddiu	$4,$4,-8
44	daddiu	$5,$5,-8
45	daddiu	$9,$9,-1
46	dsll	$11,$10,$7
47	dsrl	$12,$3,$13
48	move	$10,$3
49	or	$8,$11,$12
50	bne	$9,$0,.Loop0
51	 sd	$8,0($4)
52
53.L0:	beq	$6,$0,.Lend
54	 nop
55
56.Loop:	ld	$3,-16($5)
57	daddiu	$4,$4,-32
58	daddiu	$6,$6,-4
59	dsll	$11,$10,$7
60	dsrl	$12,$3,$13
61
62	ld	$10,-24($5)
63	dsll	$14,$3,$7
64	or	$8,$11,$12
65	sd	$8,24($4)
66	dsrl	$9,$10,$13
67
68	ld	$3,-32($5)
69	dsll	$11,$10,$7
70	or	$8,$14,$9
71	sd	$8,16($4)
72	dsrl	$12,$3,$13
73
74	ld	$10,-40($5)
75	dsll	$14,$3,$7
76	or	$8,$11,$12
77	sd	$8,8($4)
78	dsrl	$9,$10,$13
79
80	daddiu	$5,$5,-32
81	or	$8,$14,$9
82	bgtz	$6,.Loop
83	 sd	$8,0($4)
84
85.Lend:	dsll	$8,$10,$7
86	j	$31
87	sd	$8,-8($4)
88EPILOGUE(mpn_lshift)
89