]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/mips/mips64/submul_1.S
Replace FSF snail mail address by URL.
[thirdparty/glibc.git] / sysdeps / mips / mips64 / submul_1.S
1 /* MIPS3 __mpn_submul_1 -- Multiply a limb vector with a single limb and
2 * subtract the product from 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. If not, see
21 * <http://www.gnu.org/licenses/>.
22 */
23
24 #include <sysdep.h>
25 #include <sys/asm.h>
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_submul_1
40 .ent __mpn_submul_1
41 __mpn_submul_1:
42 #ifdef __PIC__
43 SETUP_GP /* ??? unused */
44 #endif
45 .set noreorder
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
56 beq $6,$0,L(LC0)
57 move $2,$0 # zero cy2
58
59 daddiu $6,$6,-1
60 beq $6,$0,L(LC1)
61 ld $8,0($5) # load new s1 limb as early as possible
62
63 L(Loop): ld $10,0($4)
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 dsubu $3,$10,$3
73 sgtu $10,$3,$10
74 daddu $2,$2,$10
75 sd $3,0($4)
76 daddiu $4,$4,8
77 bne $6,$0,L(Loop)
78 daddu $2,$9,$2 # add high product limb and carry from addition
79
80 # cool down phase 1
81 L(LC1): ld $10,0($4)
82 mflo $3
83 mfhi $9
84 daddu $3,$3,$2
85 sltu $2,$3,$2
86 dmultu $8,$7
87 dsubu $3,$10,$3
88 sgtu $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
95 L(LC0): ld $10,0($4)
96 mflo $3
97 mfhi $9
98 daddu $3,$3,$2
99 sltu $2,$3,$2
100 dsubu $3,$10,$3
101 sgtu $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_submul_1