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

Packit 6c4009
;! HP-PA-1.1 __mpn_mul_1 -- Multiply a limb vector with a limb and store
Packit 6c4009
;! the result in 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 9 cycles/limb on a PA7000.  With the used instructions, it can
Packit 6c4009
;! not become faster due to data cache contention after a store.  On the
Packit 6c4009
;! PA7100 it runs at 7 cycles/limb, and that can not be improved either, since
Packit 6c4009
;! only the xmpyu does not need the integer pipeline, so the only dual-issue
Packit 6c4009
;! we will get are addc+xmpyu.  Unrolling would not help either CPU.
Packit 6c4009
Packit 6c4009
;! We could use fldds to read two limbs at a time from the S1 array, and that
Packit 6c4009
;! could bring down the times to 8.5 and 6.5 cycles/limb for the PA7000 and
Packit 6c4009
;! PA7100, respectively.  We don't do that since it does not seem worth the
Packit 6c4009
;! (alignment) troubles...
Packit 6c4009
Packit 6c4009
;! At least the PA7100 is rumored to be able to deal with cache-misses
Packit 6c4009
;! without stalling instruction issue.  If this is true, and the cache is
Packit 6c4009
;! actually also lockup-free, we should use a deeper software pipeline, and
Packit 6c4009
;! load from S1 very early;  (The loads and stores to -12(sp) will surely be
Packit 6c4009
;! in the cache.)
Packit 6c4009
Packit 6c4009
	.text
Packit 6c4009
	.export		__mpn_mul_1
Packit 6c4009
__mpn_mul_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
	fldws,ma	4(%r25),%fr5
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
	addib,<>	-1,%r24,L$loop
Packit 6c4009
	 ldw		-12(%r30),%r1
Packit 6c4009
Packit 6c4009
L$end:
Packit 6c4009
	stws,ma		%r20,4(%r26)
Packit 6c4009
	addc		%r28,%r1,%r20
Packit 6c4009
	ldw		-16(%r30),%r28
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
	fstds		%fr6,-16(%r30)
Packit 6c4009
	ldw		-16(%r30),%r28
Packit 6c4009
	ldo		-64(%r30),%r30
Packit 6c4009
	bv		0(%r2)
Packit 6c4009
	 fstws		%fr6R,0(%r26)
Packit 6c4009
Packit 6c4009
	.exit
Packit 6c4009
	.procend