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

     1  dnl  SPARC mpn_mul_1 -- Multiply a limb vector with a limb and store
     2  dnl  the result in a second limb vector.
     3  
     4  dnl  Copyright 1992-1994, 2000 Free Software Foundation, Inc.
     5  
     6  dnl  This file is part of the GNU MP Library.
     7  dnl
     8  dnl  The GNU MP Library is free software; you can redistribute it and/or modify
     9  dnl  it under the terms of either:
    10  dnl
    11  dnl    * the GNU Lesser General Public License as published by the Free
    12  dnl      Software Foundation; either version 3 of the License, or (at your
    13  dnl      option) any later version.
    14  dnl
    15  dnl  or
    16  dnl
    17  dnl    * the GNU General Public License as published by the Free Software
    18  dnl      Foundation; either version 2 of the License, or (at your option) any
    19  dnl      later version.
    20  dnl
    21  dnl  or both in parallel, as here.
    22  dnl
    23  dnl  The GNU MP Library is distributed in the hope that it will be useful, but
    24  dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    25  dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    26  dnl  for more details.
    27  dnl
    28  dnl  You should have received copies of the GNU General Public License and the
    29  dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
    30  dnl  see https://www.gnu.org/licenses/.
    31  
    32  
    33  include(`../config.m4')
    34  
    35  C INPUT PARAMETERS
    36  C res_ptr	o0
    37  C s1_ptr	o1
    38  C size		o2
    39  C s2_limb	o3
    40  
    41  ASM_START()
    42  PROLOGUE(mpn_mul_1)
    43  	C Make S1_PTR and RES_PTR point at the end of their blocks
    44  	C and put (- 4 x SIZE) in index/loop counter.
    45  	sll	%o2,2,%o2
    46  	add	%o0,%o2,%o4	C RES_PTR in o4 since o0 is retval
    47  	add	%o1,%o2,%o1
    48  	sub	%g0,%o2,%o2
    49  
    50  	cmp	%o3,0xfff
    51  	bgu	L(large)
    52  	nop
    53  
    54  	ld	[%o1+%o2],%o5
    55  	mov	0,%o0
    56  	b	L(0)
    57  	 add	%o4,-4,%o4
    58  L(loop0):
    59  	st	%g1,[%o4+%o2]
    60  L(0):	wr	%g0,%o3,%y
    61  	sra	%o5,31,%g2
    62  	and	%o3,%g2,%g2
    63  	andcc	%g1,0,%g1
    64  	mulscc	%g1,%o5,%g1
    65  	mulscc	%g1,%o5,%g1
    66  	mulscc	%g1,%o5,%g1
    67  	mulscc	%g1,%o5,%g1
    68  	mulscc	%g1,%o5,%g1
    69  	mulscc	%g1,%o5,%g1
    70  	mulscc	%g1,%o5,%g1
    71  	mulscc	%g1,%o5,%g1
    72  	mulscc	%g1,%o5,%g1
    73  	mulscc	%g1,%o5,%g1
    74  	mulscc	%g1,%o5,%g1
    75  	mulscc	%g1,%o5,%g1
    76  	mulscc	%g1,0,%g1
    77  	sra	%g1,20,%g4
    78  	sll	%g1,12,%g1
    79  	rd	%y,%g3
    80  	srl	%g3,20,%g3
    81  	or	%g1,%g3,%g1
    82  
    83  	addcc	%g1,%o0,%g1
    84  	addx	%g2,%g4,%o0	C add sign-compensation and cy to hi limb
    85  	addcc	%o2,4,%o2	C loop counter
    86  	bne,a	L(loop0)
    87  	 ld	[%o1+%o2],%o5
    88  
    89  	retl
    90  	st	%g1,[%o4+%o2]
    91  
    92  
    93  L(large):
    94  	ld	[%o1+%o2],%o5
    95  	mov	0,%o0
    96  	sra	%o3,31,%g4	C g4 = mask of ones iff S2_LIMB < 0
    97  	b	L(1)
    98  	 add	%o4,-4,%o4
    99  L(loop):
   100  	st	%g3,[%o4+%o2]
   101  L(1):	wr	%g0,%o5,%y
   102  	and	%o5,%g4,%g2	C g2 = S1_LIMB iff S2_LIMB < 0, else 0
   103  	andcc	%g0,%g0,%g1
   104  	mulscc	%g1,%o3,%g1
   105  	mulscc	%g1,%o3,%g1
   106  	mulscc	%g1,%o3,%g1
   107  	mulscc	%g1,%o3,%g1
   108  	mulscc	%g1,%o3,%g1
   109  	mulscc	%g1,%o3,%g1
   110  	mulscc	%g1,%o3,%g1
   111  	mulscc	%g1,%o3,%g1
   112  	mulscc	%g1,%o3,%g1
   113  	mulscc	%g1,%o3,%g1
   114  	mulscc	%g1,%o3,%g1
   115  	mulscc	%g1,%o3,%g1
   116  	mulscc	%g1,%o3,%g1
   117  	mulscc	%g1,%o3,%g1
   118  	mulscc	%g1,%o3,%g1
   119  	mulscc	%g1,%o3,%g1
   120  	mulscc	%g1,%o3,%g1
   121  	mulscc	%g1,%o3,%g1
   122  	mulscc	%g1,%o3,%g1
   123  	mulscc	%g1,%o3,%g1
   124  	mulscc	%g1,%o3,%g1
   125  	mulscc	%g1,%o3,%g1
   126  	mulscc	%g1,%o3,%g1
   127  	mulscc	%g1,%o3,%g1
   128  	mulscc	%g1,%o3,%g1
   129  	mulscc	%g1,%o3,%g1
   130  	mulscc	%g1,%o3,%g1
   131  	mulscc	%g1,%o3,%g1
   132  	mulscc	%g1,%o3,%g1
   133  	mulscc	%g1,%o3,%g1
   134  	mulscc	%g1,%o3,%g1
   135  	mulscc	%g1,%o3,%g1
   136  	mulscc	%g1,%g0,%g1
   137  	rd	%y,%g3
   138  	addcc	%g3,%o0,%g3
   139  	addx	%g2,%g1,%o0	C add sign-compensation and cy to hi limb
   140  	addcc	%o2,4,%o2	C loop counter
   141  	bne,a	L(loop)
   142  	 ld	[%o1+%o2],%o5
   143  
   144  	retl
   145  	st	%g3,[%o4+%o2]
   146  EPILOGUE(mpn_mul_1)