github.com/aergoio/aergo@v1.3.1/libtool/src/gmp-6.1.2/mpn/sparc64/ultrasparct3/bdiv_dbm1c.asm (about)

     1  dnl  SPARC T3/T4/T5 mpn_bdiv_dbm1c.
     2  
     3  dnl  Contributed to the GNU project by Torbjörn 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  include(`../config.m4')
    34  
    35  C                  cycles/limb
    36  C UltraSPARC T3:	25
    37  C UltraSPARC T4/T5:	 4
    38  
    39  C INPUT PARAMETERS
    40  define(`qp',  `%i0')
    41  define(`ap',  `%i1')
    42  define(`n',   `%i2')
    43  define(`bd',  `%i3')
    44  define(`h',   `%i4')
    45  
    46  define(`plo0',`%g4')  define(`plo1',`%g5')
    47  define(`phi0',`%l0')  define(`phi1',`%l1')
    48  define(`a0',  `%g1')  define(`a1',  `%g3')
    49  
    50  ASM_START()
    51  	REGISTER(%g2,#scratch)
    52  	REGISTER(%g3,#scratch)
    53  PROLOGUE(mpn_bdiv_dbm1c)
    54  	save	%sp, -176, %sp
    55  
    56  	and	n, 3, %g5
    57  	ldx	[ap + 0], %g2
    58  	add	n, -5, n
    59  	brz	%g5, L(b0)
    60  	 cmp	%g5, 2
    61  	bcs	%xcc, L(b1)
    62  	 nop
    63  	be	%xcc, L(b2)
    64  	 nop
    65  
    66  L(b3):	ldx	[ap + 8], a0
    67  	mulx	bd, %g2, plo1
    68  	umulxhi(bd, %g2, phi1)
    69  	ldx	[ap + 16], a1
    70  	add	qp, -24, qp
    71  	b	L(lo3)
    72  	 add	ap, -8, ap
    73  
    74  L(b2):	ldx	[ap + 8], a1
    75  	mulx	bd, %g2, plo0
    76  	umulxhi(bd, %g2, phi0)
    77  	brlz,pt n, L(wd2)
    78  	 nop
    79  L(gt2):	ldx	[ap + 16], a0
    80  	add	ap, 16, ap
    81  	b	L(lo2)
    82  	 add	n, -1, n
    83  
    84  L(b1):	mulx	bd, %g2, plo1
    85  	 umulxhi(bd, %g2, phi1)
    86  	brlz,pn	n, L(wd1)
    87  	 add	qp, -8, qp
    88  L(gt1):	ldx	[ap + 8], a0
    89  	ldx	[ap + 16], a1
    90  	b	L(lo1)
    91  	 add	ap, 8, ap
    92  
    93  L(b0):	ldx	[ap + 8], a1
    94  	mulx	bd, %g2, plo0
    95  	umulxhi(bd, %g2, phi0)
    96  	ldx	[ap + 16], a0
    97  	b	L(lo0)
    98  	 add	qp, -16, qp
    99  
   100  L(top):	ldx	[ap + 0], a0
   101  	sub	h, phi1, h
   102  L(lo2):	mulx	bd, a1, plo1
   103  	umulxhi(bd, a1, phi1)
   104  	subcc	h, plo0, h
   105  	addxc(	phi0, %g0, phi0)
   106  	stx	h, [qp + 0]
   107  	ldx	[ap + 8], a1
   108  	sub	h, phi0, h
   109  L(lo1):	mulx	bd, a0, plo0
   110  	umulxhi(bd, a0, phi0)
   111  	subcc	h, plo1, h
   112  	addxc(	phi1, %g0, phi1)
   113  	stx	h, [qp + 8]
   114  	ldx	[ap + 16], a0
   115  	sub	h, phi1, h
   116  L(lo0):	mulx	bd, a1, plo1
   117  	umulxhi(bd, a1, phi1)
   118  	subcc	h, plo0, h
   119  	addxc(	phi0, %g0, phi0)
   120  	stx	h, [qp + 16]
   121  	ldx	[ap + 24], a1
   122  	sub	h, phi0, h
   123  L(lo3):	mulx	bd, a0, plo0
   124  	umulxhi(bd, a0, phi0)
   125  	subcc	h, plo1, h
   126  	addxc(	phi1, %g0, phi1)
   127  	stx	h, [qp + 24]
   128  	add	ap, 32, ap
   129  	add	qp, 32, qp
   130  	brgz,pt	n, L(top)
   131  	 add	n, -4, n
   132  
   133  L(end):	sub	h, phi1, h
   134  L(wd2):	mulx	bd, a1, plo1
   135  	umulxhi(bd, a1, phi1)
   136  	subcc	h, plo0, h
   137  	addxc(	phi0, %g0, phi0)
   138  	stx	h, [qp + 0]
   139  	sub	h, phi0, h
   140  L(wd1):	subcc	h, plo1, h
   141  	addxc(	phi1, %g0, phi1)
   142  	stx	h, [qp + 8]
   143  	sub	h, phi1, %i0
   144  
   145  	ret
   146  	 restore
   147  EPILOGUE()