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

     1  dnl  MIPS64 mpn_addmul_1 -- Multiply a limb vector with a single limb and add
     2  dnl  the product to a second limb vector.
     3  
     4  dnl  Copyright 1992, 1994, 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 size		$6
    38  C s2_limb	$7
    39  
    40  ASM_START()
    41  PROLOGUE(mpn_addmul_1)
    42  
    43  C feed-in phase 0
    44  	ld	$8,0($5)
    45  
    46  C feed-in phase 1
    47  	daddiu	$5,$5,8
    48  	dmultu	$8,$7
    49  
    50  	daddiu	$6,$6,-1
    51  	beq	$6,$0,$LC0
    52  	 move	$2,$0		C zero cy2
    53  
    54  	daddiu	$6,$6,-1
    55  	beq	$6,$0,$LC1
    56  	ld	$8,0($5)	C load new s1 limb as early as possible
    57  
    58  Loop:	ld	$10,0($4)
    59  	mflo	$3
    60  	mfhi	$9
    61  	daddiu	$5,$5,8
    62  	daddu	$3,$3,$2	C add old carry limb to low product limb
    63  	dmultu	$8,$7
    64  	ld	$8,0($5)	C load new s1 limb as early as possible
    65  	daddiu	$6,$6,-1	C decrement loop counter
    66  	sltu	$2,$3,$2	C carry from previous addition -> $2
    67  	daddu	$3,$10,$3
    68  	sltu	$10,$3,$10
    69  	daddu	$2,$2,$10
    70  	sd	$3,0($4)
    71  	daddiu	$4,$4,8
    72  	bne	$6,$0,Loop
    73  	 daddu	$2,$9,$2	C add high product limb and carry from addition
    74  
    75  C wind-down phase 1
    76  $LC1:	ld	$10,0($4)
    77  	mflo	$3
    78  	mfhi	$9
    79  	daddu	$3,$3,$2
    80  	sltu	$2,$3,$2
    81  	dmultu	$8,$7
    82  	daddu	$3,$10,$3
    83  	sltu	$10,$3,$10
    84  	daddu	$2,$2,$10
    85  	sd	$3,0($4)
    86  	daddiu	$4,$4,8
    87  	daddu	$2,$9,$2	C add high product limb and carry from addition
    88  
    89  C wind-down phase 0
    90  $LC0:	ld	$10,0($4)
    91  	mflo	$3
    92  	mfhi	$9
    93  	daddu	$3,$3,$2
    94  	sltu	$2,$3,$2
    95  	daddu	$3,$10,$3
    96  	sltu	$10,$3,$10
    97  	daddu	$2,$2,$10
    98  	sd	$3,0($4)
    99  	j	$31
   100  	daddu	$2,$9,$2	C add high product limb and carry from addition
   101  EPILOGUE(mpn_addmul_1)