Reorganisation of the source tree
[ghc-hetmet.git] / rts / gmp / mpn / vax / add_n.s
1 # VAX __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
2 # sum in a third limb vector.
3
4 # Copyright (C) 1999, 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 # INPUT PARAMETERS
25 # res_ptr       (sp + 4)
26 # s1_ptr        (sp + 8)
27 # s2_ptr        (sp + 12)
28 # size          (sp + 16)
29
30 .text
31         .align 1
32 .globl ___gmpn_add_n
33 ___gmpn_add_n:
34         .word   0x0
35         movl    16(ap),r0
36         movl    12(ap),r1
37         movl    8(ap),r2
38         movl    4(ap),r3
39         mnegl   r0,r5
40         addl2   $3,r0
41         ashl    $-2,r0,r0       # unroll loop count
42         bicl2   $-4,r5          # mask out low 2 bits
43         movaq   (r5)[r5],r5     # 9x
44         jmp     Loop(r5)
45
46 Loop:   movl    (r2)+,r4
47         adwc    (r1)+,r4
48         movl    r4,(r3)+
49         movl    (r2)+,r4
50         adwc    (r1)+,r4
51         movl    r4,(r3)+
52         movl    (r2)+,r4
53         adwc    (r1)+,r4
54         movl    r4,(r3)+
55         movl    (r2)+,r4
56         adwc    (r1)+,r4
57         movl    r4,(r3)+
58         sobgtr  r0,Loop
59
60         adwc    r0,r0
61         ret