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

     1  dnl  PPC64 mpn_bdiv_dbm1c.
     2  
     3  dnl  Copyright 2008, 2010 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 POWER3/PPC630       6-18
    35  C POWER4/PPC970       8.25
    36  C POWER5              8.5  fluctuating as function of n % 3
    37  C POWER6             15
    38  C POWER7              4.75
    39  
    40  C TODO
    41  C  * Nothing to do...
    42  
    43  C INPUT PARAMETERS
    44  define(`rp', `r3')
    45  define(`up', `r4')
    46  define(`n',  `r5')
    47  define(`bd', `r6')
    48  define(`cy', `r7')
    49  
    50  ASM_START()
    51  PROLOGUE(mpn_bdiv_dbm1c)
    52  	ld	r0, 0(r4)
    53  
    54  	rldicl.	r12, r5, 0,62
    55  	cmpldi	cr6, r12, 2
    56  	cmpldi	cr7, r5, 4
    57  	addi	r5, r5, 1
    58  	srwi	r5, r5, 2
    59  	mtctr	r5
    60  	beq	cr0, L(b00)
    61  	blt	cr6, L(b01)
    62  	beq	cr6, L(b10)
    63  
    64  	ALIGN(16)
    65  L(b11):	mulld	r5, r0, r6
    66  	mulhdu	r12, r0, r6
    67  	ld	r0, 8(r4)
    68  	addi	r4, r4, -24
    69  	addi	r3, r3, -24
    70  	b	L(3)
    71  
    72  	ALIGN(16)
    73  L(b00):	mulld	r9, r0, r6
    74  	mulhdu	r8, r0, r6
    75  	addi	r4, r4, -16
    76  	addi	r3, r3, -16
    77  	b	L(0)
    78  
    79  	ALIGN(16)
    80  L(b01):	mulld	r5, r0, r6
    81  	mulhdu	r12, r0, r6
    82  	addi	r3, r3, -8
    83  	ble	cr7, L(e1)
    84  	ld	r0, 8(r4)
    85  	addi	r4, r4, -8
    86  	b	L(1)
    87  
    88  	ALIGN(16)
    89  L(b10):	mulld	r9, r0, r6
    90  	mulhdu	r8, r0, r6
    91  	ble	cr7, L(e2)
    92  
    93  	ALIGN(16)
    94  L(top):	subfc	r11, r9, r7
    95  	ld	r10, 8(r4)
    96  	ld	r0, 16(r4)
    97  	subfe	r7, r8, r11
    98  	std	r11, 0(r3)
    99  	mulld	r5, r10, r6
   100  	mulhdu	r12, r10, r6
   101  L(1):	mulld	r9, r0, r6
   102  	mulhdu	r8, r0, r6
   103  	subfc	r11, r5, r7
   104  	subfe	r7, r12, r11
   105  	std	r11, 8(r3)
   106  L(0):	subfc	r11, r9, r7
   107  	ld	r10, 24(r4)
   108  	ld	r0, 32(r4)
   109  	subfe	r7, r8, r11
   110  	std	r11, 16(r3)
   111  	mulld	r5, r10, r6
   112  	mulhdu	r12, r10, r6
   113  L(3):	mulld	r9, r0, r6
   114  	mulhdu	r8, r0, r6
   115  	subfc	r11, r5, r7
   116  	subfe	r7, r12, r11
   117  	std	r11, 24(r3)
   118  	addi	r4, r4, 32
   119  	addi	r3, r3, 32
   120  	bdnz	L(top)
   121  
   122  L(e2):	ld	r10, 8(r4)
   123  	mulld	r5, r10, r6
   124  	mulhdu	r12, r10, r6
   125  	subfc	r11, r9, r7
   126  	subfe	r7, r8, r11
   127  	std	r11, 0(r3)
   128  L(e1):	subfc	r11, r5, r7
   129  	std	r11, 8(r3)
   130  	subfe	r3, r12, r11
   131  	blr
   132  EPILOGUE()