]>
Commit | Line | Data |
---|---|---|
5107cf1d UD |
1 | /* MIPS3 __mpn_add_n -- Add two limb vectors of the same length > 0 and |
2 | * store sum in a third limb vector. | |
3 | * | |
5ac4c397 | 4 | * Copyright (C) 1995, 2000 Free Software Foundation, Inc. |
5107cf1d UD |
5 | * |
6 | * This file is part of the GNU MP Library. | |
7 | * | |
8 | * The GNU MP Library is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU Library General Public License as published by | |
10 | * the Free Software Foundation; either version 2 of the License, or (at your | |
11 | * option) any later version. | |
12 | * | |
13 | * The GNU MP Library is distributed in the hope that it will be useful, but | |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | |
16 | * License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU Library General Public License | |
19 | * along with the GNU MP Library; see the file COPYING.LIB. If not, write to | |
20 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, | |
21 | * MA 02111-1307, USA. | |
22 | */ | |
23 | ||
24 | #include <sysdep.h> | |
25 | ||
26 | /* | |
27 | * INPUT PARAMETERS | |
28 | * res_ptr $4 | |
29 | * s1_ptr $5 | |
30 | * s2_ptr $6 | |
31 | * size $7 | |
32 | */ | |
5ac4c397 | 33 | #ifdef __PIC__ |
5107cf1d UD |
34 | .option pic2 |
35 | #endif | |
36 | .text | |
37 | .align 2 | |
38 | .globl __mpn_add_n | |
39 | .ent __mpn_add_n | |
40 | __mpn_add_n: | |
41 | .set noreorder | |
5ac4c397 | 42 | #ifdef __PIC__ |
5107cf1d UD |
43 | .cpload t9 |
44 | #endif | |
45 | .set nomacro | |
46 | ||
47 | ld $10,0($5) | |
48 | ld $11,0($6) | |
49 | ||
50 | daddiu $7,$7,-1 | |
51 | and $9,$7,4-1 # number of limbs in first loop | |
52 | beq $9,$0,.L0 # if multiple of 4 limbs, skip first loop | |
53 | move $2,$0 | |
54 | ||
55 | dsubu $7,$7,$9 | |
56 | ||
57 | .Loop0: daddiu $9,$9,-1 | |
58 | ld $12,8($5) | |
59 | daddu $11,$11,$2 | |
60 | ld $13,8($6) | |
61 | sltu $8,$11,$2 | |
62 | daddu $11,$10,$11 | |
63 | sltu $2,$11,$10 | |
64 | sd $11,0($4) | |
65 | or $2,$2,$8 | |
66 | ||
67 | daddiu $5,$5,8 | |
68 | daddiu $6,$6,8 | |
69 | move $10,$12 | |
70 | move $11,$13 | |
71 | bne $9,$0,.Loop0 | |
72 | daddiu $4,$4,8 | |
73 | ||
74 | .L0: beq $7,$0,.Lend | |
75 | nop | |
76 | ||
77 | .Loop: daddiu $7,$7,-4 | |
78 | ||
79 | ld $12,8($5) | |
80 | daddu $11,$11,$2 | |
81 | ld $13,8($6) | |
82 | sltu $8,$11,$2 | |
83 | daddu $11,$10,$11 | |
84 | sltu $2,$11,$10 | |
85 | sd $11,0($4) | |
86 | or $2,$2,$8 | |
87 | ||
88 | ld $10,16($5) | |
89 | daddu $13,$13,$2 | |
90 | ld $11,16($6) | |
91 | sltu $8,$13,$2 | |
92 | daddu $13,$12,$13 | |
93 | sltu $2,$13,$12 | |
94 | sd $13,8($4) | |
95 | or $2,$2,$8 | |
96 | ||
97 | ld $12,24($5) | |
98 | daddu $11,$11,$2 | |
99 | ld $13,24($6) | |
100 | sltu $8,$11,$2 | |
101 | daddu $11,$10,$11 | |
102 | sltu $2,$11,$10 | |
103 | sd $11,16($4) | |
104 | or $2,$2,$8 | |
105 | ||
106 | ld $10,32($5) | |
107 | daddu $13,$13,$2 | |
108 | ld $11,32($6) | |
109 | sltu $8,$13,$2 | |
110 | daddu $13,$12,$13 | |
111 | sltu $2,$13,$12 | |
112 | sd $13,24($4) | |
113 | or $2,$2,$8 | |
114 | ||
115 | daddiu $5,$5,32 | |
116 | daddiu $6,$6,32 | |
117 | ||
118 | bne $7,$0,.Loop | |
119 | daddiu $4,$4,32 | |
120 | ||
121 | .Lend: daddu $11,$11,$2 | |
122 | sltu $8,$11,$2 | |
123 | daddu $11,$10,$11 | |
124 | sltu $2,$11,$10 | |
125 | sd $11,0($4) | |
126 | j $31 | |
127 | or $2,$2,$8 | |
128 | ||
129 | .end __mpn_add_n |