1dnl  HP-PA mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
2dnl  store difference in a third limb vector.  Optimized for the PA7100, where
3dnl  is runs at 4.25 cycles/limb.
4
5dnl  Copyright 1992, 1994, 2000-2003 Free Software Foundation, Inc.
6
7dnl  This file is part of the GNU MP Library.
8dnl
9dnl  The GNU MP Library is free software; you can redistribute it and/or modify
10dnl  it under the terms of either:
11dnl
12dnl    * the GNU Lesser General Public License as published by the Free
13dnl      Software Foundation; either version 3 of the License, or (at your
14dnl      option) any later version.
15dnl
16dnl  or
17dnl
18dnl    * the GNU General Public License as published by the Free Software
19dnl      Foundation; either version 2 of the License, or (at your option) any
20dnl      later version.
21dnl
22dnl  or both in parallel, as here.
23dnl
24dnl  The GNU MP Library is distributed in the hope that it will be useful, but
25dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
27dnl  for more details.
28dnl
29dnl  You should have received copies of the GNU General Public License and the
30dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
31dnl  see https://www.gnu.org/licenses/.
32
33include(`../config.m4')
34
35C INPUT PARAMETERS
36C res_ptr	r26
37C s1_ptr	r25
38C s2_ptr	r24
39C size		r23
40
41ASM_START()
42PROLOGUE(mpn_sub_n)
43	ldws,ma		4(0,%r25),%r20
44	ldws,ma		4(0,%r24),%r19
45
46	addib,<=	-5,%r23,L(rest)
47	 sub		%r20,%r19,%r28	C subtract first limbs ignoring cy
48
49LDEF(loop)
50	ldws,ma		4(0,%r25),%r20
51	ldws,ma		4(0,%r24),%r19
52	stws,ma		%r28,4(0,%r26)
53	subb		%r20,%r19,%r28
54	ldws,ma		4(0,%r25),%r20
55	ldws,ma		4(0,%r24),%r19
56	stws,ma		%r28,4(0,%r26)
57	subb		%r20,%r19,%r28
58	ldws,ma		4(0,%r25),%r20
59	ldws,ma		4(0,%r24),%r19
60	stws,ma		%r28,4(0,%r26)
61	subb		%r20,%r19,%r28
62	ldws,ma		4(0,%r25),%r20
63	ldws,ma		4(0,%r24),%r19
64	stws,ma		%r28,4(0,%r26)
65	addib,>		-4,%r23,L(loop)
66	subb		%r20,%r19,%r28
67
68LDEF(rest)
69	addib,=		4,%r23,L(end)
70	nop
71
72LDEF(eloop)
73	ldws,ma		4(0,%r25),%r20
74	ldws,ma		4(0,%r24),%r19
75	stws,ma		%r28,4(0,%r26)
76	addib,>		-1,%r23,L(eloop)
77	subb		%r20,%r19,%r28
78
79LDEF(end)
80	stws		%r28,0(0,%r26)
81	addc		%r0,%r0,%r28
82	bv		0(%r2)
83	 subi		1,%r28,%r28
84EPILOGUE()
85