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

     1  dnl  SPARC mpn_submul_1 -- Multiply a limb vector with a limb and subtract
     2  dnl  the result from 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_submul_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  	subcc	%o5,%g1,%g1
    60  	ld	[%o1+%o2],%o5
    61  	addx	%o0,%g0,%o0
    62  	st	%g1,[%o4+%o2]
    63  L(0):	wr	%g0,%o3,%y
    64  	sra	%o5,31,%g2
    65  	and	%o3,%g2,%g2
    66  	andcc	%g1,0,%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,%o5,%g1
    77  	mulscc	%g1,%o5,%g1
    78  	mulscc	%g1,%o5,%g1
    79  	mulscc	%g1,0,%g1
    80  	sra	%g1,20,%g4
    81  	sll	%g1,12,%g1
    82  	rd	%y,%g3
    83  	srl	%g3,20,%g3
    84  	or	%g1,%g3,%g1
    85  
    86  	addcc	%g1,%o0,%g1
    87  	addx	%g2,%g4,%o0	C add sign-compensation and cy to hi limb
    88  	addcc	%o2,4,%o2	C loop counter
    89  	bne	L(loop0)
    90  	 ld	[%o4+%o2],%o5
    91  
    92  	subcc	%o5,%g1,%g1
    93  	addx	%o0,%g0,%o0
    94  	retl
    95  	st	%g1,[%o4+%o2]
    96  
    97  L(large):
    98  	ld	[%o1+%o2],%o5
    99  	mov	0,%o0
   100  	sra	%o3,31,%g4	C g4 = mask of ones iff S2_LIMB < 0
   101  	b	L(1)
   102  	 add	%o4,-4,%o4
   103  L(loop):
   104  	subcc	%o5,%g3,%g3
   105  	ld	[%o1+%o2],%o5
   106  	addx	%o0,%g0,%o0
   107  	st	%g3,[%o4+%o2]
   108  L(1):	wr	%g0,%o5,%y
   109  	and	%o5,%g4,%g2
   110  	andcc	%g0,%g0,%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,%o3,%g1
   137  	mulscc	%g1,%o3,%g1
   138  	mulscc	%g1,%o3,%g1
   139  	mulscc	%g1,%o3,%g1
   140  	mulscc	%g1,%o3,%g1
   141  	mulscc	%g1,%o3,%g1
   142  	mulscc	%g1,%o3,%g1
   143  	mulscc	%g1,%g0,%g1
   144  	rd	%y,%g3
   145  	addcc	%g3,%o0,%g3
   146  	addx	%g2,%g1,%o0
   147  	addcc	%o2,4,%o2
   148  	bne	L(loop)
   149  	 ld	[%o4+%o2],%o5
   150  
   151  	subcc	%o5,%g3,%g3
   152  	addx	%o0,%g0,%o0
   153  	retl
   154  	st	%g3,[%o4+%o2]
   155  EPILOGUE(mpn_submul_1)