]>
Commit | Line | Data |
---|---|---|
a334319f UD |
1 | /* MIPS3 __mpn_mul_1 -- Multiply a limb vector with a single limb and |
2 | * store the product in a second limb vector. | |
3 | * | |
4 | * Copyright (C) 1992, 1994, 1995, 2000, 2002, 2003 | |
5 | * Free Software Foundation, Inc. | |
6 | * | |
7 | * This file is part of the GNU MP Library. | |
8 | * | |
9 | * The GNU MP Library is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU Lesser General Public License as published by | |
11 | * the Free Software Foundation; either version 2.1 of the License, or (at your | |
12 | * option) any later version. | |
13 | * | |
14 | * The GNU MP Library is distributed in the hope that it will be useful, but | |
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public | |
17 | * License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU Lesser General Public License | |
20 | * along with the GNU MP Library; see the file COPYING.LIB. If not, write to | |
21 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, | |
22 | * MA 02111-1307, USA. | |
23 | */ | |
24 | ||
25 | #include <sysdep.h> | |
26 | #include <sys/asm.h> | |
27 | ||
28 | /* INPUT PARAMETERS | |
29 | * res_ptr $4 | |
30 | * s1_ptr $5 | |
31 | * size $6 | |
32 | * s2_limb $7 | |
33 | */ | |
34 | ||
35 | #ifdef __PIC__ | |
36 | .option pic2 | |
37 | #endif | |
38 | .text | |
39 | .align 4 | |
40 | .globl __mpn_mul_1 | |
41 | .ent __mpn_mul_1 | |
42 | __mpn_mul_1: | |
43 | #ifdef __PIC__ | |
44 | SETUP_GP /* ??? unused */ | |
45 | #endif | |
46 | .set noreorder | |
47 | .set nomacro | |
48 | ||
49 | # warm up phase 0 | |
50 | ld $8,0($5) | |
51 | ||
52 | # warm up phase 1 | |
53 | daddiu $5,$5,8 | |
54 | dmultu $8,$7 | |
55 | ||
56 | daddiu $6,$6,-1 | |
57 | beq $6,$0,L(LC0) | |
58 | move $2,$0 # zero cy2 | |
59 | ||
60 | daddiu $6,$6,-1 | |
61 | beq $6,$0,L(LC1) | |
62 | ld $8,0($5) # load new s1 limb as early as possible | |
63 | ||
64 | L(Loop): mflo $10 | |
65 | mfhi $9 | |
66 | daddiu $5,$5,8 | |
67 | daddu $10,$10,$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,$10,$2 # carry from previous addition -> $2 | |
72 | sd $10,0($4) | |
73 | daddiu $4,$4,8 | |
74 | bne $6,$0,L(Loop) | |
75 | daddu $2,$9,$2 # add high product limb and carry from addition | |
76 | ||
77 | # cool down phase 1 | |
78 | L(LC1): mflo $10 | |
79 | mfhi $9 | |
80 | daddu $10,$10,$2 | |
81 | sltu $2,$10,$2 | |
82 | dmultu $8,$7 | |
83 | sd $10,0($4) | |
84 | daddiu $4,$4,8 | |
85 | daddu $2,$9,$2 # add high product limb and carry from addition | |
86 | ||
87 | # cool down phase 0 | |
88 | L(LC0): mflo $10 | |
89 | mfhi $9 | |
90 | daddu $10,$10,$2 | |
91 | sltu $2,$10,$2 | |
92 | sd $10,0($4) | |
93 | j $31 | |
94 | daddu $2,$9,$2 # add high product limb and carry from addition | |
95 | ||
96 | .end __mpn_mul_1 |