Home | History | Annotate | Line # | Download | only in thumb
      1      1.1  mrg dnl  ARM/Thumb mpn_add_n.
      2      1.1  mrg 
      3      1.1  mrg dnl  Copyright 1997, 2000, 2012 Free Software Foundation, Inc.
      4      1.1  mrg 
      5      1.1  mrg dnl  This file is part of the GNU MP Library.
      6  1.1.1.2  mrg dnl
      7      1.1  mrg dnl  The GNU MP Library is free software; you can redistribute it and/or modify
      8  1.1.1.2  mrg dnl  it under the terms of either:
      9  1.1.1.2  mrg dnl
     10  1.1.1.2  mrg dnl    * the GNU Lesser General Public License as published by the Free
     11  1.1.1.2  mrg dnl      Software Foundation; either version 3 of the License, or (at your
     12  1.1.1.2  mrg dnl      option) any later version.
     13  1.1.1.2  mrg dnl
     14  1.1.1.2  mrg dnl  or
     15  1.1.1.2  mrg dnl
     16  1.1.1.2  mrg dnl    * the GNU General Public License as published by the Free Software
     17  1.1.1.2  mrg dnl      Foundation; either version 2 of the License, or (at your option) any
     18  1.1.1.2  mrg dnl      later version.
     19  1.1.1.2  mrg dnl
     20  1.1.1.2  mrg dnl  or both in parallel, as here.
     21  1.1.1.2  mrg dnl
     22      1.1  mrg dnl  The GNU MP Library is distributed in the hope that it will be useful, but
     23      1.1  mrg dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     24  1.1.1.2  mrg dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     25  1.1.1.2  mrg dnl  for more details.
     26  1.1.1.2  mrg dnl
     27  1.1.1.2  mrg dnl  You should have received copies of the GNU General Public License and the
     28  1.1.1.2  mrg dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
     29  1.1.1.2  mrg dnl  see https://www.gnu.org/licenses/.
     30      1.1  mrg 
     31      1.1  mrg include(`../config.m4')
     32      1.1  mrg 
     33      1.1  mrg C INPUT PARAMETERS
     34      1.1  mrg define(`rp',	r0)
     35      1.1  mrg define(`up',	r1)
     36      1.1  mrg define(`vp',	r2)
     37      1.1  mrg define(`n',	r3)
     38      1.1  mrg 
     39      1.1  mrg ASM_START()
     40      1.1  mrg 	.thumb
     41      1.1  mrg PROLOGUE(mpn_add_nc)
     42      1.1  mrg 	push	{r4, r5, r6}
     43      1.1  mrg 	ldr	r6, [sp, #12]		C init carry save register
     44      1.1  mrg 	sub	r6, #1
     45      1.1  mrg 	b	L(top)
     46      1.1  mrg EPILOGUE()
     47      1.1  mrg PROLOGUE(mpn_add_n)
     48      1.1  mrg 	push	{r4, r5, r6}
     49      1.1  mrg 	neg	r6, n			C init carry save register
     50      1.1  mrg 
     51      1.1  mrg L(top):	ldmia	up!, {r4}		C load next limb from S1
     52      1.1  mrg 	cmp	n, r6			C tricky carry restore
     53      1.1  mrg 	ldmia	vp!, {r5}		C load next limb from S2
     54      1.1  mrg 	adc	r4, r5
     55      1.1  mrg 	stmia	rp!, {r4}		C store result limb to RES
     56      1.1  mrg 	sbc	r6, r6			C save negated carry
     57      1.1  mrg 	sub	n, #1
     58      1.1  mrg 	bne	L(top)
     59      1.1  mrg 
     60      1.1  mrg 	add	r0, r6, #1
     61      1.1  mrg 	pop	{r4, r5, r6}
     62      1.1  mrg 	bx	lr
     63      1.1  mrg EPILOGUE()
     64