1 # Alpha __mpn_add_n -- Add two limb vectors of the same length > 0 and
2 # store sum in a third limb vector.
4 # Copyright (C) 1995 Free Software Foundation, Inc.
6 # This file is part of the GNU MP Library.
8 # The GNU MP Library is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU Library General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or (at your
11 # option) any later version.
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 Library General Public
16 # License for more details.
18 # You should have received a copy of the GNU Library 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,
39 or $31,$31,$25 # clear cy
40 subq $19,4,$19 # decr loop cnt
41 blt $19,.Lend2 # if less than 4 limbs, goto 2nd loop
42 # Start software pipeline for 1st loop
47 addq $17,32,$17 # update s1_ptr
49 addq $0,$4,$20 # 1st main add
51 subq $19,4,$19 # decr loop cnt
53 cmpult $20,$0,$25 # compute cy from last add
55 addq $1,$25,$28 # cy add
56 addq $18,32,$18 # update s2_ptr
57 addq $5,$28,$21 # 2nd main add
58 cmpult $28,$25,$8 # compute cy from last add
59 blt $19,.Lend1 # if less than 4 limbs remain, jump
60 # 1st loop handles groups of 4 limbs in a software pipeline
62 .Loop: cmpult $21,$28,$25 # compute cy from last add
64 or $8,$25,$25 # combine cy from the two adds
66 addq $2,$25,$28 # cy add
68 addq $28,$6,$22 # 3rd main add
70 cmpult $28,$25,$8 # compute cy from last add
71 cmpult $22,$28,$25 # compute cy from last add
73 or $8,$25,$25 # combine cy from the two adds
75 addq $3,$25,$28 # cy add
76 addq $28,$7,$23 # 4th main add
77 cmpult $28,$25,$8 # compute cy from last add
78 cmpult $23,$28,$25 # compute cy from last add
79 addq $17,32,$17 # update s1_ptr
80 or $8,$25,$25 # combine cy from the two adds
81 addq $16,32,$16 # update res_ptr
82 addq $0,$25,$28 # cy add
84 addq $4,$28,$20 # 1st main add
86 cmpult $28,$25,$8 # compute cy from last add
88 cmpult $20,$28,$25 # compute cy from last add
90 or $8,$25,$25 # combine cy from the two adds
91 subq $19,4,$19 # decr loop cnt
93 addq $1,$25,$28 # cy add
95 addq $5,$28,$21 # 2nd main add
96 addq $18,32,$18 # update s2_ptr
97 cmpult $28,$25,$8 # compute cy from last add
99 # Finish software pipeline for 1st loop
100 .Lend1: cmpult $21,$28,$25 # compute cy from last add
101 or $8,$25,$25 # combine cy from the two adds
102 addq $2,$25,$28 # cy add
103 addq $28,$6,$22 # 3rd main add
104 cmpult $28,$25,$8 # compute cy from last add
105 cmpult $22,$28,$25 # compute cy from last add
107 or $8,$25,$25 # combine cy from the two adds
109 addq $3,$25,$28 # cy add
110 addq $28,$7,$23 # 4th main add
111 cmpult $28,$25,$8 # compute cy from last add
112 cmpult $23,$28,$25 # compute cy from last add
113 or $8,$25,$25 # combine cy from the two adds
114 addq $16,32,$16 # update res_ptr
117 .Lend2: addq $19,4,$19 # restore loop cnt
119 # Start software pipeline for 2nd loop
124 # 2nd loop handles remaining 1-3 limbs
126 .Loop0: addq $0,$25,$28 # cy add
128 addq $4,$28,$20 # main add
131 cmpult $28,$25,$8 # compute cy from last add
134 cmpult $20,$28,$25 # compute cy from last add
135 subq $19,1,$19 # decr loop cnt
136 or $8,$25,$25 # combine cy from the two adds
139 .Lend0: addq $0,$25,$28 # cy add
140 addq $4,$28,$20 # main add
141 cmpult $28,$25,$8 # compute cy from last add
142 cmpult $20,$28,$25 # compute cy from last add
144 or $8,$25,$25 # combine cy from the two adds
146 .Lret: or $25,$31,$0 # return cy