xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/pa32/hppa2_0/sub_n.asm (revision 3587d6f89c746bbb4f886219ddacd41ace480ecf)
1dnl  HP-PA 2.0 32-bit mpn_sub_n -- Subtract two limb vectors of the same
2dnl  length > 0 and store difference in a third limb vector.
3
4dnl  Copyright 1997, 1998, 2000-2002 Free Software Foundation, Inc.
5
6dnl  This file is part of the GNU MP Library.
7dnl
8dnl  The GNU MP Library is free software; you can redistribute it and/or modify
9dnl  it under the terms of either:
10dnl
11dnl    * the GNU Lesser General Public License as published by the Free
12dnl      Software Foundation; either version 3 of the License, or (at your
13dnl      option) any later version.
14dnl
15dnl  or
16dnl
17dnl    * the GNU General Public License as published by the Free Software
18dnl      Foundation; either version 2 of the License, or (at your option) any
19dnl      later version.
20dnl
21dnl  or both in parallel, as here.
22dnl
23dnl  The GNU MP Library is distributed in the hope that it will be useful, but
24dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26dnl  for more details.
27dnl
28dnl  You should have received copies of the GNU General Public License and the
29dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
30dnl  see https://www.gnu.org/licenses/.
31
32include(`../config.m4')
33
34C INPUT PARAMETERS
35C res_ptr	gr26
36C s1_ptr	gr25
37C s2_ptr	gr24
38C size		gr23
39
40C This runs at 2 cycles/limb on PA8000.
41
42ASM_START()
43PROLOGUE(mpn_sub_n)
44	sub		%r0,%r23,%r22
45	zdep		%r22,30,3,%r28		C r28 = 2 * (-n & 7)
46	zdep		%r22,29,3,%r22		C r22 = 4 * (-n & 7)
47	sub		%r25,%r22,%r25		C offset s1_ptr
48	sub		%r24,%r22,%r24		C offset s2_ptr
49	blr		%r28,%r0		C branch into loop
50	sub		%r26,%r22,%r26		C offset res_ptr and set carry
51
52LDEF(loop)
53	ldw		0(%r25),%r20
54	ldw		0(%r24),%r31
55	subb		%r20,%r31,%r20
56	stw		%r20,0(%r26)
57
58LDEF(7)
59	ldw		4(%r25),%r21
60	ldw		4(%r24),%r19
61	subb		%r21,%r19,%r21
62	stw		%r21,4(%r26)
63
64LDEF(6)
65	ldw		8(%r25),%r20
66	ldw		8(%r24),%r31
67	subb		%r20,%r31,%r20
68	stw		%r20,8(%r26)
69
70LDEF(5)
71	ldw		12(%r25),%r21
72	ldw		12(%r24),%r19
73	subb		%r21,%r19,%r21
74	stw		%r21,12(%r26)
75
76LDEF(4)
77	ldw		16(%r25),%r20
78	ldw		16(%r24),%r31
79	subb		%r20,%r31,%r20
80	stw		%r20,16(%r26)
81
82LDEF(3)
83	ldw		20(%r25),%r21
84	ldw		20(%r24),%r19
85	subb		%r21,%r19,%r21
86	stw		%r21,20(%r26)
87
88LDEF(2)
89	ldw		24(%r25),%r20
90	ldw		24(%r24),%r31
91	subb		%r20,%r31,%r20
92	stw		%r20,24(%r26)
93
94LDEF(1)
95	ldw		28(%r25),%r21
96	ldo		32(%r25),%r25
97	ldw		28(%r24),%r19
98	subb		%r21,%r19,%r21
99	stw		%r21,28(%r26)
100	ldo		32(%r24),%r24
101	addib,>		-8,%r23,L(loop)
102	ldo		32(%r26),%r26
103
104	addc		%r0,%r0,%r28
105	bv		(%r2)
106	subi		1,%r28,%r28
107EPILOGUE()
108