]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/mips/sub_n.S
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / mips / sub_n.S
1 /* MIPS2 __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
2 store difference in a third limb vector.
3
4 Copyright (C) 1995-2016 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. If not, see
20 <http://www.gnu.org/licenses/>. */
21
22 #include <sysdep.h>
23
24 /* INPUT PARAMETERS
25 res_ptr $4
26 s1_ptr $5
27 s2_ptr $6
28 size $7
29 */
30 #ifdef __PIC__
31 .option pic2
32 #endif
33 ENTRY (__mpn_sub_n)
34 .set noreorder
35 #ifdef __PIC__
36 .cpload t9
37 #endif
38 .set nomacro
39
40 lw $10,0($5)
41 lw $11,0($6)
42
43 addiu $7,$7,-1
44 and $9,$7,4-1 /* number of limbs in first loop */
45 beq $9,$0,L(L0) /* if multiple of 4 limbs, skip first loop */
46 move $2,$0
47
48 subu $7,$7,$9
49
50 L(Loop0): addiu $9,$9,-1
51 lw $12,4($5)
52 addu $11,$11,$2
53 lw $13,4($6)
54 sltu $8,$11,$2
55 subu $11,$10,$11
56 sltu $2,$10,$11
57 sw $11,0($4)
58 or $2,$2,$8
59
60 addiu $5,$5,4
61 addiu $6,$6,4
62 move $10,$12
63 move $11,$13
64 bne $9,$0,L(Loop0)
65 addiu $4,$4,4
66
67 L(L0): beq $7,$0,L(Lend)
68 nop
69
70 L(Loop): addiu $7,$7,-4
71
72 lw $12,4($5)
73 addu $11,$11,$2
74 lw $13,4($6)
75 sltu $8,$11,$2
76 subu $11,$10,$11
77 sltu $2,$10,$11
78 sw $11,0($4)
79 or $2,$2,$8
80
81 lw $10,8($5)
82 addu $13,$13,$2
83 lw $11,8($6)
84 sltu $8,$13,$2
85 subu $13,$12,$13
86 sltu $2,$12,$13
87 sw $13,4($4)
88 or $2,$2,$8
89
90 lw $12,12($5)
91 addu $11,$11,$2
92 lw $13,12($6)
93 sltu $8,$11,$2
94 subu $11,$10,$11
95 sltu $2,$10,$11
96 sw $11,8($4)
97 or $2,$2,$8
98
99 lw $10,16($5)
100 addu $13,$13,$2
101 lw $11,16($6)
102 sltu $8,$13,$2
103 subu $13,$12,$13
104 sltu $2,$12,$13
105 sw $13,12($4)
106 or $2,$2,$8
107
108 addiu $5,$5,16
109 addiu $6,$6,16
110
111 bne $7,$0,L(Loop)
112 addiu $4,$4,16
113
114 L(Lend): addu $11,$11,$2
115 sltu $8,$11,$2
116 subu $11,$10,$11
117 sltu $2,$10,$11
118 sw $11,0($4)
119 j $31
120 or $2,$2,$8
121 END (__mpn_sub_n)