2006-02-20 Roland McGrath <roland@redhat.com>
[glibc-ports.git] / sysdeps / alpha / add_n.s
blobe0dc2fd0c453b3bccd9e5aeb7da513e917886f11
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 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.
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.
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.
24 # INPUT PARAMETERS
25 # res_ptr $16
26 # s1_ptr $17
27 # s2_ptr $18
28 # size $19
30 .set noreorder
31 .set noat
32 .text
33 .align 3
34 .globl __mpn_add_n
35 .ent __mpn_add_n
36 __mpn_add_n:
37 .frame $30,0,$26,0
39 ldq $3,0($17)
40 ldq $4,0($18)
42 subq $19,1,$19
43 and $19,4-1,$2 # number of limbs in first loop
44 bis $31,$31,$0
45 beq $2,.L0 # if multiple of 4 limbs, skip first loop
47 subq $19,$2,$19
49 .Loop0: subq $2,1,$2
50 ldq $5,8($17)
51 addq $4,$0,$4
52 ldq $6,8($18)
53 cmpult $4,$0,$1
54 addq $3,$4,$4
55 cmpult $4,$3,$0
56 stq $4,0($16)
57 or $0,$1,$0
59 addq $17,8,$17
60 addq $18,8,$18
61 bis $5,$5,$3
62 bis $6,$6,$4
63 addq $16,8,$16
64 bne $2,.Loop0
66 .L0: beq $19,.Lend
68 .align 3
69 .Loop: subq $19,4,$19
71 ldq $5,8($17)
72 addq $4,$0,$4
73 ldq $6,8($18)
74 cmpult $4,$0,$1
75 addq $3,$4,$4
76 cmpult $4,$3,$0
77 stq $4,0($16)
78 or $0,$1,$0
80 ldq $3,16($17)
81 addq $6,$0,$6
82 ldq $4,16($18)
83 cmpult $6,$0,$1
84 addq $5,$6,$6
85 cmpult $6,$5,$0
86 stq $6,8($16)
87 or $0,$1,$0
89 ldq $5,24($17)
90 addq $4,$0,$4
91 ldq $6,24($18)
92 cmpult $4,$0,$1
93 addq $3,$4,$4
94 cmpult $4,$3,$0
95 stq $4,16($16)
96 or $0,$1,$0
98 ldq $3,32($17)
99 addq $6,$0,$6
100 ldq $4,32($18)
101 cmpult $6,$0,$1
102 addq $5,$6,$6
103 cmpult $6,$5,$0
104 stq $6,24($16)
105 or $0,$1,$0
107 addq $17,32,$17
108 addq $18,32,$18
109 addq $16,32,$16
110 bne $19,.Loop
112 .Lend: addq $4,$0,$4
113 cmpult $4,$0,$1
114 addq $3,$4,$4
115 cmpult $4,$3,$0
116 stq $4,0($16)
117 or $0,$1,$0
118 ret $31,($26),1
120 .end __mpn_add_n