Blame mpn/x86_64/atom/lshiftc.asm

Packit 5c3484
dnl  AMD64 mpn_lshiftc -- mpn left shift with complement, optimised for Atom.
Packit 5c3484
Packit 5c3484
dnl  Contributed to the GNU project by Torbjorn Granlund.
Packit 5c3484
Packit 5c3484
dnl  Copyright 2011, 2012 Free Software Foundation, Inc.
Packit 5c3484
Packit 5c3484
dnl  This file is part of the GNU MP Library.
Packit 5c3484
dnl
Packit 5c3484
dnl  The GNU MP Library is free software; you can redistribute it and/or modify
Packit 5c3484
dnl  it under the terms of either:
Packit 5c3484
dnl
Packit 5c3484
dnl    * the GNU Lesser General Public License as published by the Free
Packit 5c3484
dnl      Software Foundation; either version 3 of the License, or (at your
Packit 5c3484
dnl      option) any later version.
Packit 5c3484
dnl
Packit 5c3484
dnl  or
Packit 5c3484
dnl
Packit 5c3484
dnl    * the GNU General Public License as published by the Free Software
Packit 5c3484
dnl      Foundation; either version 2 of the License, or (at your option) any
Packit 5c3484
dnl      later version.
Packit 5c3484
dnl
Packit 5c3484
dnl  or both in parallel, as here.
Packit 5c3484
dnl
Packit 5c3484
dnl  The GNU MP Library is distributed in the hope that it will be useful, but
Packit 5c3484
dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit 5c3484
dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
Packit 5c3484
dnl  for more details.
Packit 5c3484
dnl
Packit 5c3484
dnl  You should have received copies of the GNU General Public License and the
Packit 5c3484
dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
Packit 5c3484
dnl  see https://www.gnu.org/licenses/.
Packit 5c3484
Packit 5c3484
include(`../config.m4')
Packit 5c3484
Packit 5c3484
C	     cycles/limb
Packit 5c3484
C AMD K8,K9	 ?
Packit 5c3484
C AMD K10	 ?
Packit 5c3484
C Intel P4	 ?
Packit 5c3484
C Intel core2	 ?
Packit 5c3484
C Intel NHM	 ?
Packit 5c3484
C Intel SBR	 ?
Packit 5c3484
C Intel atom	 5
Packit 5c3484
C VIA nano	 ?
Packit 5c3484
Packit 5c3484
C TODO
Packit 5c3484
C  * Consider using 4-way unrolling.  We reach 4.5 c/l, but the code is 2.5
Packit 5c3484
C    times larger.
Packit 5c3484
Packit 5c3484
C INPUT PARAMETERS
Packit 5c3484
define(`rp',	`%rdi')
Packit 5c3484
define(`up',	`%rsi')
Packit 5c3484
define(`n',	`%rdx')
Packit 5c3484
define(`cnt',	`%rcx')
Packit 5c3484
Packit 5c3484
ABI_SUPPORT(DOS64)
Packit 5c3484
ABI_SUPPORT(STD64)
Packit 5c3484
Packit 5c3484
ASM_START()
Packit 5c3484
	TEXT
Packit 5c3484
	ALIGN(16)
Packit 5c3484
PROLOGUE(mpn_lshiftc)
Packit 5c3484
	FUNC_ENTRY(4)
Packit 5c3484
	lea	-8(up,n,8), up
Packit 5c3484
	lea	-8(rp,n,8), rp
Packit 5c3484
	shr	R32(n)
Packit 5c3484
	mov	(up), %rax
Packit 5c3484
	jnc	L(evn)
Packit 5c3484
Packit 5c3484
	mov	%rax, %r11
Packit 5c3484
	shl	R8(%rcx), %r11
Packit 5c3484
	neg	R8(%rcx)
Packit 5c3484
	shr	R8(%rcx), %rax
Packit 5c3484
	test	n, n
Packit 5c3484
	jnz	L(gt1)
Packit 5c3484
	not	%r11
Packit 5c3484
	mov	%r11, (rp)
Packit 5c3484
	FUNC_EXIT()
Packit 5c3484
	ret
Packit 5c3484
Packit 5c3484
L(gt1):	mov	-8(up), %r8
Packit 5c3484
	mov	%r8, %r10
Packit 5c3484
	shr	R8(%rcx), %r8
Packit 5c3484
	jmp	L(lo1)
Packit 5c3484
Packit 5c3484
L(evn):	mov	%rax, %r10
Packit 5c3484
	neg	R8(%rcx)
Packit 5c3484
	shr	R8(%rcx), %rax
Packit 5c3484
	mov	-8(up), %r9
Packit 5c3484
	mov	%r9, %r11
Packit 5c3484
	shr	R8(%rcx), %r9
Packit 5c3484
	neg	R8(%rcx)
Packit 5c3484
	lea	8(rp), rp
Packit 5c3484
	lea	-8(up), up
Packit 5c3484
	jmp	L(lo0)
Packit 5c3484
Packit 5c3484
C	ALIGN(16)
Packit 5c3484
L(top):	shl	R8(%rcx), %r10
Packit 5c3484
	or	%r10, %r9
Packit 5c3484
	shl	R8(%rcx), %r11
Packit 5c3484
	not	%r9
Packit 5c3484
	neg	R8(%rcx)
Packit 5c3484
	mov	-8(up), %r8
Packit 5c3484
	lea	-16(rp), rp
Packit 5c3484
	mov	%r8, %r10
Packit 5c3484
	shr	R8(%rcx), %r8
Packit 5c3484
	mov	%r9, 8(rp)
Packit 5c3484
L(lo1):	or	%r11, %r8
Packit 5c3484
	mov	-16(up), %r9
Packit 5c3484
	mov	%r9, %r11
Packit 5c3484
	shr	R8(%rcx), %r9
Packit 5c3484
	lea	-16(up), up
Packit 5c3484
	neg	R8(%rcx)
Packit 5c3484
	not	%r8
Packit 5c3484
	mov	%r8, (rp)
Packit 5c3484
L(lo0):	dec	n
Packit 5c3484
	jg	L(top)
Packit 5c3484
Packit 5c3484
L(end):	shl	R8(%rcx), %r10
Packit 5c3484
	or	%r10, %r9
Packit 5c3484
	not	%r9
Packit 5c3484
	shl	R8(%rcx), %r11
Packit 5c3484
	not	%r11
Packit 5c3484
	mov	%r9, -8(rp)
Packit 5c3484
	mov	%r11, -16(rp)
Packit 5c3484
	FUNC_EXIT()
Packit 5c3484
	ret
Packit 5c3484
EPILOGUE()
rpm-build 01f633
CF_PROT