]>
Commit | Line | Data |
---|---|---|
7def3d92 RM |
1 | # Alpha __mpn_add_n -- Add two limb vectors of the same length > 0 and |
2 | # store sum in a third limb vector. | |
3 | ||
d614a753 | 4 | # Copyright (C) 1995-2020 Free Software Foundation, Inc. |
7def3d92 RM |
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 | |
7def3d92 RM |
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 |
7def3d92 RM |
16 | # License for more details. |
17 | ||
f01ec467 | 18 | # You should have received a copy of the GNU Lesser General Public License |
5a82c748 | 19 | # along with the GNU MP Library. If not, see <https://www.gnu.org/licenses/>. |
7def3d92 RM |
20 | |
21 | ||
22 | # INPUT PARAMETERS | |
23 | # res_ptr $16 | |
24 | # s1_ptr $17 | |
25 | # s2_ptr $18 | |
26 | # size $19 | |
27 | ||
28 | .set noreorder | |
29 | .set noat | |
30 | .text | |
31 | .align 3 | |
32 | .globl __mpn_add_n | |
33 | .ent __mpn_add_n | |
34 | __mpn_add_n: | |
35 | .frame $30,0,$26,0 | |
36 | ||
37 | ldq $3,0($17) | |
38 | ldq $4,0($18) | |
39 | ||
40 | subq $19,1,$19 | |
41 | and $19,4-1,$2 # number of limbs in first loop | |
42 | bis $31,$31,$0 | |
43 | beq $2,.L0 # if multiple of 4 limbs, skip first loop | |
44 | ||
45 | subq $19,$2,$19 | |
46 | ||
47 | .Loop0: subq $2,1,$2 | |
48 | ldq $5,8($17) | |
49 | addq $4,$0,$4 | |
50 | ldq $6,8($18) | |
51 | cmpult $4,$0,$1 | |
52 | addq $3,$4,$4 | |
53 | cmpult $4,$3,$0 | |
54 | stq $4,0($16) | |
55 | or $0,$1,$0 | |
56 | ||
57 | addq $17,8,$17 | |
58 | addq $18,8,$18 | |
59 | bis $5,$5,$3 | |
60 | bis $6,$6,$4 | |
61 | addq $16,8,$16 | |
62 | bne $2,.Loop0 | |
63 | ||
64 | .L0: beq $19,.Lend | |
65 | ||
66 | .align 3 | |
67 | .Loop: subq $19,4,$19 | |
68 | ||
69 | ldq $5,8($17) | |
70 | addq $4,$0,$4 | |
71 | ldq $6,8($18) | |
72 | cmpult $4,$0,$1 | |
73 | addq $3,$4,$4 | |
74 | cmpult $4,$3,$0 | |
75 | stq $4,0($16) | |
76 | or $0,$1,$0 | |
77 | ||
78 | ldq $3,16($17) | |
79 | addq $6,$0,$6 | |
80 | ldq $4,16($18) | |
81 | cmpult $6,$0,$1 | |
82 | addq $5,$6,$6 | |
83 | cmpult $6,$5,$0 | |
84 | stq $6,8($16) | |
85 | or $0,$1,$0 | |
86 | ||
87 | ldq $5,24($17) | |
88 | addq $4,$0,$4 | |
89 | ldq $6,24($18) | |
90 | cmpult $4,$0,$1 | |
91 | addq $3,$4,$4 | |
92 | cmpult $4,$3,$0 | |
93 | stq $4,16($16) | |
94 | or $0,$1,$0 | |
95 | ||
96 | ldq $3,32($17) | |
97 | addq $6,$0,$6 | |
98 | ldq $4,32($18) | |
99 | cmpult $6,$0,$1 | |
100 | addq $5,$6,$6 | |
101 | cmpult $6,$5,$0 | |
102 | stq $6,24($16) | |
103 | or $0,$1,$0 | |
104 | ||
105 | addq $17,32,$17 | |
106 | addq $18,32,$18 | |
107 | addq $16,32,$16 | |
108 | bne $19,.Loop | |
109 | ||
110 | .Lend: addq $4,$0,$4 | |
111 | cmpult $4,$0,$1 | |
112 | addq $3,$4,$4 | |
113 | cmpult $4,$3,$0 | |
114 | stq $4,0($16) | |
115 | or $0,$1,$0 | |
116 | ret $31,($26),1 | |
117 | ||
118 | .end __mpn_add_n |