Reorganisation of the source tree
[ghc-hetmet.git] / rts / gmp / mpn / i960 / add_n.s
1 # I960 __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) 1995, 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 .text
24         .align 4
25         .globl ___gmpn_add_n
26 ___gmpn_add_n:
27         mov     0,g6            # clear carry-save register
28         cmpo    1,0             # clear cy
29
30 Loop:   subo    1,g3,g3         # update loop counter
31         ld      (g1),g5         # load from s1_ptr
32         addo    4,g1,g1         # s1_ptr++
33         ld      (g2),g4         # load from s2_ptr
34         addo    4,g2,g2         # s2_ptr++
35         cmpo    g6,1            # restore cy from g6, relies on cy being 0
36         addc    g4,g5,g4        # main add
37         subc    0,0,g6          # save cy in g6
38         st      g4,(g0)         # store result to res_ptr
39         addo    4,g0,g0         # res_ptr++
40         cmpobne 0,g3,Loop       # when branch is taken, clears C bit
41
42         mov     g6,g0
43         ret