]>
Commit | Line | Data |
---|---|---|
a334319f 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 | * | |
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 | ||
24 | #include <sysdep.h> | |
25 | #include <sys/asm.h> | |
26 | ||
27 | /* | |
28 | * INPUT PARAMETERS | |
29 | * res_ptr $4 | |
30 | * s1_ptr $5 | |
31 | * s2_ptr $6 | |
32 | * size $7 | |
33 | */ | |
34 | #ifdef __PIC__ | |
35 | .option pic2 | |
36 | #endif | |
37 | .text | |
38 | .align 2 | |
39 | .globl __mpn_add_n | |
40 | .ent __mpn_add_n | |
41 | __mpn_add_n: | |
42 | #ifdef __PIC__ | |
43 | SETUP_GP /* ??? unused */ | |
44 | #endif | |
45 | .set noreorder | |
46 | .set nomacro | |
47 | ||
48 | ld $10,0($5) | |
49 | ld $11,0($6) | |
50 | ||
51 | daddiu $7,$7,-1 | |
52 | and $9,$7,4-1 # number of limbs in first loop | |
53 | beq $9,$0,L(L0) # if multiple of 4 limbs, skip first loop | |
54 | move $2,$0 | |
55 | ||
56 | dsubu $7,$7,$9 | |
57 | ||
58 | L(Loop0): daddiu $9,$9,-1 | |
59 | ld $12,8($5) | |
60 | daddu $11,$11,$2 | |
61 | ld $13,8($6) | |
62 | sltu $8,$11,$2 | |
63 | daddu $11,$10,$11 | |
64 | sltu $2,$11,$10 | |
65 | sd $11,0($4) | |
66 | or $2,$2,$8 | |
67 | ||
68 | daddiu $5,$5,8 | |
69 | daddiu $6,$6,8 | |
70 | move $10,$12 | |
71 | move $11,$13 | |
72 | bne $9,$0,L(Loop0) | |
73 | daddiu $4,$4,8 | |
74 | ||
75 | L(L0): beq $7,$0,L(Lend) | |
76 | nop | |
77 | ||
78 | L(Loop): daddiu $7,$7,-4 | |
79 | ||
80 | ld $12,8($5) | |
81 | daddu $11,$11,$2 | |
82 | ld $13,8($6) | |
83 | sltu $8,$11,$2 | |
84 | daddu $11,$10,$11 | |
85 | sltu $2,$11,$10 | |
86 | sd $11,0($4) | |
87 | or $2,$2,$8 | |
88 | ||
89 | ld $10,16($5) | |
90 | daddu $13,$13,$2 | |
91 | ld $11,16($6) | |
92 | sltu $8,$13,$2 | |
93 | daddu $13,$12,$13 | |
94 | sltu $2,$13,$12 | |
95 | sd $13,8($4) | |
96 | or $2,$2,$8 | |
97 | ||
98 | ld $12,24($5) | |
99 | daddu $11,$11,$2 | |
100 | ld $13,24($6) | |
101 | sltu $8,$11,$2 | |
102 | daddu $11,$10,$11 | |
103 | sltu $2,$11,$10 | |
104 | sd $11,16($4) | |
105 | or $2,$2,$8 | |
106 | ||
107 | ld $10,32($5) | |
108 | daddu $13,$13,$2 | |
109 | ld $11,32($6) | |
110 | sltu $8,$13,$2 | |
111 | daddu $13,$12,$13 | |
112 | sltu $2,$13,$12 | |
113 | sd $13,24($4) | |
114 | or $2,$2,$8 | |
115 | ||
116 | daddiu $5,$5,32 | |
117 | daddiu $6,$6,32 | |
118 | ||
119 | bne $7,$0,L(Loop) | |
120 | daddiu $4,$4,32 | |
121 | ||
122 | L(Lend): daddu $11,$11,$2 | |
123 | sltu $8,$11,$2 | |
124 | daddu $11,$10,$11 | |
125 | sltu $2,$11,$10 | |
126 | sd $11,0($4) | |
127 | j $31 | |
128 | or $2,$2,$8 | |
129 | ||
130 | .end __mpn_add_n |