Blame sysdeps/alpha/lshift.S

Packit 6c4009
 # Alpha 21064 __mpn_lshift --
Packit 6c4009
Packit 6c4009
 # Copyright (C) 1994-2018 Free Software Foundation, Inc.
Packit 6c4009
Packit 6c4009
 # This file is part of the GNU MP Library.
Packit 6c4009
Packit 6c4009
 # The GNU MP Library is free software; you can redistribute it and/or modify
Packit 6c4009
 # it under the terms of the GNU Lesser General Public License as published by
Packit 6c4009
 # the Free Software Foundation; either version 2.1 of the License, or (at your
Packit 6c4009
 # option) any later version.
Packit 6c4009
Packit 6c4009
 # The GNU MP Library is distributed in the hope that it will be useful, but
Packit 6c4009
 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit 6c4009
 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
Packit 6c4009
 # License for more details.
Packit 6c4009
Packit 6c4009
 # You should have received a copy of the GNU Lesser General Public License
Packit 6c4009
 # along with the GNU MP Library.  If not, see <http://www.gnu.org/licenses/>.
Packit 6c4009
Packit 6c4009
Packit 6c4009
 # INPUT PARAMETERS
Packit 6c4009
 # res_ptr	r16
Packit 6c4009
 # s1_ptr	r17
Packit 6c4009
 # size		r18
Packit 6c4009
 # cnt		r19
Packit 6c4009
Packit 6c4009
 # This code runs at 4.8 cycles/limb on the 21064.  With infinite unrolling,
Packit 6c4009
 # it would take 4 cycles/limb.  It should be possible to get down to 3
Packit 6c4009
 # cycles/limb since both ldq and stq can be paired with the other used
Packit 6c4009
 # instructions.  But there are many restrictions in the 21064 pipeline that
Packit 6c4009
 # makes it hard, if not impossible, to get down to 3 cycles/limb:
Packit 6c4009
Packit 6c4009
 # 1. ldq has a 3 cycle delay, srl and sll have a 2 cycle delay.
Packit 6c4009
 # 2. Only aligned instruction pairs can be paired.
Packit 6c4009
 # 3. The store buffer or silo might not be able to deal with the bandwidth.
Packit 6c4009
Packit 6c4009
	.set	noreorder
Packit 6c4009
	.set	noat
Packit 6c4009
.text
Packit 6c4009
	.align	3
Packit 6c4009
	.globl	__mpn_lshift
Packit 6c4009
	.ent	__mpn_lshift
Packit 6c4009
__mpn_lshift:
Packit 6c4009
	.frame	$30,0,$26,0
Packit 6c4009
Packit 6c4009
	s8addq	$18,$17,$17	# make r17 point at end of s1
Packit 6c4009
	ldq	$4,-8($17)	# load first limb
Packit 6c4009
	subq	$17,8,$17
Packit 6c4009
	subq	$31,$19,$7
Packit 6c4009
	s8addq	$18,$16,$16	# make r16 point at end of RES
Packit 6c4009
	subq	$18,1,$18
Packit 6c4009
	and	$18,4-1,$20	# number of limbs in first loop
Packit 6c4009
	srl	$4,$7,$0	# compute function result
Packit 6c4009
Packit 6c4009
	beq	$20,.L0
Packit 6c4009
	subq	$18,$20,$18
Packit 6c4009
Packit 6c4009
	.align	3
Packit 6c4009
.Loop0:
Packit 6c4009
	ldq	$3,-8($17)
Packit 6c4009
	subq	$16,8,$16
Packit 6c4009
	subq	$17,8,$17
Packit 6c4009
	subq	$20,1,$20
Packit 6c4009
	sll	$4,$19,$5
Packit 6c4009
	srl	$3,$7,$6
Packit 6c4009
	bis	$3,$3,$4
Packit 6c4009
	bis	$5,$6,$8
Packit 6c4009
	stq	$8,0($16)
Packit 6c4009
	bne	$20,.Loop0
Packit 6c4009
Packit 6c4009
.L0:	beq	$18,.Lend
Packit 6c4009
Packit 6c4009
	.align	3
Packit 6c4009
.Loop:	ldq	$3,-8($17)
Packit 6c4009
	subq	$16,32,$16
Packit 6c4009
	subq	$18,4,$18
Packit 6c4009
	sll	$4,$19,$5
Packit 6c4009
	srl	$3,$7,$6
Packit 6c4009
Packit 6c4009
	ldq	$4,-16($17)
Packit 6c4009
	sll	$3,$19,$1
Packit 6c4009
	bis	$5,$6,$8
Packit 6c4009
	stq	$8,24($16)
Packit 6c4009
	srl	$4,$7,$2
Packit 6c4009
Packit 6c4009
	ldq	$3,-24($17)
Packit 6c4009
	sll	$4,$19,$5
Packit 6c4009
	bis	$1,$2,$8
Packit 6c4009
	stq	$8,16($16)
Packit 6c4009
	srl	$3,$7,$6
Packit 6c4009
Packit 6c4009
	ldq	$4,-32($17)
Packit 6c4009
	sll	$3,$19,$1
Packit 6c4009
	bis	$5,$6,$8
Packit 6c4009
	stq	$8,8($16)
Packit 6c4009
	srl	$4,$7,$2
Packit 6c4009
Packit 6c4009
	subq	$17,32,$17
Packit 6c4009
	bis	$1,$2,$8
Packit 6c4009
	stq	$8,0($16)
Packit 6c4009
Packit 6c4009
	bgt	$18,.Loop
Packit 6c4009
Packit 6c4009
.Lend:	sll	$4,$19,$8
Packit 6c4009
	stq	$8,-8($16)
Packit 6c4009
	ret	$31,($26),1
Packit 6c4009
	.end	__mpn_lshift