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

     1  dnl  SPARC v9 mpn_hamdist for T3/T4.
     2  
     3  dnl  Contributed to the GNU project by David Miller.
     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:	18
    37  C UltraSPARC T4:	 3.5
    38  
    39  C INPUT PARAMETERS
    40  define(`up',   `%o0')
    41  define(`vp',   `%o1')
    42  define(`n',    `%o2')
    43  define(`pcnt', `%o5')
    44  
    45  ASM_START()
    46  	REGISTER(%g2,#scratch)
    47  	REGISTER(%g3,#scratch)
    48  PROLOGUE(mpn_hamdist)
    49  	subcc	n, 1, n
    50  	be	L(final_one)
    51  	 clr	pcnt
    52  L(top):
    53  	ldx	[up + 0], %g1
    54  	ldx	[vp + 0], %g2
    55  	ldx	[up + 8], %o4
    56  	ldx	[vp + 8], %g3
    57  	sub	n, 2, n
    58  	xor	%g1, %g2, %g1
    59  	add	up, 16, up
    60  	popc	%g1, %g2
    61  	add	vp, 16, vp
    62  	xor	%o4, %g3, %o4
    63  	add	pcnt, %g2, pcnt
    64  	popc	%o4, %g3
    65  	brgz	n, L(top)
    66  	 add	pcnt, %g3, pcnt
    67  	brlz,pt	n, L(done)
    68  	 nop
    69  L(final_one):
    70  	ldx	[up + 0], %g1
    71  	ldx	[vp + 0], %g2
    72  	xor	%g1,%g2, %g1
    73  	popc	%g1, %g2
    74  	add	pcnt, %g2, pcnt
    75  L(done):
    76  	retl
    77  	 mov	pcnt, %o0
    78  EPILOGUE()