]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/mips/mips64/submul_1.S
Put under LGPL v2.1.
[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 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
26 /* INPUT PARAMETERS
27 * res_ptr $4
28 * s1_ptr $5
29 * size $6
30 * s2_limb $7
31 */
32
33 #ifdef __PIC__
34 .option pic2
35 #endif
36 .text
37 .align 4
38 .globl __mpn_submul_1
39 .ent __mpn_submul_1
40 __mpn_submul_1:
41 .set noreorder
42 #ifdef __PIC__
43 .cpload t9
44 #endif
45 .set nomacro
46
47 # warm up phase 0
48 ld $8,0($5)
49
50 # warm up phase 1
51 daddiu $5,$5,8
52 dmultu $8,$7
53
54 daddiu $6,$6,-1
55 beq $6,$0,$LC0
56 move $2,$0 # zero cy2
57
58 daddiu $6,$6,-1
59 beq $6,$0,$LC1
60 ld $8,0($5) # load new s1 limb as early as possible
61
62 Loop: ld $10,0($4)
63 mflo $3
64 mfhi $9
65 daddiu $5,$5,8
66 daddu $3,$3,$2 # add old carry limb to low product limb
67 dmultu $8,$7
68 ld $8,0($5) # load new s1 limb as early as possible
69 daddiu $6,$6,-1 # decrement loop counter
70 sltu $2,$3,$2 # carry from previous addition -> $2
71 dsubu $3,$10,$3
72 sgtu $10,$3,$10
73 daddu $2,$2,$10
74 sd $3,0($4)
75 daddiu $4,$4,8
76 bne $6,$0,Loop
77 daddu $2,$9,$2 # add high product limb and carry from addition
78
79 # cool down phase 1
80 $LC1: ld $10,0($4)
81 mflo $3
82 mfhi $9
83 daddu $3,$3,$2
84 sltu $2,$3,$2
85 dmultu $8,$7
86 dsubu $3,$10,$3
87 sgtu $10,$3,$10
88 daddu $2,$2,$10
89 sd $3,0($4)
90 daddiu $4,$4,8
91 daddu $2,$9,$2 # add high product limb and carry from addition
92
93 # cool down phase 0
94 $LC0: ld $10,0($4)
95 mflo $3
96 mfhi $9
97 daddu $3,$3,$2
98 sltu $2,$3,$2
99 dsubu $3,$10,$3
100 sgtu $10,$3,$10
101 daddu $2,$2,$10
102 sd $3,0($4)
103 j $31
104 daddu $2,$9,$2 # add high product limb and carry from addition
105
106 .end __mpn_submul_1