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

     1  dnl  PPC32 mpn_bdiv_dbm1c.
     2  
     3  dnl  Copyright 2008 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 603e:            ?
    35  C 604e:            ?
    36  C 75x (G3):        ?
    37  C 7400,7410 (G4):  9.43
    38  C 744x,745x (G4+): 6.28
    39  C power4/ppc970:   ?
    40  C power5:          ?
    41  
    42  C TODO
    43  C  * Nothing to do...
    44  
    45  C INPUT PARAMETERS
    46  define(`rp', `r3')
    47  define(`up', `r4')
    48  define(`n',  `r5')
    49  define(`bd', `r6')
    50  define(`cy', `r7')
    51  
    52  ASM_START()
    53  PROLOGUE(mpn_bdiv_dbm1c)
    54  	lwz	r0, 0(r4)
    55  
    56  	rlwinm.	r12, r5, 0,30,31
    57  	cmplwi	cr6, r12, 2
    58  	cmplwi	cr7, r5, 4
    59  	addi	r5, r5, 1
    60  	srwi	r5, r5, 2
    61  	mtctr	r5
    62  	beq	cr0, L(b00)
    63  	blt	cr6, L(b01)
    64  	beq	cr6, L(b10)
    65  
    66  L(b11):	mullw	r5, r0, r6
    67  	mulhwu	r12, r0, r6
    68  	lwz	r0, 4(r4)
    69  	addi	r4, r4, -12
    70  	addi	r3, r3, -12
    71  	b	L(3)
    72  
    73  L(b00):	mullw	r9, r0, r6
    74  	mulhwu	r8, r0, r6
    75  	lwz	r0, 4(r4)
    76  	addi	r4, r4, -8
    77  	addi	r3, r3, -8
    78  	b	L(0)
    79  
    80  L(b01):	mullw	r5, r0, r6
    81  	mulhwu	r12, r0, r6
    82  	addi	r3, r3, -4
    83  	ble	cr7, L(e1)
    84  	lwz	r0, 4(r4)
    85  	addi	r4, r4, -4
    86  	b	L(1)
    87  
    88  L(b10):	mullw	r9, r0, r6
    89  	mulhwu	r8, r0, r6
    90  	lwz	r0, 4(r4)
    91  	ble	cr7, L(e2)
    92  
    93  	ALIGN(16)
    94  L(top):	mullw	r5, r0, r6
    95  	mulhwu	r12, r0, r6
    96  	subfc	r11, r9, r7
    97  	lwz	r0, 8(r4)
    98  	subfe	r7, r8, r11
    99  	stw	r11, 0(r3)
   100  L(1):	mullw	r9, r0, r6
   101  	mulhwu	r8, r0, r6
   102  	subfc	r11, r5, r7
   103  	lwz	r0, 12(r4)
   104  	subfe	r7, r12, r11
   105  	stw	r11, 4(r3)
   106  L(0):	mullw	r5, r0, r6
   107  	mulhwu	r12, r0, r6
   108  	subfc	r11, r9, r7
   109  	lwz	r0, 16(r4)
   110  	subfe	r7, r8, r11
   111  	stw	r11, 8(r3)
   112  L(3):	mullw	r9, r0, r6
   113  	mulhwu	r8, r0, r6
   114  	subfc	r11, r5, r7
   115  	lwz	r0, 20(r4)
   116  	subfe	r7, r12, r11
   117  	stw	r11, 12(r3)
   118  	addi	r4, r4, 16
   119  	addi	r3, r3, 16
   120  	bdnz	L(top)
   121  
   122  L(e2):	mullw	r5, r0, r6
   123  	mulhwu	r12, r0, r6
   124  	subfc	r11, r9, r7
   125  	subfe	r7, r8, r11
   126  	stw	r11, 0(r3)
   127  L(e1):	subfc	r11, r5, r7
   128  	stw	r11, 4(r3)
   129  	subfe	r3, r12, r11
   130  	blr
   131  EPILOGUE()