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

     1  dnl  MIPS64 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, 2011 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_nc)
    42  	ld	$10,0($5)
    43  	ld	$11,0($6)
    44  
    45  	daddiu	$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,$8
    49  	b	.Loop0
    50  	 dsubu	$7,$7,$9
    51  EPILOGUE()
    52  PROLOGUE(mpn_add_n)
    53  	ld	$10,0($5)
    54  	ld	$11,0($6)
    55  
    56  	daddiu	$7,$7,-1
    57  	and	$9,$7,4-1	C number of limbs in first loop
    58  	beq	$9,$0,.L0	C if multiple of 4 limbs, skip first loop
    59  	 move	$2,$0
    60  
    61  	dsubu	$7,$7,$9
    62  
    63  .Loop0:	daddiu	$9,$9,-1
    64  	ld	$12,8($5)
    65  	daddu	$11,$11,$2
    66  	ld	$13,8($6)
    67  	sltu	$8,$11,$2
    68  	daddu	$11,$10,$11
    69  	sltu	$2,$11,$10
    70  	sd	$11,0($4)
    71  	or	$2,$2,$8
    72  
    73  	daddiu	$5,$5,8
    74  	daddiu	$6,$6,8
    75  	move	$10,$12
    76  	move	$11,$13
    77  	bne	$9,$0,.Loop0
    78  	 daddiu	$4,$4,8
    79  
    80  .L0:	beq	$7,$0,.Lend
    81  	 nop
    82  
    83  .Loop:	daddiu	$7,$7,-4
    84  
    85  	ld	$12,8($5)
    86  	daddu	$11,$11,$10
    87  	ld	$13,8($6)
    88  	sltu	$8,$11,$10
    89  	daddu	$11,$11,$2
    90  	sltu	$2,$11,$2
    91  	sd	$11,0($4)
    92  	or	$2,$2,$8
    93  
    94  	ld	$10,16($5)
    95  	daddu	$13,$13,$12
    96  	ld	$11,16($6)
    97  	sltu	$8,$13,$12
    98  	daddu	$13,$13,$2
    99  	sltu	$2,$13,$2
   100  	sd	$13,8($4)
   101  	or	$2,$2,$8
   102  
   103  	ld	$12,24($5)
   104  	daddu	$11,$11,$10
   105  	ld	$13,24($6)
   106  	sltu	$8,$11,$10
   107  	daddu	$11,$11,$2
   108  	sltu	$2,$11,$2
   109  	sd	$11,16($4)
   110  	or	$2,$2,$8
   111  
   112  	ld	$10,32($5)
   113  	daddu	$13,$13,$12
   114  	ld	$11,32($6)
   115  	sltu	$8,$13,$12
   116  	daddu	$13,$13,$2
   117  	sltu	$2,$13,$2
   118  	sd	$13,24($4)
   119  	or	$2,$2,$8
   120  
   121  	daddiu	$5,$5,32
   122  	daddiu	$6,$6,32
   123  
   124  	bne	$7,$0,.Loop
   125  	 daddiu	$4,$4,32
   126  
   127  .Lend:	daddu	$11,$11,$2
   128  	sltu	$8,$11,$2
   129  	daddu	$11,$10,$11
   130  	sltu	$2,$11,$10
   131  	sd	$11,0($4)
   132  	j	$31
   133  	or	$2,$2,$8
   134  EPILOGUE()