Home | History | Annotate | Line # | Download | only in ultrasparct3
      1 dnl  SPARC v9-2011 simulation support.
      2 
      3 dnl  Contributed to the GNU project by Torbjrn Granlund.
      4 
      5 dnl  Copyright 2013 Free Software Foundation, Inc.
      6 
      7 dnl  This file is part of the GNU MP Library.
      8 dnl
      9 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
     10 dnl  it under the terms of either:
     11 dnl
     12 dnl    * the GNU Lesser General Public License as published by the Free
     13 dnl      Software Foundation; either version 3 of the License, or (at your
     14 dnl      option) any later version.
     15 dnl
     16 dnl  or
     17 dnl
     18 dnl    * the GNU General Public License as published by the Free Software
     19 dnl      Foundation; either version 2 of the License, or (at your option) any
     20 dnl      later version.
     21 dnl
     22 dnl  or both in parallel, as here.
     23 dnl
     24 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
     25 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     26 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     27 dnl  for more details.
     28 dnl
     29 dnl  You should have received copies of the GNU General Public License and the
     30 dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
     31 dnl  see https://www.gnu.org/licenses/.
     32 
     33 
     34 dnl Usage addxccc(r1,r2,r3, t1)
     35 dnl  64-bit add with carry-in and carry-out
     36 dnl  FIXME: Register g2 must not be destination
     37 
     38 define(`addxccc',`dnl
     39 	add	%sp, -512, %sp
     40 	stx	%g2, [%sp+2047+256+16]
     41 	mov	0, %g2
     42 	movcs	%xcc, -1, %g2
     43 	addcc	%g2, 1, %g0
     44 	addccc	$1, $2, $3
     45 	ldx	[%sp+2047+256+16], %g2
     46 	sub	%sp, -512, %sp
     47 ')
     48 
     49 
     50 dnl Usage addxc(r1,r2,r3, t1,t2)
     51 dnl  64-bit add with carry-in
     52 
     53 define(`addxc',`dnl
     54 	bcc	%xcc, 1f
     55 	 add	$1, $2, $3
     56 	add	$3, 1, $3
     57 1:
     58 ')
     59 
     60 
     61 dnl Usage umulxhi(r1,r2,r3)
     62 dnl  64-bit multiply returning upper 64 bits
     63 dnl  Calls __gmpn_umulh using a non-standard calling convention
     64 
     65 define(`umulxhi',`dnl
     66 	add	%sp, -512, %sp
     67 	stx	$1, [%sp+2047+256]
     68 	stx	$2, [%sp+2047+256+8]
     69 	stx	%o7, [%sp+2047+256+16]
     70 	call	__gmpn_umulh
     71 	 nop
     72 	ldx	[%sp+2047+256+16], %o7
     73 	ldx	[%sp+2047+256], $3
     74 	sub	%sp, -512, %sp
     75 ')
     76 dnl Usage lzcnt(r1,r2)
     77 dnl  Plain count leading zeros
     78 dnl  Calls __gmpn_lzcnt using a non-standard calling convention
     79 
     80 define(`lzcnt',`dnl
     81 	add	%sp, -512, %sp
     82 	stx	%o7, [%sp+2047+256+16]
     83 	call	__gmpn_lzcnt
     84 	 stx	$1, [%sp+2047+256]
     85 	ldx	[%sp+2047+256+16], %o7
     86 	ldx	[%sp+2047+256], $2
     87 	sub	%sp, -512, %sp
     88 ')
     89