]> sourceware.org Git - glibc.git/blame - sysdeps/mips/rshift.S
elf: handle addition overflow in _dl_find_object_update_1 [BZ #32245]
[glibc.git] / sysdeps / mips / rshift.S
CommitLineData
bcb5cee0
UD
1/* MIPS2 __mpn_rshift --
2
dff8da6b 3Copyright (C) 1995-2024 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_rshift)
33 .set noreorder
b5e0b658 34#ifdef __PIC__
bcb5cee0
UD
35 .cpload t9
36#endif
37 .set nomacro
38
39 lw $10,0($5) /* load first limb */
40 subu $13,$0,$7
41 addiu $6,$6,-1
42 and $9,$6,4-1 /* number of limbs in first loop */
3e9a9758 43 beq $9,$0,L(L0) /* if multiple of 4 limbs, skip first loop*/
bcb5cee0
UD
44 sll $2,$10,$13 /* compute function result */
45
46 subu $6,$6,$9
47
3e9a9758 48L(Loop0): lw $3,4($5)
bcb5cee0
UD
49 addiu $4,$4,4
50 addiu $5,$5,4
51 addiu $9,$9,-1
52 srl $11,$10,$7
53 sll $12,$3,$13
54 move $10,$3
55 or $8,$11,$12
3e9a9758 56 bne $9,$0,L(Loop0)
bcb5cee0
UD
57 sw $8,-4($4)
58
3e9a9758 59L(L0): beq $6,$0,L(Lend)
bcb5cee0
UD
60 nop
61
3e9a9758 62L(Loop): lw $3,4($5)
bcb5cee0
UD
63 addiu $4,$4,16
64 addiu $6,$6,-4
65 srl $11,$10,$7
66 sll $12,$3,$13
67
68 lw $10,8($5)
69 srl $14,$3,$7
70 or $8,$11,$12
71 sw $8,-16($4)
72 sll $9,$10,$13
73
74 lw $3,12($5)
75 srl $11,$10,$7
76 or $8,$14,$9
77 sw $8,-12($4)
78 sll $12,$3,$13
79
80 lw $10,16($5)
81 srl $14,$3,$7
82 or $8,$11,$12
83 sw $8,-8($4)
84 sll $9,$10,$13
85
86 addiu $5,$5,16
87 or $8,$14,$9
3e9a9758 88 bgtz $6,L(Loop)
bcb5cee0
UD
89 sw $8,-4($4)
90
3e9a9758 91L(Lend): srl $8,$10,$7
bcb5cee0
UD
92 j $31
93 sw $8,0($4)
2cf8794a 94 END (__mpn_rshift)
This page took 0.441817 seconds and 6 git commands to generate.