]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/mips/mips64/addmul_1.S
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / mips / mips64 / addmul_1.S
CommitLineData
d0c2d3b3
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 *
b168057a 4 * Copyright (C) 1992-2015 Free Software Foundation, Inc.
d0c2d3b3
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
f01ec467
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
d0c2d3b3
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
f01ec467 15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
d0c2d3b3
UD
16 * License for more details.
17 *
f01ec467 18 * You should have received a copy of the GNU Lesser General Public License
ab84e3ff 19 * along with the GNU MP Library. If not, see <http://www.gnu.org/licenses/>.
d0c2d3b3
UD
20 */
21
22#include <sysdep.h>
3e9a9758 23#include <sys/asm.h>
d0c2d3b3
UD
24
25/* INPUT PARAMETERS
26 * res_ptr $4
27 * s1_ptr $5
28 * size $6
29 * s2_limb $7
30 */
31
32#ifdef PIC
33 .option pic2
34#endif
a6ee1783 35ENTRY (__mpn_addmul_1)
d0c2d3b3 36#ifdef PIC
3e9a9758 37 SETUP_GP /* ??? unused */
d0c2d3b3 38#endif
3e9a9758 39 .set noreorder
d0c2d3b3
UD
40 .set nomacro
41
42 # warm up phase 0
43 ld $8,0($5)
44
45 # warm up phase 1
46 daddiu $5,$5,8
8b2800c0 47#if __mips_isa_rev < 6
d0c2d3b3 48 dmultu $8,$7
8b2800c0
SE
49#else
50 dmulu $11,$8,$7
51 dmuhu $12,$8,$7
52#endif
d0c2d3b3
UD
53
54 daddiu $6,$6,-1
3e9a9758
RM
55 beq $6,$0,L(LC0)
56 move $2,$0 # zero cy2
d0c2d3b3
UD
57
58 daddiu $6,$6,-1
3e9a9758 59 beq $6,$0,L(LC1)
d0c2d3b3
UD
60 ld $8,0($5) # load new s1 limb as early as possible
61
3e9a9758 62L(Loop): ld $10,0($4)
8b2800c0 63#if __mips_isa_rev < 6
d0c2d3b3
UD
64 mflo $3
65 mfhi $9
8b2800c0
SE
66#else
67 move $3,$11
68 move $9,$12
69#endif
d0c2d3b3
UD
70 daddiu $5,$5,8
71 daddu $3,$3,$2 # add old carry limb to low product limb
8b2800c0 72#if __mips_isa_rev < 6
d0c2d3b3 73 dmultu $8,$7
8b2800c0
SE
74#else
75 dmulu $11,$8,$7
76 dmuhu $12,$8,$7
77#endif
d0c2d3b3
UD
78 ld $8,0($5) # load new s1 limb as early as possible
79 daddiu $6,$6,-1 # decrement loop counter
80 sltu $2,$3,$2 # carry from previous addition -> $2
81 daddu $3,$10,$3
82 sltu $10,$3,$10
83 daddu $2,$2,$10
84 sd $3,0($4)
85 daddiu $4,$4,8
3e9a9758
RM
86 bne $6,$0,L(Loop)
87 daddu $2,$9,$2 # add high product limb and carry from addition
d0c2d3b3
UD
88
89 # cool down phase 1
3e9a9758 90L(LC1): ld $10,0($4)
8b2800c0 91#if __mips_isa_rev < 6
d0c2d3b3
UD
92 mflo $3
93 mfhi $9
8b2800c0
SE
94#else
95 move $3,$11
96 move $9,$12
97#endif
d0c2d3b3
UD
98 daddu $3,$3,$2
99 sltu $2,$3,$2
8b2800c0 100#if __mips_isa_rev < 6
d0c2d3b3 101 dmultu $8,$7
8b2800c0
SE
102#else
103 dmulu $11,$8,$7
104 dmuhu $12,$8,$7
105#endif
d0c2d3b3
UD
106 daddu $3,$10,$3
107 sltu $10,$3,$10
108 daddu $2,$2,$10
109 sd $3,0($4)
110 daddiu $4,$4,8
111 daddu $2,$9,$2 # add high product limb and carry from addition
112
113 # cool down phase 0
3e9a9758 114L(LC0): ld $10,0($4)
8b2800c0 115#if __mips_isa_rev < 6
d0c2d3b3
UD
116 mflo $3
117 mfhi $9
8b2800c0
SE
118#else
119 move $3,$11
120 move $9,$12
121#endif
d0c2d3b3
UD
122 daddu $3,$3,$2
123 sltu $2,$3,$2
124 daddu $3,$10,$3
125 sltu $10,$3,$10
126 daddu $2,$2,$10
127 sd $3,0($4)
128 j $31
129 daddu $2,$9,$2 # add high product limb and carry from addition
130
a6ee1783 131END (__mpn_addmul_1)