github.com/aergoio/aergo@v1.3.1/libtool/src/gmp-6.1.2/mpn/alpha/invert_limb.asm (about)

     1  dnl  Alpha mpn_invert_limb -- Invert a normalized limb.
     2  
     3  dnl  Copyright 1996, 2000-2003, 2007, 2011, 2013 Free Software Foundation, Inc.
     4  
     5  dnl  This file is part of the GNU MP Library.
     6  dnl
     7  dnl  The GNU MP Library is free software; you can redistribute it and/or modify
     8  dnl  it under the terms of either:
     9  dnl
    10  dnl    * the GNU Lesser General Public License as published by the Free
    11  dnl      Software Foundation; either version 3 of the License, or (at your
    12  dnl      option) any later version.
    13  dnl
    14  dnl  or
    15  dnl
    16  dnl    * the GNU General Public License as published by the Free Software
    17  dnl      Foundation; either version 2 of the License, or (at your option) any
    18  dnl      later version.
    19  dnl
    20  dnl  or both in parallel, as here.
    21  dnl
    22  dnl  The GNU MP Library is distributed in the hope that it will be useful, but
    23  dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    24  dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    25  dnl  for more details.
    26  dnl
    27  dnl  You should have received copies of the GNU General Public License and the
    28  dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
    29  dnl  see https://www.gnu.org/licenses/.
    30  
    31  include(`../config.m4')
    32  
    33  C      cycles/limb
    34  C EV4:     ?
    35  C EV5:   137/140  (with BWX/without BWX)
    36  C EV6:    71/72   (with BWX/without BWX)
    37  
    38  C This was compiler generated, with minimal manual edits.  Surely several
    39  C cycles could be cut with some thought.
    40  
    41  ASM_START()
    42  PROLOGUE(mpn_invert_limb,gp)
    43  	LEA(	r2, approx_tab)
    44  	srl	r16, 54, r1
    45  	srl	r16, 24, r4
    46  	and	r16, 1, r5
    47  	bic	r1, 1, r7
    48  	lda	r4, 1(r4)
    49  	srl	r16, 1, r3
    50  	addq	r7, r2, r1
    51  ifelse(bwx_available_p,1,`
    52  	ldwu	r0, -512(r1)
    53  ',`
    54  	ldq_u	r0, -512(r1)
    55  	extwl	r0, r7, r0
    56  ')
    57  	addq	r3, r5, r3
    58  	mull	r0, r0, r1
    59  	sll	r0, 11, r0
    60  	mulq	r1, r4, r1
    61  	srl	r1, 40, r1
    62  	subq	r0, r1, r0
    63  	lda	r0, -1(r0)
    64  	mulq	r0, r0, r2
    65  	sll	r0, 60, r1
    66  	sll	r0, 13, r0
    67  	mulq	r2, r4, r2
    68  	subq	r1, r2, r1
    69  	srl	r1, 47, r1
    70  	addq	r0, r1, r0
    71  	mulq	r0, r3, r3
    72  	srl	r0, 1, r1
    73  	cmoveq	r5, 0, r1
    74  	subq	r1, r3, r1
    75  	umulh	r1, r0, r3
    76  	sll	r0, 31, r0
    77  	srl	r3, 1, r1
    78  	addq	r0, r1, r0
    79  	mulq	r0, r16, r2
    80  	umulh	r0, r16, r3
    81  	addq	r2, r16, r1
    82  	addq	r3, r16, r16
    83  	cmpult	r1, r2, r1
    84  	addq	r16, r1, r3
    85  	subq	r0, r3, r0
    86  	ret	r31, (r26), 1
    87  EPILOGUE()
    88  DATASTART(approx_tab,8)
    89  forloop(i,256,512-1,dnl
    90  `	.word	eval(0x7fd00/i)
    91  ')dnl
    92  	SIZE(approx_tab, 512)
    93  	TYPE(approx_tab, object)
    94  DATAEND()
    95  ASM_END()