Blame sysdeps/hppa/hppa1.1/addmul_1.S

Packit 6c4009
;! HP-PA-1.1 __mpn_addmul_1 -- Multiply a limb vector with a limb and
Packit 6c4009
;! add the result to a second limb vector.
Packit 6c4009
Packit 6c4009
;! Copyright (C) 1992-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
Packit 6c4009
;! <http://www.gnu.org/licenses/>.
Packit 6c4009
Packit 6c4009
Packit 6c4009
;! INPUT PARAMETERS
Packit 6c4009
;! res_ptr	r26
Packit 6c4009
;! s1_ptr	r25
Packit 6c4009
;! size		r24
Packit 6c4009
;! s2_limb	r23
Packit 6c4009
Packit 6c4009
;! This runs at 11 cycles/limb on a PA7000.  With the used instructions, it
Packit 6c4009
;! can not become faster due to data cache contention after a store.  On the
Packit 6c4009
;! PA7100 it runs at 10 cycles/limb, and that can not be improved either,
Packit 6c4009
;! since only the xmpyu does not need the integer pipeline, so the only
Packit 6c4009
;! dual-issue we will get are addc+xmpyu.  Unrolling could gain a cycle/limb
Packit 6c4009
;! on the PA7100.
Packit 6c4009
Packit 6c4009
;! There are some ideas described in mul_1.s that applies to this code too.
Packit 6c4009
Packit 6c4009
	.text
Packit 6c4009
	.export		__mpn_addmul_1
Packit 6c4009
__mpn_addmul_1:
Packit 6c4009
	.proc
Packit 6c4009
	.callinfo	frame=64,no_calls
Packit 6c4009
	.entry
Packit 6c4009
Packit 6c4009
	ldo		64(%r30),%r30
Packit 6c4009
	fldws,ma	4(%r25),%fr5
Packit 6c4009
	stw		%r23,-16(%r30)		;! move s2_limb ...
Packit 6c4009
	addib,=		-1,%r24,L$just_one_limb
Packit 6c4009
	 fldws		-16(%r30),%fr4		;! ... into fr4
Packit 6c4009
	add		%r0,%r0,%r0		;! clear carry
Packit 6c4009
	xmpyu		%fr4,%fr5,%fr6
Packit 6c4009
	fldws,ma	4(%r25),%fr7
Packit 6c4009
	fstds		%fr6,-16(%r30)
Packit 6c4009
	xmpyu		%fr4,%fr7,%fr8
Packit 6c4009
	ldw		-12(%r30),%r20		;! least significant limb in product
Packit 6c4009
	ldw		-16(%r30),%r28
Packit 6c4009
Packit 6c4009
	fstds		%fr8,-16(%r30)
Packit 6c4009
	addib,=		-1,%r24,L$end
Packit 6c4009
	 ldw		-12(%r30),%r1
Packit 6c4009
Packit 6c4009
;! Main loop
Packit 6c4009
L$loop:
Packit 6c4009
	ldws		0(%r26),%r29
Packit 6c4009
	fldws,ma	4(%r25),%fr5
Packit 6c4009
	add		%r29,%r20,%r20
Packit 6c4009
	stws,ma		%r20,4(%r26)
Packit 6c4009
	addc		%r28,%r1,%r20
Packit 6c4009
	xmpyu		%fr4,%fr5,%fr6
Packit 6c4009
	ldw		-16(%r30),%r28
Packit 6c4009
	fstds		%fr6,-16(%r30)
Packit 6c4009
	addc		%r0,%r28,%r28
Packit 6c4009
	addib,<>	-1,%r24,L$loop
Packit 6c4009
	 ldw		-12(%r30),%r1
Packit 6c4009
Packit 6c4009
L$end:
Packit 6c4009
	ldw		0(%r26),%r29
Packit 6c4009
	add		%r29,%r20,%r20
Packit 6c4009
	stws,ma		%r20,4(%r26)
Packit 6c4009
	addc		%r28,%r1,%r20
Packit 6c4009
	ldw		-16(%r30),%r28
Packit 6c4009
	ldws		0(%r26),%r29
Packit 6c4009
	addc		%r0,%r28,%r28
Packit 6c4009
	add		%r29,%r20,%r20
Packit 6c4009
	stws,ma		%r20,4(%r26)
Packit 6c4009
	addc		%r0,%r28,%r28
Packit 6c4009
	bv		0(%r2)
Packit 6c4009
	ldo		-64(%r30),%r30
Packit 6c4009
Packit 6c4009
L$just_one_limb:
Packit 6c4009
	xmpyu		%fr4,%fr5,%fr6
Packit 6c4009
	ldw		0(%r26),%r29
Packit 6c4009
	fstds		%fr6,-16(%r30)
Packit 6c4009
	ldw		-12(%r30),%r1
Packit 6c4009
	ldw		-16(%r30),%r28
Packit 6c4009
	add		%r29,%r1,%r20
Packit 6c4009
	stw		%r20,0(%r26)
Packit 6c4009
	addc		%r0,%r28,%r28
Packit 6c4009
	bv		0(%r2)
Packit 6c4009
	 ldo		-64(%r30),%r30
Packit 6c4009
Packit 6c4009
	.exit
Packit 6c4009
	.procend