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

     1  dnl  ARM mpn_copyi.
     2  
     3  dnl  Contributed to the GNU project by Robert Harley and Torbjörn Granlund.
     4  
     5  dnl  Copyright 2003, 2012, 2013 Free Software Foundation, Inc.
     6  
     7  dnl  This file is part of the GNU MP Library.
     8  dnl
     9  dnl  The GNU MP Library is free software; you can redistribute it and/or modify
    10  dnl  it under the terms of either:
    11  dnl
    12  dnl    * the GNU Lesser General Public License as published by the Free
    13  dnl      Software Foundation; either version 3 of the License, or (at your
    14  dnl      option) any later version.
    15  dnl
    16  dnl  or
    17  dnl
    18  dnl    * the GNU General Public License as published by the Free Software
    19  dnl      Foundation; either version 2 of the License, or (at your option) any
    20  dnl      later version.
    21  dnl
    22  dnl  or both in parallel, as here.
    23  dnl
    24  dnl  The GNU MP Library is distributed in the hope that it will be useful, but
    25  dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    26  dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    27  dnl  for more details.
    28  dnl
    29  dnl  You should have received copies of the GNU General Public License and the
    30  dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
    31  dnl  see https://www.gnu.org/licenses/.
    32  
    33  include(`../config.m4')
    34  
    35  C	     cycles/limb
    36  C StrongARM	 ?
    37  C XScale	 ?
    38  C Cortex-A7	 ?
    39  C Cortex-A8	 ?
    40  C Cortex-A9	 1.25-1.5
    41  C Cortex-A15	 1.25
    42  
    43  C TODO
    44  C  * Consider wider unrolling.  Analogous 8-way code runs 10% faster on both A9
    45  C    and A15.  But it probably slows things down for 8 <= n < a few dozen.
    46  
    47  define(`rp', `r0')
    48  define(`up', `r1')
    49  define(`n',  `r2')
    50  
    51  ASM_START()
    52  PROLOGUE(mpn_copyi)
    53  	tst	n, #1
    54  	beq	L(skip1)
    55  	ldr	r3, [up], #4
    56  	str	r3, [rp], #4
    57  L(skip1):
    58  	tst	n, #2
    59  	beq	L(skip2)
    60  	ldmia	up!, { r3,r12 }
    61  	stmia	rp!, { r3,r12 }
    62  L(skip2):
    63  	bics	n, n, #3
    64  	beq	L(rtn)
    65  
    66  	push	{ r4-r5 }
    67  	subs	n, n, #4
    68  	ldmia	up!, { r3,r4,r5,r12 }
    69  	beq	L(end)
    70  
    71  L(top):	subs	n, n, #4
    72  	stmia	rp!, { r3,r4,r5,r12 }
    73  	ldmia	up!, { r3,r4,r5,r12 }
    74  	bne	L(top)
    75  
    76  L(end):	stm	rp, { r3,r4,r5,r12 }
    77  	pop	{ r4-r5 }
    78  L(rtn):	ret	lr
    79  EPILOGUE()