Home | History | Annotate | Line # | Download | only in ultrasparct1
add_n.asm revision 1.1.1.1.4.2
      1 dnl  SPARC T1 32-bit mpn_add_n.
      2 
      3 dnl  Copyright 2010 Free Software Foundation, Inc.
      4 
      5 dnl  This file is part of the GNU MP Library.
      6 
      7 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
      8 dnl  it under the terms of the GNU Lesser General Public License as published
      9 dnl  by the Free Software Foundation; either version 3 of the License, or (at
     10 dnl  your option) any later version.
     11 
     12 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
     13 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     14 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
     15 dnl  License for more details.
     16 
     17 dnl  You should have received a copy of the GNU Lesser General Public License
     18 dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
     19 
     20 include(`../config.m4')
     21 
     22 C INPUT PARAMETERS
     23 define(`rp',  %o0)
     24 define(`ap',  %o1)
     25 define(`bp',  %o2)
     26 define(`n',   %o3)
     27 define(`cy',  %o4)
     28 
     29 define(`i',   %o3)
     30 
     31 MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc)
     32 
     33 ASM_START()
     34 PROLOGUE(mpn_add_nc)
     35 	b	L(ent)
     36 	srl	cy, 0, cy	C strip any bogus high bits
     37 EPILOGUE()
     38 
     39 PROLOGUE(mpn_add_n)
     40 	mov	0, cy
     41 L(ent):	srl	n, 0, n		C strip any bogus high bits
     42 	sll	n, 2, n
     43 	add	ap, n, ap
     44 	add	bp, n, bp
     45 	add	rp, n, rp
     46 	neg	n, i
     47 
     48 L(top):	lduw	[ap+i], %g1
     49 	lduw	[bp+i], %g2
     50 	add	%g1, %g2, %g3
     51 	add	%g3, cy, %g3
     52 	stw	%g3, [rp+i]
     53 	add	i, 4, i
     54 	brnz	i, L(top)
     55 	srlx	%g3, 32, cy
     56 
     57 	retl
     58 	mov	cy, %o0		C return value
     59 EPILOGUE()
     60