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

     1  dnl  Alpha mpn_mul_1 -- Multiply a limb vector with a limb and store
     2  dnl  the result in 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      cycles/limb
    35  C EV4:     42
    36  C EV5:     18
    37  C EV6:      7
    38  
    39  C  INPUT PARAMETERS
    40  C  rp	r16
    41  C  up	r17
    42  C  n	r18
    43  C  vl	r19
    44  C  cl	r20
    45  
    46  
    47  ASM_START()
    48  PROLOGUE(mpn_mul_1c)
    49  	ldq	r2,0(r17)	C r2 = s1_limb
    50  	lda	r18,-1(r18)	C size--
    51  	mulq	r2,r19,r3	C r3 = prod_low
    52  	umulh	r2,r19,r4	C r4 = prod_high
    53  	beq	r18,$Le1c	C jump if size was == 1
    54  	ldq	r2,8(r17)	C r2 = s1_limb
    55  	lda	r18,-1(r18)	C size--
    56  	addq	r3,r20,r3	C r3 = cy_limb + cl
    57  	stq	r3,0(r16)
    58  	cmpult	r3,r20,r0	C r0 = carry from (cy_limb + cl)
    59  	bne	r18,$Loop	C jump if size was == 2
    60  	br	r31,$Le2
    61  $Le1c:	addq	r3,r20,r3	C r3 = cy_limb + cl
    62  	cmpult	r3,r20,r0	C r0 = carry from (cy_limb + cl)
    63  $Le1:	stq	r3,0(r16)
    64  	addq	r4,r0,r0
    65  	ret	r31,(r26),1
    66  EPILOGUE(mpn_mul_1c)
    67  
    68  PROLOGUE(mpn_mul_1)
    69  	ldq	r2,0(r17)	C r2 = s1_limb
    70  	lda	r18,-1(r18)	C size--
    71  	mulq	r2,r19,r3	C r3 = prod_low
    72  	bic	r31,r31,r0	C clear cy_limb
    73  	umulh	r2,r19,r4	C r4 = prod_high
    74  	beq	r18,$Le1	C jump if size was == 1
    75  	ldq	r2,8(r17)	C r2 = s1_limb
    76  	lda	r18,-1(r18)	C size--
    77  	stq	r3,0(r16)
    78  	beq	r18,$Le2	C jump if size was == 2
    79  
    80  	ALIGN(8)
    81  $Loop:	mulq	r2,r19,r3	C r3 = prod_low
    82  	addq	r4,r0,r0	C cy_limb = cy_limb + 'cy'
    83  	lda	r18,-1(r18)	C size--
    84  	umulh	r2,r19,r4	C r4 = prod_high
    85  	ldq	r2,16(r17)	C r2 = s1_limb
    86  	lda	r17,8(r17)	C s1_ptr++
    87  	addq	r3,r0,r3	C r3 = cy_limb + prod_low
    88  	stq	r3,8(r16)
    89  	cmpult	r3,r0,r0	C r0 = carry from (cy_limb + prod_low)
    90  	lda	r16,8(r16)	C res_ptr++
    91  	bne	r18,$Loop
    92  
    93  $Le2:	mulq	r2,r19,r3	C r3 = prod_low
    94  	addq	r4,r0,r0	C cy_limb = cy_limb + 'cy'
    95  	umulh	r2,r19,r4	C r4 = prod_high
    96  	addq	r3,r0,r3	C r3 = cy_limb + prod_low
    97  	cmpult	r3,r0,r0	C r0 = carry from (cy_limb + prod_low)
    98  	stq	r3,8(r16)
    99  	addq	r4,r0,r0	C cy_limb = prod_high + cy
   100  	ret	r31,(r26),1
   101  EPILOGUE(mpn_mul_1)
   102  ASM_END()