]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/mips/lshift.S
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / mips / lshift.S
CommitLineData
bcb5cee0
UD
1/* MIPS2 __mpn_lshift --
2
04277e02 3Copyright (C) 1995-2019 Free Software Foundation, Inc.
bcb5cee0
UD
4
5This file is part of the GNU MP Library.
6
7The GNU MP Library is free software; you can redistribute it and/or modify
f01ec467
AJ
8it under the terms of the GNU Lesser General Public License as published by
9the Free Software Foundation; either version 2.1 of the License, or (at your
bcb5cee0
UD
10option) any later version.
11
12The GNU MP Library is distributed in the hope that it will be useful, but
13WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
f01ec467 14or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
bcb5cee0
UD
15License for more details.
16
f01ec467 17You should have received a copy of the GNU Lesser General Public License
ab84e3ff 18along with the GNU MP Library. If not, see
5a82c748 19<https://www.gnu.org/licenses/>. */
bcb5cee0
UD
20
21#include <sysdep.h>
22
23/* INPUT PARAMETERS
24 res_ptr $4
25 src_ptr $5
26 size $6
27 cnt $7
28*/
b5e0b658 29#ifdef __PIC__
bcb5cee0
UD
30 .option pic2
31#endif
32ENTRY (__mpn_lshift)
33 .set noreorder
b5e0b658 34#ifdef __PIC__
bcb5cee0
UD
35 .cpload t9
36#endif
37 .set nomacro
38
39 sll $2,$6,2
40 addu $5,$5,$2 /* make r5 point at end of src */
41 lw $10,-4($5) /* load first limb */
42 subu $13,$0,$7
43 addu $4,$4,$2 /* make r4 point at end of res */
44 addiu $6,$6,-1
45 and $9,$6,4-1 /* number of limbs in first loop */
3e9a9758
RM
46 beq $9,$0,L(L0) /* if multiple of 4 limbs, skip first loop */
47 srl $2,$10,$13 /* compute function result */
bcb5cee0
UD
48
49 subu $6,$6,$9
50
3e9a9758 51L(Loop0): lw $3,-8($5)
bcb5cee0
UD
52 addiu $4,$4,-4
53 addiu $5,$5,-4
54 addiu $9,$9,-1
55 sll $11,$10,$7
56 srl $12,$3,$13
57 move $10,$3
58 or $8,$11,$12
3e9a9758
RM
59 bne $9,$0,L(Loop0)
60 sw $8,0($4)
bcb5cee0 61
3e9a9758
RM
62L(L0): beq $6,$0,L(Lend)
63 nop
bcb5cee0 64
3e9a9758 65L(Loop): lw $3,-8($5)
bcb5cee0
UD
66 addiu $4,$4,-16
67 addiu $6,$6,-4
68 sll $11,$10,$7
69 srl $12,$3,$13
70
71 lw $10,-12($5)
72 sll $14,$3,$7
73 or $8,$11,$12
74 sw $8,12($4)
75 srl $9,$10,$13
76
77 lw $3,-16($5)
78 sll $11,$10,$7
79 or $8,$14,$9
80 sw $8,8($4)
81 srl $12,$3,$13
82
83 lw $10,-20($5)
84 sll $14,$3,$7
85 or $8,$11,$12
86 sw $8,4($4)
87 srl $9,$10,$13
88
89 addiu $5,$5,-16
90 or $8,$14,$9
3e9a9758
RM
91 bgtz $6,L(Loop)
92 sw $8,0($4)
bcb5cee0 93
3e9a9758 94L(Lend): sll $8,$10,$7
bcb5cee0
UD
95 j $31
96 sw $8,-4($4)
2cf8794a 97 END (__mpn_lshift)