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