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

     1  dnl  MIPS32 mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
     2  dnl  store difference in a third limb vector.
     3  
     4  dnl  Copyright 1995, 2000, 2002 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  include(`../config.m4')
    33  
    34  C INPUT PARAMETERS
    35  C res_ptr	$4
    36  C s1_ptr	$5
    37  C s2_ptr	$6
    38  C size		$7
    39  
    40  ASM_START()
    41  PROLOGUE(mpn_sub_n)
    42  	lw	$10,0($5)
    43  	lw	$11,0($6)
    44  
    45  	addiu	$7,$7,-1
    46  	and	$9,$7,4-1	C number of limbs in first loop
    47  	beq	$9,$0,.L0	C if multiple of 4 limbs, skip first loop
    48  	 move	$2,$0
    49  
    50  	subu	$7,$7,$9
    51  
    52  .Loop0:	addiu	$9,$9,-1
    53  	lw	$12,4($5)
    54  	addu	$11,$11,$2
    55  	lw	$13,4($6)
    56  	sltu	$8,$11,$2
    57  	subu	$11,$10,$11
    58  	sltu	$2,$10,$11
    59  	sw	$11,0($4)
    60  	or	$2,$2,$8
    61  
    62  	addiu	$5,$5,4
    63  	addiu	$6,$6,4
    64  	move	$10,$12
    65  	move	$11,$13
    66  	bne	$9,$0,.Loop0
    67  	 addiu	$4,$4,4
    68  
    69  .L0:	beq	$7,$0,.Lend
    70  	 nop
    71  
    72  .Loop:	addiu	$7,$7,-4
    73  
    74  	lw	$12,4($5)
    75  	addu	$11,$11,$2
    76  	lw	$13,4($6)
    77  	sltu	$8,$11,$2
    78  	subu	$11,$10,$11
    79  	sltu	$2,$10,$11
    80  	sw	$11,0($4)
    81  	or	$2,$2,$8
    82  
    83  	lw	$10,8($5)
    84  	addu	$13,$13,$2
    85  	lw	$11,8($6)
    86  	sltu	$8,$13,$2
    87  	subu	$13,$12,$13
    88  	sltu	$2,$12,$13
    89  	sw	$13,4($4)
    90  	or	$2,$2,$8
    91  
    92  	lw	$12,12($5)
    93  	addu	$11,$11,$2
    94  	lw	$13,12($6)
    95  	sltu	$8,$11,$2
    96  	subu	$11,$10,$11
    97  	sltu	$2,$10,$11
    98  	sw	$11,8($4)
    99  	or	$2,$2,$8
   100  
   101  	lw	$10,16($5)
   102  	addu	$13,$13,$2
   103  	lw	$11,16($6)
   104  	sltu	$8,$13,$2
   105  	subu	$13,$12,$13
   106  	sltu	$2,$12,$13
   107  	sw	$13,12($4)
   108  	or	$2,$2,$8
   109  
   110  	addiu	$5,$5,16
   111  	addiu	$6,$6,16
   112  
   113  	bne	$7,$0,.Loop
   114  	 addiu	$4,$4,16
   115  
   116  .Lend:	addu	$11,$11,$2
   117  	sltu	$8,$11,$2
   118  	subu	$11,$10,$11
   119  	sltu	$2,$10,$11
   120  	sw	$11,0($4)
   121  	j	$31
   122  	or	$2,$2,$8
   123  EPILOGUE(mpn_sub_n)