Home | History | Annotate | Line # | Download | only in powerpc64
      1 dnl  PowerPC-64 mpn_copyi.
      2 
      3 dnl  Copyright 2004, 2005 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          1
     35 C POWER4/PPC970          1
     36 C POWER5                 ?
     37 C POWER6                 ?
     38 C POWER7                 1.4
     39 
     40 C INPUT PARAMETERS
     41 C rp	r3
     42 C up	r4
     43 C n	r5
     44 
     45 ASM_START()
     46 PROLOGUE(mpn_copyi)
     47 	rldic.	r0, r5, 3, 59	C r0 = (r5 & 3) << 3; cr0 = (n == 4t)?
     48 	cmpldi	cr6, r0, 16	C cr6 = (n cmp 4t + 2)?
     49 
     50 	addi	r5, r5, 4	C compute...
     51 ifdef(`HAVE_ABI_mode32',
     52 `	rldicl	r5, r5, 62,34',	C ...branch count
     53 `	rldicl	r5, r5, 62, 2')	C ...branch count
     54 	mtctr	r5
     55 
     56 	add	r4, r4, r0	C offset up
     57 	add	r3, r3, r0	C offset rp
     58 
     59 	beq	cr0, L(L00)
     60 	blt	cr6, L(L01)
     61 	beq	cr6, L(L10)
     62 	b	L(L11)
     63 
     64 	ALIGN(16)
     65 L(oop):	ld	r6, -32(r4)
     66 	std	r6, -32(r3)
     67 L(L11):	ld	r6, -24(r4)
     68 	std	r6, -24(r3)
     69 L(L10):	ld	r6, -16(r4)
     70 	std	r6, -16(r3)
     71 L(L01):	ld	r6, -8(r4)
     72 	std	r6, -8(r3)
     73 L(L00):	addi	r4, r4, 32
     74 	addi	r3, r3, 32
     75 	bdnz	L(oop)
     76 
     77 	blr
     78 EPILOGUE()
     79