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

     1  dnl  SPARC mpn_lshift -- Shift a number left.
     2  
     3  dnl  Copyright 1995, 1996, 2000 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  
    32  include(`../config.m4')
    33  
    34  C INPUT PARAMETERS
    35  C res_ptr	%o0
    36  C src_ptr	%o1
    37  C size		%o2
    38  C cnt		%o3
    39  
    40  ASM_START()
    41  PROLOGUE(mpn_lshift)
    42  	sll	%o2,2,%g1
    43  	add	%o1,%g1,%o1	C make %o1 point at end of src
    44  	ld	[%o1-4],%g2	C load first limb
    45  	sub	%g0,%o3,%o5	C negate shift count
    46  	add	%o0,%g1,%o0	C make %o0 point at end of res
    47  	add	%o2,-1,%o2
    48  	andcc	%o2,4-1,%g4	C number of limbs in first loop
    49  	srl	%g2,%o5,%g1	C compute function result
    50  	be	L(0)		C if multiple of 4 limbs, skip first loop
    51  	st	%g1,[%sp+80]
    52  
    53  	sub	%o2,%g4,%o2	C adjust count for main loop
    54  
    55  L(loop0):
    56  	ld	[%o1-8],%g3
    57  	add	%o0,-4,%o0
    58  	add	%o1,-4,%o1
    59  	addcc	%g4,-1,%g4
    60  	sll	%g2,%o3,%o4
    61  	srl	%g3,%o5,%g1
    62  	mov	%g3,%g2
    63  	or	%o4,%g1,%o4
    64  	bne	L(loop0)
    65  	 st	%o4,[%o0+0]
    66  
    67  L(0):	tst	%o2
    68  	be	L(end)
    69  	 nop
    70  
    71  L(loop):
    72  	ld	[%o1-8],%g3
    73  	add	%o0,-16,%o0
    74  	addcc	%o2,-4,%o2
    75  	sll	%g2,%o3,%o4
    76  	srl	%g3,%o5,%g1
    77  
    78  	ld	[%o1-12],%g2
    79  	sll	%g3,%o3,%g4
    80  	or	%o4,%g1,%o4
    81  	st	%o4,[%o0+12]
    82  	srl	%g2,%o5,%g1
    83  
    84  	ld	[%o1-16],%g3
    85  	sll	%g2,%o3,%o4
    86  	or	%g4,%g1,%g4
    87  	st	%g4,[%o0+8]
    88  	srl	%g3,%o5,%g1
    89  
    90  	ld	[%o1-20],%g2
    91  	sll	%g3,%o3,%g4
    92  	or	%o4,%g1,%o4
    93  	st	%o4,[%o0+4]
    94  	srl	%g2,%o5,%g1
    95  
    96  	add	%o1,-16,%o1
    97  	or	%g4,%g1,%g4
    98  	bne	L(loop)
    99  	 st	%g4,[%o0+0]
   100  
   101  L(end):	sll	%g2,%o3,%g2
   102  	st	%g2,[%o0-4]
   103  	retl
   104  	ld	[%sp+80],%o0
   105  EPILOGUE(mpn_lshift)