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

     1  dnl  MIPS32 mpn_add_n -- Add two limb vectors of the same length > 0 and store
     2  dnl  sum 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_add_n)
    42  
    43  	lw	$10,0($5)
    44  	lw	$11,0($6)
    45  
    46  	addiu	$7,$7,-1
    47  	and	$9,$7,4-1	C number of limbs in first loop
    48  	beq	$9,$0,.L0	C if multiple of 4 limbs, skip first loop
    49  	 move	$2,$0
    50  
    51  	subu	$7,$7,$9
    52  
    53  .Loop0:	addiu	$9,$9,-1
    54  	lw	$12,4($5)
    55  	addu	$11,$11,$2
    56  	lw	$13,4($6)
    57  	sltu	$8,$11,$2
    58  	addu	$11,$10,$11
    59  	sltu	$2,$11,$10
    60  	sw	$11,0($4)
    61  	or	$2,$2,$8
    62  
    63  	addiu	$5,$5,4
    64  	addiu	$6,$6,4
    65  	move	$10,$12
    66  	move	$11,$13
    67  	bne	$9,$0,.Loop0
    68  	 addiu	$4,$4,4
    69  
    70  .L0:	beq	$7,$0,.Lend
    71  	 nop
    72  
    73  .Loop:	addiu	$7,$7,-4
    74  
    75  	lw	$12,4($5)
    76  	addu	$11,$11,$2
    77  	lw	$13,4($6)
    78  	sltu	$8,$11,$2
    79  	addu	$11,$10,$11
    80  	sltu	$2,$11,$10
    81  	sw	$11,0($4)
    82  	or	$2,$2,$8
    83  
    84  	lw	$10,8($5)
    85  	addu	$13,$13,$2
    86  	lw	$11,8($6)
    87  	sltu	$8,$13,$2
    88  	addu	$13,$12,$13
    89  	sltu	$2,$13,$12
    90  	sw	$13,4($4)
    91  	or	$2,$2,$8
    92  
    93  	lw	$12,12($5)
    94  	addu	$11,$11,$2
    95  	lw	$13,12($6)
    96  	sltu	$8,$11,$2
    97  	addu	$11,$10,$11
    98  	sltu	$2,$11,$10
    99  	sw	$11,8($4)
   100  	or	$2,$2,$8
   101  
   102  	lw	$10,16($5)
   103  	addu	$13,$13,$2
   104  	lw	$11,16($6)
   105  	sltu	$8,$13,$2
   106  	addu	$13,$12,$13
   107  	sltu	$2,$13,$12
   108  	sw	$13,12($4)
   109  	or	$2,$2,$8
   110  
   111  	addiu	$5,$5,16
   112  	addiu	$6,$6,16
   113  
   114  	bne	$7,$0,.Loop
   115  	 addiu	$4,$4,16
   116  
   117  .Lend:	addu	$11,$11,$2
   118  	sltu	$8,$11,$2
   119  	addu	$11,$10,$11
   120  	sltu	$2,$11,$10
   121  	sw	$11,0($4)
   122  	j	$31
   123  	or	$2,$2,$8
   124  EPILOGUE(mpn_add_n)