1dnl  HP-PA mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
2dnl  store difference in a third limb vector.
3
4dnl  Copyright 1992, 1994, 2000, 2001, 2002 Free Software Foundation, Inc.
5
6dnl  This file is part of the GNU MP Library.
7
8dnl  The GNU MP Library is free software; you can redistribute it and/or modify
9dnl  it under the terms of the GNU Lesser General Public License as published
10dnl  by the Free Software Foundation; either version 3 of the License, or (at
11dnl  your option) any later version.
12
13dnl  The GNU MP Library is distributed in the hope that it will be useful, but
14dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16dnl  License for more details.
17
18dnl  You should have received a copy of the GNU Lesser General Public License
19dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
20
21include(`../config.m4')
22
23C INPUT PARAMETERS
24C res_ptr	gr26
25C s1_ptr	gr25
26C s2_ptr	gr24
27C size		gr23
28
29C One might want to unroll this as for other processors, but it turns out that
30C the data cache contention after a store makes such unrolling useless.  We
31C can't come under 5 cycles/limb anyway.
32
33ASM_START()
34PROLOGUE(mpn_sub_n)
35	ldws,ma		4(0,%r25),%r20
36	ldws,ma		4(0,%r24),%r19
37
38	addib,=		-1,%r23,L(end)	C check for (SIZE == 1)
39	 sub		%r20,%r19,%r28	C subtract first limbs ignoring cy
40
41LDEF(loop)
42	ldws,ma		4(0,%r25),%r20
43	ldws,ma		4(0,%r24),%r19
44	stws,ma		%r28,4(0,%r26)
45	addib,<>	-1,%r23,L(loop)
46	 subb		%r20,%r19,%r28
47
48LDEF(end)
49	stws		%r28,0(0,%r26)
50	addc		%r0,%r0,%r28
51	bv		0(%r2)
52	 subi		1,%r28,%r28
53EPILOGUE()
54