]>
Commit | Line | Data |
---|---|---|
5107cf1d UD |
1 | /* MIPS3 __mpn_addmul_1 -- Multiply a limb vector with a single limb and |
2 | * add the product to a second limb vector. | |
3 | * | |
d8a5edc2 | 4 | * Copyright (C) 1992, 1994, 1995, 2002, 2003 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 | |
6d84f89a AJ |
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 | |
5107cf1d UD |
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 | |
6d84f89a | 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
5107cf1d UD |
16 | * License for more details. |
17 | * | |
6d84f89a | 18 | * You should have received a copy of the GNU Lesser General Public License |
5107cf1d UD |
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> | |
d8a5edc2 | 25 | #include <sys/asm.h> |
5107cf1d UD |
26 | |
27 | /* INPUT PARAMETERS | |
28 | * res_ptr $4 | |
29 | * s1_ptr $5 | |
30 | * size $6 | |
31 | * s2_limb $7 | |
32 | */ | |
33 | ||
34 | #ifdef PIC | |
35 | .option pic2 | |
36 | #endif | |
37 | .text | |
38 | .align 4 | |
39 | .globl __mpn_addmul_1 | |
40 | .ent __mpn_addmul_1 | |
41 | __mpn_addmul_1: | |
5107cf1d | 42 | #ifdef PIC |
d8a5edc2 | 43 | SETUP_GP /* ??? unused */ |
5107cf1d | 44 | #endif |
d8a5edc2 | 45 | .set noreorder |
5107cf1d UD |
46 | .set nomacro |
47 | ||
48 | # warm up phase 0 | |
49 | ld $8,0($5) | |
50 | ||
51 | # warm up phase 1 | |
52 | daddiu $5,$5,8 | |
53 | dmultu $8,$7 | |
54 | ||
55 | daddiu $6,$6,-1 | |
d8a5edc2 RM |
56 | beq $6,$0,L(LC0) |
57 | move $2,$0 # zero cy2 | |
5107cf1d UD |
58 | |
59 | daddiu $6,$6,-1 | |
d8a5edc2 | 60 | beq $6,$0,L(LC1) |
5107cf1d UD |
61 | ld $8,0($5) # load new s1 limb as early as possible |
62 | ||
d8a5edc2 | 63 | L(Loop): ld $10,0($4) |
5107cf1d UD |
64 | mflo $3 |
65 | mfhi $9 | |
66 | daddiu $5,$5,8 | |
67 | daddu $3,$3,$2 # add old carry limb to low product limb | |
68 | dmultu $8,$7 | |
69 | ld $8,0($5) # load new s1 limb as early as possible | |
70 | daddiu $6,$6,-1 # decrement loop counter | |
71 | sltu $2,$3,$2 # carry from previous addition -> $2 | |
72 | daddu $3,$10,$3 | |
73 | sltu $10,$3,$10 | |
74 | daddu $2,$2,$10 | |
75 | sd $3,0($4) | |
76 | daddiu $4,$4,8 | |
d8a5edc2 RM |
77 | bne $6,$0,L(Loop) |
78 | daddu $2,$9,$2 # add high product limb and carry from addition | |
5107cf1d UD |
79 | |
80 | # cool down phase 1 | |
d8a5edc2 | 81 | L(LC1): ld $10,0($4) |
5107cf1d UD |
82 | mflo $3 |
83 | mfhi $9 | |
84 | daddu $3,$3,$2 | |
85 | sltu $2,$3,$2 | |
86 | dmultu $8,$7 | |
87 | daddu $3,$10,$3 | |
88 | sltu $10,$3,$10 | |
89 | daddu $2,$2,$10 | |
90 | sd $3,0($4) | |
91 | daddiu $4,$4,8 | |
92 | daddu $2,$9,$2 # add high product limb and carry from addition | |
93 | ||
94 | # cool down phase 0 | |
d8a5edc2 | 95 | L(LC0): ld $10,0($4) |
5107cf1d UD |
96 | mflo $3 |
97 | mfhi $9 | |
98 | daddu $3,$3,$2 | |
99 | sltu $2,$3,$2 | |
100 | daddu $3,$10,$3 | |
101 | sltu $10,$3,$10 | |
102 | daddu $2,$2,$10 | |
103 | sd $3,0($4) | |
104 | j $31 | |
105 | daddu $2,$9,$2 # add high product limb and carry from addition | |
106 | ||
107 | .end __mpn_addmul_1 |