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