Home | History | Annotate | Line # | Download | only in x86_64
copyi.asm revision 1.1.1.2
      1 dnl  AMD64 mpn_copyi -- copy limb vector, incrementing.
      2 
      3 dnl  Copyright 2003, 2005, 2007, 2011, 2012 Free Software Foundation, Inc.
      4 
      5 dnl  This file is part of the GNU MP Library.
      6 
      7 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
      8 dnl  it under the terms of the GNU Lesser General Public License as published
      9 dnl  by the Free Software Foundation; either version 3 of the License, or (at
     10 dnl  your option) any later version.
     11 
     12 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
     13 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     14 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
     15 dnl  License for more details.
     16 
     17 dnl  You should have received a copy of the GNU Lesser General Public License
     18 dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
     19 
     20 include(`../config.m4')
     21 
     22 C	     cycles/limb
     23 C AMD K8,K9	 1
     24 C AMD K10	 1
     25 C AMD bd1	 1.36
     26 C AMD bobcat	 1.71
     27 C Intel P4	 2-3
     28 C Intel core2	 1
     29 C Intel NHM	 1
     30 C Intel SBR	 1
     31 C Intel atom	 2
     32 C VIA nano	 2
     33 
     34 
     35 IFSTD(`define(`rp',`%rdi')')
     36 IFSTD(`define(`up',`%rsi')')
     37 IFSTD(`define(`n', `%rdx')')
     38 
     39 IFDOS(`define(`rp',`%rcx')')
     40 IFDOS(`define(`up',`%rdx')')
     41 IFDOS(`define(`n', `%r8')')
     42 
     43 ABI_SUPPORT(DOS64)
     44 ABI_SUPPORT(STD64)
     45 
     46 ASM_START()
     47 	TEXT
     48 	ALIGN(64)
     49 	.byte	0,0,0,0,0,0
     50 PROLOGUE(mpn_copyi)
     51 	lea	-8(rp), rp
     52 	sub	$4, n
     53 	jc	L(end)
     54 
     55 L(top):	mov	(up), %rax
     56 	mov	8(up), %r9
     57 	lea	32(rp), rp
     58 	mov	16(up), %r10
     59 	mov	24(up), %r11
     60 	lea	32(up), up
     61 	mov	%rax, -24(rp)
     62 	mov	%r9, -16(rp)
     63 	sub	$4, n
     64 	mov	%r10, -8(rp)
     65 	mov	%r11, (rp)
     66 	jnc	L(top)
     67 
     68 L(end):	shr	R32(n)
     69 	jnc	1f
     70 	mov	(up), %rax
     71 	mov	%rax, 8(rp)
     72 	lea	8(rp), rp
     73 	lea	8(up), up
     74 1:	shr	R32(n)
     75 	jnc	1f
     76 	mov	(up), %rax
     77 	mov	8(up), %r9
     78 	mov	%rax, 8(rp)
     79 	mov	%r9, 16(rp)
     80 1:	ret
     81 EPILOGUE()
     82