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

     1  dnl  HP-PA 1.1 mpn_addmul_1 -- Multiply a limb vector with a limb and add the
     2  dnl  result to a second limb vector.
     3  
     4  dnl  Copyright 1992-1994, 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	r26
    36  C s1_ptr	r25
    37  C size		r24
    38  C s2_limb	r23
    39  
    40  C This runs at 11 cycles/limb on a PA7000.  With the used instructions, it can
    41  C not become faster due to data cache contention after a store.  On the PA7100
    42  C it runs at 10 cycles/limb.
    43  
    44  C There are some ideas described in mul_1.asm that applies to this code too.
    45  
    46  ASM_START()
    47  PROLOGUE(mpn_addmul_1)
    48  C	.callinfo	frame=64,no_calls
    49  
    50  	ldo		64(%r30),%r30
    51  	fldws,ma	4(%r25),%fr5
    52  	stw		%r23,-16(%r30)		C move s2_limb ...
    53  	addib,=		-1,%r24,L(just_one_limb)
    54  	 fldws		-16(%r30),%fr4		C ... into fr4
    55  	add		%r0,%r0,%r0		C clear carry
    56  	xmpyu		%fr4,%fr5,%fr6
    57  	fldws,ma	4(%r25),%fr7
    58  	fstds		%fr6,-16(%r30)
    59  	xmpyu		%fr4,%fr7,%fr8
    60  	ldw		-12(%r30),%r19		C least significant limb in product
    61  	ldw		-16(%r30),%r28
    62  
    63  	fstds		%fr8,-16(%r30)
    64  	addib,=		-1,%r24,L(end)
    65  	 ldw		-12(%r30),%r1
    66  
    67  C Main loop
    68  LDEF(loop)
    69  	ldws		0(%r26),%r29
    70  	fldws,ma	4(%r25),%fr5
    71  	add		%r29,%r19,%r19
    72  	stws,ma		%r19,4(%r26)
    73  	addc		%r28,%r1,%r19
    74  	xmpyu		%fr4,%fr5,%fr6
    75  	ldw		-16(%r30),%r28
    76  	fstds		%fr6,-16(%r30)
    77  	addc		%r0,%r28,%r28
    78  	addib,<>	-1,%r24,L(loop)
    79  	 ldw		-12(%r30),%r1
    80  
    81  LDEF(end)
    82  	ldw		0(%r26),%r29
    83  	add		%r29,%r19,%r19
    84  	stws,ma		%r19,4(%r26)
    85  	addc		%r28,%r1,%r19
    86  	ldw		-16(%r30),%r28
    87  	ldws		0(%r26),%r29
    88  	addc		%r0,%r28,%r28
    89  	add		%r29,%r19,%r19
    90  	stws,ma		%r19,4(%r26)
    91  	addc		%r0,%r28,%r28
    92  	bv		0(%r2)
    93  	 ldo		-64(%r30),%r30
    94  
    95  LDEF(just_one_limb)
    96  	xmpyu		%fr4,%fr5,%fr6
    97  	ldw		0(%r26),%r29
    98  	fstds		%fr6,-16(%r30)
    99  	ldw		-12(%r30),%r1
   100  	ldw		-16(%r30),%r28
   101  	add		%r29,%r1,%r19
   102  	stw		%r19,0(%r26)
   103  	addc		%r0,%r28,%r28
   104  	bv		0(%r2)
   105  	 ldo		-64(%r30),%r30
   106  EPILOGUE()