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

     1  dnl  ARM64 mpn_bdiv_dbm1c.
     2  
     3  dnl  Copyright 2008, 2011, 2012, 2014 Free Software Foundation, Inc.
     4  
     5  dnl  This file is part of the GNU MP Library.
     6  dnl
     7  dnl  The GNU MP Library is free software; you can redistribute it and/or modify
     8  dnl  it under the terms of either:
     9  dnl
    10  dnl    * the GNU Lesser General Public License as published by the Free
    11  dnl      Software Foundation; either version 3 of the License, or (at your
    12  dnl      option) any later version.
    13  dnl
    14  dnl  or
    15  dnl
    16  dnl    * the GNU General Public License as published by the Free Software
    17  dnl      Foundation; either version 2 of the License, or (at your option) any
    18  dnl      later version.
    19  dnl
    20  dnl  or both in parallel, as here.
    21  dnl
    22  dnl  The GNU MP Library is distributed in the hope that it will be useful, but
    23  dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    24  dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    25  dnl  for more details.
    26  dnl
    27  dnl  You should have received copies of the GNU General Public License and the
    28  dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
    29  dnl  see https://www.gnu.org/licenses/.
    30  
    31  include(`../config.m4')
    32  
    33  C	     cycles/limb
    34  C Cortex-A53	 ?
    35  C Cortex-A57	 ?
    36  
    37  define(`qp',	  `x0')
    38  define(`up',	  `x1')
    39  define(`n',	  `x2')
    40  define(`bd',	  `x3')
    41  define(`cy',	  `x4')
    42  
    43  ASM_START()
    44  	TEXT
    45  	ALIGN(16)
    46  PROLOGUE(mpn_bdiv_dbm1c)
    47  	ldr	x5, [up], #8
    48  	ands	x6, n, #3
    49  	b.eq	L(fi0)
    50  	cmp	x6, #2
    51  	b.cc	L(fi1)
    52  	b.eq	L(fi2)
    53  
    54  L(fi3):	mul	x12, x5, bd
    55  	umulh	x13, x5, bd
    56  	ldr	x5, [up], #8
    57  	b	L(lo3)
    58  
    59  L(fi0):	mul	x10, x5, bd
    60  	umulh	x11, x5, bd
    61  	ldr	x5, [up], #8
    62  	b	L(lo0)
    63  
    64  L(fi1):	subs	n, n, #1
    65  	mul	x12, x5, bd
    66  	umulh	x13, x5, bd
    67  	b.ls	L(wd1)
    68  	ldr	x5, [up], #8
    69  	b	L(lo1)
    70  
    71  L(fi2):	mul	x10, x5, bd
    72  	umulh	x11, x5, bd
    73  	ldr	x5, [up], #8
    74  	b	L(lo2)
    75  
    76  L(top):	ldr	x5, [up], #8
    77  	subs	x4, x4, x10
    78  	str	x4, [qp], #8
    79  	sbc	x4, x4, x11
    80  L(lo1):	mul	x10, x5, bd
    81  	umulh	x11, x5, bd
    82  	ldr	x5, [up], #8
    83  	subs	x4, x4, x12
    84  	str	x4, [qp], #8
    85  	sbc	x4, x4, x13
    86  L(lo0):	mul	x12, x5, bd
    87  	umulh	x13, x5, bd
    88  	ldr	x5, [up], #8
    89  	subs	x4, x4, x10
    90  	str	x4, [qp], #8
    91  	sbc	x4, x4, x11
    92  L(lo3):	mul	x10, x5, bd
    93  	umulh	x11, x5, bd
    94  	ldr	x5, [up], #8
    95  	subs	x4, x4, x12
    96  	str	x4, [qp], #8
    97  	sbc	x4, x4, x13
    98  L(lo2):	subs	n, n, #4
    99  	mul	x12, x5, bd
   100  	umulh	x13, x5, bd
   101  	b.hi	L(top)
   102  
   103  L(wd2):	subs	x4, x4, x10
   104  	str	x4, [qp], #8
   105  	sbc	x4, x4, x11
   106  L(wd1):	subs	x4, x4, x12
   107  	str	x4, [qp]
   108  	sbc	x0, x4, x13
   109  	ret
   110  EPILOGUE()