]>
Commit | Line | Data |
---|---|---|
a334319f UD |
1 | /* MIPS2 __mpn_add_n -- Add two limb vectors of the same length > 0 and |
2 | store sum in a third limb vector. | |
3 | ||
4 | Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc. | |
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 Lesser General Public License as published by | |
10 | the Free Software Foundation; either version 2.1 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 Lesser General Public | |
16 | License for more details. | |
17 | ||
18 | You should have received a copy of the GNU Lesser 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 | #include <sysdep.h> | |
24 | ||
25 | /* INPUT PARAMETERS | |
26 | res_ptr $4 | |
27 | s1_ptr $5 | |
28 | s2_ptr $6 | |
29 | size $7 | |
30 | */ | |
31 | #ifdef __PIC__ | |
32 | .option pic2 | |
33 | #endif | |
34 | ENTRY (__mpn_add_n) | |
35 | .set noreorder | |
36 | #ifdef __PIC__ | |
37 | .cpload t9 | |
38 | #endif | |
39 | .set nomacro | |
40 | ||
41 | lw $10,0($5) | |
42 | lw $11,0($6) | |
43 | ||
44 | addiu $7,$7,-1 | |
45 | and $9,$7,4-1 /* number of limbs in first loop */ | |
46 | beq $9,$0,L(L0) /* if multiple of 4 limbs, skip first loop */ | |
47 | move $2,$0 | |
48 | ||
49 | subu $7,$7,$9 | |
50 | ||
51 | L(Loop0): addiu $9,$9,-1 | |
52 | lw $12,4($5) | |
53 | addu $11,$11,$2 | |
54 | lw $13,4($6) | |
55 | sltu $8,$11,$2 | |
56 | addu $11,$10,$11 | |
57 | sltu $2,$11,$10 | |
58 | sw $11,0($4) | |
59 | or $2,$2,$8 | |
60 | ||
61 | addiu $5,$5,4 | |
62 | addiu $6,$6,4 | |
63 | move $10,$12 | |
64 | move $11,$13 | |
65 | bne $9,$0,L(Loop0) | |
66 | addiu $4,$4,4 | |
67 | ||
68 | L(L0): beq $7,$0,L(end) | |
69 | nop | |
70 | ||
71 | L(Loop): addiu $7,$7,-4 | |
72 | ||
73 | lw $12,4($5) | |
74 | addu $11,$11,$2 | |
75 | lw $13,4($6) | |
76 | sltu $8,$11,$2 | |
77 | addu $11,$10,$11 | |
78 | sltu $2,$11,$10 | |
79 | sw $11,0($4) | |
80 | or $2,$2,$8 | |
81 | ||
82 | lw $10,8($5) | |
83 | addu $13,$13,$2 | |
84 | lw $11,8($6) | |
85 | sltu $8,$13,$2 | |
86 | addu $13,$12,$13 | |
87 | sltu $2,$13,$12 | |
88 | sw $13,4($4) | |
89 | or $2,$2,$8 | |
90 | ||
91 | lw $12,12($5) | |
92 | addu $11,$11,$2 | |
93 | lw $13,12($6) | |
94 | sltu $8,$11,$2 | |
95 | addu $11,$10,$11 | |
96 | sltu $2,$11,$10 | |
97 | sw $11,8($4) | |
98 | or $2,$2,$8 | |
99 | ||
100 | lw $10,16($5) | |
101 | addu $13,$13,$2 | |
102 | lw $11,16($6) | |
103 | sltu $8,$13,$2 | |
104 | addu $13,$12,$13 | |
105 | sltu $2,$13,$12 | |
106 | sw $13,12($4) | |
107 | or $2,$2,$8 | |
108 | ||
109 | addiu $5,$5,16 | |
110 | addiu $6,$6,16 | |
111 | ||
112 | bne $7,$0,L(Loop) | |
113 | addiu $4,$4,16 | |
114 | ||
115 | L(end): addu $11,$11,$2 | |
116 | sltu $8,$11,$2 | |
117 | addu $11,$10,$11 | |
118 | sltu $2,$11,$10 | |
119 | sw $11,0($4) | |
120 | j $31 | |
121 | or $2,$2,$8 | |
122 | .end __mpn_add_n |