~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to gmp3/mpn/thumb/add_n.s

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
@ ARM/Thumb mpn_add_n -- Add two limb vectors of the same length > 0 and store
 
2
@ sum in a third limb vector.
 
3
 
 
4
@ Copyright 1997, 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       r0
 
26
@ S1_ptr        r1
 
27
@ S2_ptr        r2
 
28
@ SIZE          r3
 
29
 
 
30
@ NOT TESTED CODE
 
31
 
 
32
        .text
 
33
        .thumb
 
34
        .align  0
 
35
        .global ___gmpn_add_n
 
36
___gmpn_add_n:
 
37
        push    {r4, r5, r6, lr}
 
38
        mov     r6, #1                  @ init carry save register
 
39
 
 
40
Loop:   sub     r6, #1                  @ restore carry (set iff r6 was 0)
 
41
        ldmia   r1!, {r4}               @ load next limb from S1
 
42
        ldmia   r2!, {r5}               @ load next limb from S2
 
43
        adc     r4, r5
 
44
        stmia   r0!, {r4}               @ store result limb to RES
 
45
        sbc     r6, r6                  @ save negated carry
 
46
        sub     r3, #1
 
47
        bge     Loop                    @ loop back while remaining count >= 4
 
48
 
 
49
        mov     r0, r6
 
50
        pop     {r4, r5, r6, pc}