Blame mpn/sparc64/lshiftc.asm

Packit 5c3484
dnl  SPARC v9 mpn_lshiftc
Packit 5c3484
Packit 5c3484
dnl  Contributed to the GNU project by David Miller.
Packit 5c3484
Packit 5c3484
dnl  Copyright 2013 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 UltraSPARC 1&2:	 3
Packit 5c3484
C UltraSPARC 3:		 3
Packit 5c3484
C UltraSPARC T1:	17
Packit 5c3484
C UltraSPARC T3:	10
Packit 5c3484
C UltraSPARC T4:	 3.5
Packit 5c3484
Packit 5c3484
C INPUT PARAMETERS
Packit 5c3484
define(`rp',     `%i0')
Packit 5c3484
define(`up',     `%i1')
Packit 5c3484
define(`n',      `%i2')
Packit 5c3484
define(`cnt',    `%i3')
Packit 5c3484
Packit 5c3484
define(`tcnt',   `%i4')
Packit 5c3484
define(`retval', `%i5')
Packit 5c3484
define(`u0',     `%l0')
Packit 5c3484
define(`u1',     `%l1')
Packit 5c3484
define(`r0',     `%l6')
Packit 5c3484
define(`r1',     `%l7')
Packit 5c3484
define(`u0_off', `%o0')
Packit 5c3484
define(`u1_off', `%o1')
Packit 5c3484
define(`r0_off', `%o2')
Packit 5c3484
define(`r1_off', `%o3')
Packit 5c3484
Packit 5c3484
ASM_START()
Packit 5c3484
	REGISTER(%g2,#scratch)
Packit 5c3484
	REGISTER(%g3,#scratch)
Packit 5c3484
PROLOGUE(mpn_lshiftc)
Packit 5c3484
	save	%sp, -176, %sp
Packit 5c3484
Packit 5c3484
	sllx	n, 3, n
Packit 5c3484
	sub	%g0, cnt, tcnt
Packit 5c3484
Packit 5c3484
	sub	up, 8, u1_off
Packit 5c3484
	add	rp, (5 * 8), r1_off
Packit 5c3484
Packit 5c3484
	ldx	[n + u1_off], u1	C WAS: up - 8
Packit 5c3484
	add	u1_off, (3 * 8), u1_off
Packit 5c3484
Packit 5c3484
	sub	r1_off, 8, r0_off
Packit 5c3484
	sub	u1_off, 8, u0_off
Packit 5c3484
Packit 5c3484
	subcc	n, (3 * 8), n
Packit 5c3484
	srlx	u1, tcnt, retval
Packit 5c3484
Packit 5c3484
	bl,pn	%xcc, L(end12)
Packit 5c3484
	 sllx	u1, cnt, %l3
Packit 5c3484
Packit 5c3484
	ldx	[n + u0_off], u0	C WAS: up - 16
Packit 5c3484
	subcc	n, (2 * 8), n
Packit 5c3484
Packit 5c3484
	ldx	[n + u1_off], u1	C WAS: up - 24
Packit 5c3484
Packit 5c3484
	bl,pn	%xcc, L(end34)
Packit 5c3484
	 srlx	u0, tcnt, %l4
Packit 5c3484
Packit 5c3484
	b,a	L(top)
Packit 5c3484
	ALIGN(16)
Packit 5c3484
L(top):
Packit 5c3484
	not	%l3, %l3
Packit 5c3484
	sllx	u0, cnt, %l2
Packit 5c3484
Packit 5c3484
	andn	%l3, %l4, r0
Packit 5c3484
	ldx	[n + u0_off], u0	C WAS: up - 16
Packit 5c3484
Packit 5c3484
	srlx	u1, tcnt, %l5
Packit 5c3484
	stx	r0, [n + r0_off]	C WAS: rp - 8
Packit 5c3484
Packit 5c3484
	subcc	n, (2 * 8), n
Packit 5c3484
	not	%l2, %l2
Packit 5c3484
Packit 5c3484
	sllx	u1, cnt, %l3
Packit 5c3484
	andn	%l2, %l5, r1
Packit 5c3484
Packit 5c3484
	ldx	[n + u1_off], u1	C WAS: up - 24
Packit 5c3484
	srlx	u0, tcnt, %l4
Packit 5c3484
Packit 5c3484
	bge,pt	%xcc, L(top)
Packit 5c3484
	 stx	r1, [n + r1_off]	C WAS: rp - 16
Packit 5c3484
Packit 5c3484
L(end34):
Packit 5c3484
	not	%l3, %l3
Packit 5c3484
	sllx	u0, cnt, %l2
Packit 5c3484
Packit 5c3484
	andn	%l3, %l4, r0
Packit 5c3484
	srlx	u1, tcnt, %l5
Packit 5c3484
Packit 5c3484
	stx	r0, [n + r0_off]	C WAS: rp - 8
Packit 5c3484
	not	%l2, %l2
Packit 5c3484
Packit 5c3484
	andn	%l2, %l5, r1
Packit 5c3484
	sub	n, (2 * 8), %o5
Packit 5c3484
Packit 5c3484
	sllx	u1, cnt, %l3
Packit 5c3484
	stx	r1, [%o5 + r1_off]	C WAS: rp - 16
Packit 5c3484
Packit 5c3484
L(end12):
Packit 5c3484
	andcc	n, 8, %g0
Packit 5c3484
	bz	%xcc, L(done)+4
Packit 5c3484
	 not	%l3, %l3
Packit 5c3484
Packit 5c3484
	ldx	[n + u0_off], u1
Packit 5c3484
	srlx	u1, tcnt, %l4
Packit 5c3484
	andn	%l3, %l4, r0
Packit 5c3484
	stx	r0, [r0_off - 24]
Packit 5c3484
	sllx	u1, cnt, %l3
Packit 5c3484
L(done):
Packit 5c3484
	not	%l3, %l3
Packit 5c3484
	stx	%l3, [r0_off - 32]
Packit 5c3484
Packit 5c3484
	ret
Packit 5c3484
	restore retval, 0, %o0
Packit 5c3484
EPILOGUE()