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

     1  dnl  ARM v6 mpn_modexact_1c_odd
     2  
     3  dnl  Contributed to the GNU project by Torbjörn Granlund.
     4  
     5  dnl  Copyright 2012 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	 9
    41  C Cortex-A15	 7
    42  
    43  C Architecture requirements:
    44  C v5	-
    45  C v5t	-
    46  C v5te	smulbb
    47  C v6	umaal
    48  C v6t2	-
    49  C v7a	-
    50  
    51  define(`up', `r0')
    52  define(`n',  `r1')
    53  define(`d',  `r2')
    54  define(`cy', `r3')
    55  
    56  	.protected	binvert_limb_table
    57  ASM_START()
    58  PROLOGUE(mpn_modexact_1c_odd)
    59  	stmfd	sp!, {r4, r5, r6, r7}
    60  
    61  	LEA(	r4, binvert_limb_table)
    62  
    63  	ldr	r6, [up], #4		C up[0]
    64  
    65  	and	r12, d, #254
    66  	ldrb	r4, [r4, r12, lsr #1]
    67  	smulbb	r12, r4, r4
    68  	mul	r12, d, r12
    69  	rsb	r12, r12, r4, asl #1
    70  	mul	r4, r12, r12
    71  	mul	r4, d, r4
    72  	rsb	r4, r4, r12, asl #1	C r4 = inverse
    73  
    74  	subs	n, n, #1
    75  	sub	r6, r6, cy
    76  	mul	r6, r6, r4
    77  	beq	L(end)
    78  
    79  	rsb	r5, r4, #0		C r5 = -inverse
    80  
    81  L(top):	ldr	r7, [up], #4
    82  	mov	r12, #0
    83  	umaal	r12, cy, r6, d
    84  	mul	r6, r7, r4
    85  	mla	r6, cy, r5, r6
    86  	subs	n, n, #1
    87  	bne	L(top)
    88  
    89  L(end):	mov	r12, #0
    90  	umaal	r12, cy, r6, d
    91  	mov	r0, cy
    92  
    93  	ldmfd	sp!, {r4, r5, r6, r7}
    94  	bx	r14
    95  EPILOGUE()