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

     1  dnl  PowerPC-32 mpn_sublsh1_n -- rp[] = up[] - (vp[] << 1)
     2  
     3  dnl  Copyright 2003, 2005, 2007 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 603e:            ?
    35  C 604e:            4.0
    36  C 75x (G3):        5.0
    37  C 7400,7410 (G4):  5.0
    38  C 744x,745x (G4+): 5.0
    39  C power4/ppc970:   4.25
    40  C power5:          5.0
    41  
    42  C INPUT PARAMETERS
    43  C rp	r3
    44  C up	r4
    45  C vp	r5
    46  C n	r6
    47  
    48  define(`rp',`r3')
    49  define(`up',`r4')
    50  define(`vp',`r5')
    51  
    52  define(`s0',`r6')
    53  define(`s1',`r7')
    54  define(`u0',`r8')
    55  define(`v0',`r10')
    56  define(`v1',`r11')
    57  
    58  ASM_START()
    59  PROLOGUE(mpn_sublsh1_n)
    60  	mtctr	r6		C copy n in ctr
    61  
    62  	lwz	v0, 0(vp)	C load v limb
    63  	lwz	u0, 0(up)	C load u limb
    64  	addic	up, up, -4	C update up; set cy
    65  	addi	rp, rp, -4	C update rp
    66  	slwi	s1, v0, 1
    67  	bdz	L(end)		C If done, skip loop
    68  
    69  L(loop):
    70  	lwz	v1, 4(vp)	C load v limb
    71  	subfe	s1, s1, u0	C add limbs with cy, set cy
    72  	srwi	s0, v0, 31	C shift down previous v limb
    73  	stw	s1, 4(rp)	C store result limb
    74  	lwzu	u0, 8(up)	C load u limb and update up
    75  	rlwimi	s0, v1, 1, 0,30	C left shift v limb and merge with prev v limb
    76  
    77  	bdz	L(exit)		C decrement ctr and exit if done
    78  
    79  	lwzu	v0, 8(vp)	C load v limb and update vp
    80  	subfe	s0, s0, u0	C add limbs with cy, set cy
    81  	srwi	s1, v1, 31	C shift down previous v limb
    82  	stwu	s0, 8(rp)	C store result limb and update rp
    83  	lwz	u0, 4(up)	C load u limb
    84  	rlwimi	s1, v0, 1, 0,30	C left shift v limb and merge with prev v limb
    85  
    86  	bdnz	L(loop)		C decrement ctr and loop back
    87  
    88  L(end):	subfe	r7, s1, u0
    89  	srwi	r4, v0, 31
    90  	stw	r7, 4(rp)	C store last result limb
    91  	subfze	r3, r4
    92  	neg	r3, r3
    93  	blr
    94  L(exit):
    95  	subfe	r7, s0, u0
    96  	srwi	r4, v1, 31
    97  	stw	r7, 8(rp)	C store last result limb
    98  	subfze	r3, r4
    99  	neg	r3, r3
   100  	blr
   101  EPILOGUE()